1 diff -urNpa LVM2.2.03.23.orig/libdm/dm-tools/dmsetup.c LVM2.2.03.23/libdm/dm-tools/dmsetup.c
2 --- LVM2.2.03.23.orig/libdm/dm-tools/dmsetup.c 2023-12-03 19:56:43.002779419 +0100
3 +++ LVM2.2.03.23/libdm/dm-tools/dmsetup.c 2023-12-03 19:56:52.195888521 +0100
4 @@ -2565,6 +2565,116 @@ out:
8 +static int _export(CMD_ARGS)
11 + struct dm_task *dmt = NULL;
13 + uint64_t start, length;
14 + char *target_type = NULL;
16 + const char *name = NULL;
17 + const char *uuid = NULL;
18 + struct dm_info info;
19 + struct dm_deps *deps;
26 + if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
29 + if (!_set_task_device(dmt, name, 0))
32 + if (!dm_task_run(dmt))
35 + if (!dm_task_get_info(dmt, &info) || !info.exists)
39 + name = dm_task_get_name(dmt);
41 + uuid = dm_task_get_uuid(dmt);
42 + printf("DM_NAME=%s\n", name);
44 + if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
45 + printf("DM_UUID=%s\n", uuid);
48 + printf("DM_STATE=NOTPRESENT\n");
52 + printf("DM_STATE=%s\n",
53 + info.suspended ? "SUSPENDED" :
54 + (info.read_only ? "READONLY" : "ACTIVE"));
56 + if (!info.live_table && !info.inactive_table)
57 + printf("DM_TABLE_STATE=NONE\n");
59 + printf("DM_TABLE_STATE=%s%s%s\n",
60 + info.live_table ? "LIVE" : "",
61 + info.live_table && info.inactive_table ? "/" : "",
62 + info.inactive_table ? "INACTIVE" : "");
64 + if (info.open_count != -1)
65 + printf("DM_OPENCOUNT=%d\n", info.open_count);
67 + printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
69 + printf("DM_MAJOR=%d\n", info.major);
70 + printf("DM_MINOR=%d\n", info.minor);
72 + if (info.target_count != -1)
73 + printf("DM_TARGET_COUNT=%d\n", info.target_count);
75 + /* export all table types */
76 + next = dm_get_next_target(dmt, next, &start, &length,
77 + &target_type, ¶ms);
79 + printf("DM_TARGET_TYPES=%s", target_type);
81 + next = dm_get_next_target(dmt, next, &start, &length,
82 + &target_type, ¶ms);
84 + printf(",%s", target_type);
89 + dm_task_destroy(dmt);
91 + if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
100 + if (!_set_task_device(dmt, name, 0))
103 + if (!dm_task_run(dmt))
106 + if (!(deps = dm_task_get_deps(dmt)))
109 + printf("DM_DEPS=%d\n", deps->count);
114 + dm_task_destroy(dmt);
118 /* Show target names and their version numbers */
119 static int _targets(CMD_ARGS)
121 @@ -6286,6 +6396,7 @@ static struct command _dmsetup_commands[
122 {"stats", "<command> [<options>] [<device>...]", 1, -1, 1, 1, _stats},
123 {"status", "[<device>...] [--noflush] [--target <target_type>]", 0, -1, 2, 0, _status},
124 {"table", "[<device>...] [--concise] [--target <target_type>] [--showkeys]", 0, -1, 2, 0, _status},
125 + {"export", "[<device>]", 0, 1, 1, 0, _export},
126 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
127 {"mknodes", "[<device>...]", 0, -1, 1, 0, _mknodes},
128 {"mangle", "[<device>...]", 0, -1, 1, 0, _mangle},
129 diff -urNpa LVM2.2.03.23.orig/man/dmsetup.8_main LVM2.2.03.23/man/dmsetup.8_main
130 --- LVM2.2.03.23.orig/man/dmsetup.8_main 2023-12-03 19:56:43.003779431 +0100
131 +++ LVM2.2.03.23/man/dmsetup.8_main 2023-12-03 19:56:52.195888521 +0100
132 @@ -61,6 +61,14 @@ dmsetup \(em low level logical volume ma
138 +. RI [ device_name ]
146 . RB [ -c | -C | --columns ]
147 @@ -642,6 +650,9 @@ device. Device names on output can be cu
148 \fBdevname\fP (map name for device-mapper devices, equal to blkdevname otherwise).
152 +Outputs information in key/value format to be imported by other programs.
156 Outputs a summary of the commands available, optionally including