1 diff -urp LVM2.2.03.00.orig/libdm/dm-tools/dmsetup.c LVM2.2.03.00/libdm/dm-tools/dmsetup.c
2 --- LVM2.2.03.00.orig/libdm/dm-tools/dmsetup.c 2018-10-21 13:36:20.379416609 +0000
3 +++ LVM2.2.03.00/libdm/dm-tools/dmsetup.c 2018-10-21 14:20:38.626416609 +0000
4 @@ -2557,6 +2557,93 @@ 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;
25 + if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
28 + if (!_set_task_device(dmt, name, 0))
31 + if (!dm_task_run(dmt))
34 + if (!dm_task_get_info(dmt, &info) || !info.exists)
38 + name = dm_task_get_name(dmt);
40 + uuid = dm_task_get_uuid(dmt);
41 + printf("DM_NAME=%s\n", name);
43 + if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
44 + printf("DM_UUID=%s\n", uuid);
47 + printf("DM_STATE=NOTPRESENT\n");
51 + printf("DM_STATE=%s\n",
52 + info.suspended ? "SUSPENDED" :
53 + (info.read_only ? "READONLY" : "ACTIVE"));
55 + if (!info.live_table && !info.inactive_table)
56 + printf("DM_TABLE_STATE=NONE\n");
58 + printf("DM_TABLE_STATE=%s%s%s\n",
59 + info.live_table ? "LIVE" : "",
60 + info.live_table && info.inactive_table ? "/" : "",
61 + info.inactive_table ? "INACTIVE" : "");
63 + if (info.open_count != -1)
64 + printf("DM_OPENCOUNT=%d\n", info.open_count);
66 + printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
68 + printf("DM_MAJOR=%d\n", info.major);
69 + printf("DM_MINOR=%d\n", info.minor);
71 + if (info.target_count != -1)
72 + printf("DM_TARGET_COUNT=%d\n", info.target_count);
74 + /* export all table types */
75 + next = dm_get_next_target(dmt, next, &start, &length,
76 + &target_type, ¶ms);
78 + printf("DM_TARGET_TYPES=%s", target_type);
80 + next = dm_get_next_target(dmt, next, &start, &length,
81 + &target_type, ¶ms);
83 + printf(",%s", target_type);
91 + dm_task_destroy(dmt);
95 /* Show target names and their version numbers */
96 static int _targets(CMD_ARGS)
98 @@ -6232,6 +6319,7 @@ static struct command _dmsetup_commands[
99 {"stats", "<command> [<options>] [<device>...]", 1, -1, 1, 1, _stats},
100 {"status", "[<device>...] [--noflush] [--target <target_type>]", 0, -1, 2, 0, _status},
101 {"table", "[<device>...] [--concise] [--target <target_type>] [--showkeys]", 0, -1, 2, 0, _status},
102 + {"export", "[<device>]", 0, 1, 1, 0, _export},
103 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
104 {"mknodes", "[<device>...]", 0, -1, 1, 0, _mknodes},
105 {"mangle", "[<device>...]", 0, -1, 1, 0, _mangle},
106 diff -urp LVM2.2.03.00.orig/man/dmsetup.8_main LVM2.2.03.00/man/dmsetup.8_main
107 --- LVM2.2.03.00.orig/man/dmsetup.8_main 2018-10-21 13:36:20.380416609 +0000
108 +++ LVM2.2.03.00/man/dmsetup.8_main 2018-10-21 14:20:38.625416609 +0000
109 @@ -59,6 +59,14 @@ dmsetup \(em low level logical volume ma
115 +. RI [ device_name ]
123 . RB [ -c | -C | --columns ]
124 @@ -651,6 +659,9 @@ device. Device names on output can be cu
125 \fBdevname\fP (map name for device-mapper devices, equal to blkdevname otherwise).
129 +Outputs information in key/value format to be imported by other programs.
133 Outputs a summary of the commands available, optionally including