2 man/dmsetup.8.in | 7 ++++
3 tools/dmsetup.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 2 files changed, 95 insertions(+)
6 Index: LVM2.2.02.98/man/dmsetup.8.in
7 ===================================================================
8 --- LVM2.2.02.116.orig/man/dmsetup.8.in 2015-01-30 16:19:53.000000000 +0000
9 +++ LVM2.2.02.116/man/dmsetup.8.in 2015-02-03 21:05:01.635601115 +0000
10 @@ -19,6 +19,9 @@ dmsetup \(em low level logical volume ma
11 .RI [ + ]< sectors >| auto | none ]
20 @@ -309,6 +312,10 @@ device_name in subsequent dmsetup comman
21 If successful a device will appear as
22 /dev/mapper/<device-name>.
23 See below for information on the table format.
27 +Outputs information in key/value format to be imported by other programs.
31 Index: LVM2.2.02.98/tools/dmsetup.c
32 ===================================================================
33 --- LVM2.2.02.98.orig/tools/dmsetup.c
34 +++ LVM2.2.02.98/tools/dmsetup.c
35 @@ -1706,10 +1706,97 @@ static int _status(CMD_ARGS)
41 +static int _export(CMD_ARGS)
44 + struct dm_task *dmt = NULL;
46 + uint64_t start, length;
47 + char *target_type = NULL;
49 + const char *name = NULL;
50 + const char *uuid = NULL;
51 + struct dm_info info;
58 + if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
61 + if (!_set_task_device(dmt, name, 0))
64 + if (!dm_task_run(dmt))
67 + if (!dm_task_get_info(dmt, &info) || !info.exists)
71 + name = dm_task_get_name(dmt);
73 + uuid = dm_task_get_uuid(dmt);
74 + printf("DM_NAME=%s\n", name);
76 + if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
77 + printf("DM_UUID=%s\n", uuid);
80 + printf("DM_STATE=NOTPRESENT\n");
84 + printf("DM_STATE=%s\n",
85 + info.suspended ? "SUSPENDED" :
86 + (info.read_only ? "READONLY" : "ACTIVE"));
88 + if (!info.live_table && !info.inactive_table)
89 + printf("DM_TABLE_STATE=NONE\n");
91 + printf("DM_TABLE_STATE=%s%s%s\n",
92 + info.live_table ? "LIVE" : "",
93 + info.live_table && info.inactive_table ? "/" : "",
94 + info.inactive_table ? "INACTIVE" : "");
96 + if (info.open_count != -1)
97 + printf("DM_OPENCOUNT=%d\n", info.open_count);
99 + printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
101 + printf("DM_MAJOR=%d\n", info.major);
102 + printf("DM_MINOR=%d\n", info.minor);
104 + if (info.target_count != -1)
105 + printf("DM_TARGET_COUNT=%d\n", info.target_count);
107 + /* export all table types */
108 + next = dm_get_next_target(dmt, next, &start, &length,
109 + &target_type, ¶ms);
111 + printf("DM_TARGET_TYPES=%s", target_type);
113 + next = dm_get_next_target(dmt, next, &start, &length,
114 + &target_type, ¶ms);
116 + printf(",%s", target_type);
124 + dm_task_destroy(dmt);
128 /* Show target names and their version numbers */
129 static int _targets(CMD_ARGS)
133 @@ -3056,10 +3143,11 @@ static struct command _commands[] = {
134 {"message", "<device> <sector> <message>", 2, -1, 0, _message},
135 {"ls", "[--target <target_type>] [--exec <command>] [-o options] [--tree]", 0, 0, 0, _ls},
136 {"info", "[<device>]", 0, -1, 1, _info},
137 {"deps", "[-o options] [<device>]", 0, -1, 1, _deps},
138 {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, _status},
139 + {"export", "[<device>]", 0, 1, 1, _export},
140 {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, _status},
141 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, _wait},
142 {"mknodes", "[<device>]", 0, -1, 1, _mknodes},
143 {"mangle", "[<device>]", 0, -1, 1, _mangle},
144 {"udevcreatecookie", "", 0, 0, 0, _udevcreatecookie},