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 @@ -48,6 +48,14 @@ dmsetup \(em low level logical volume ma
24 . RB [ \-c | \-C | \-\-columns ]
25 @@ -629,6 +637,11 @@ device. Device names on output can be cu
26 \fBdevname\fP (map name for device-mapper devices, equal to blkdevname otherwise).
31 +Outputs information in key/value format to be imported by other programs.
36 Outputs a summary of the commands available, optionally including
37 Index: LVM2.2.02.98/tools/dmsetup.c
38 ===================================================================
39 --- LVM2.2.02.98.orig/tools/dmsetup.c
40 +++ LVM2.2.02.98/tools/dmsetup.c
41 @@ -2194,6 +2194,93 @@ out:
45 +static int _export(CMD_ARGS)
48 + struct dm_task *dmt = NULL;
50 + uint64_t start, length;
51 + char *target_type = NULL;
53 + const char *name = NULL;
54 + const char *uuid = NULL;
55 + struct dm_info info;
62 + if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
65 + if (!_set_task_device(dmt, name, 0))
68 + if (!dm_task_run(dmt))
71 + if (!dm_task_get_info(dmt, &info) || !info.exists)
75 + name = dm_task_get_name(dmt);
77 + uuid = dm_task_get_uuid(dmt);
78 + printf("DM_NAME=%s\n", name);
80 + if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
81 + printf("DM_UUID=%s\n", uuid);
84 + printf("DM_STATE=NOTPRESENT\n");
88 + printf("DM_STATE=%s\n",
89 + info.suspended ? "SUSPENDED" :
90 + (info.read_only ? "READONLY" : "ACTIVE"));
92 + if (!info.live_table && !info.inactive_table)
93 + printf("DM_TABLE_STATE=NONE\n");
95 + printf("DM_TABLE_STATE=%s%s%s\n",
96 + info.live_table ? "LIVE" : "",
97 + info.live_table && info.inactive_table ? "/" : "",
98 + info.inactive_table ? "INACTIVE" : "");
100 + if (info.open_count != -1)
101 + printf("DM_OPENCOUNT=%d\n", info.open_count);
103 + printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
105 + printf("DM_MAJOR=%d\n", info.major);
106 + printf("DM_MINOR=%d\n", info.minor);
108 + if (info.target_count != -1)
109 + printf("DM_TARGET_COUNT=%d\n", info.target_count);
111 + /* export all table types */
112 + next = dm_get_next_target(dmt, next, &start, &length,
113 + &target_type, ¶ms);
115 + printf("DM_TARGET_TYPES=%s", target_type);
117 + next = dm_get_next_target(dmt, next, &start, &length,
118 + &target_type, ¶ms);
120 + printf(",%s", target_type);
128 + dm_task_destroy(dmt);
132 /* Show target names and their version numbers */
133 static int _targets(CMD_ARGS)
135 @@ -5155,6 +5242,7 @@ static struct command _dmsetup_commands[
136 {"deps", "[-o <options>] [<device>]", 0, -1, 1, 0, _deps},
137 {"stats", "<command> [<options>] [<devices>]", 1, -1, 1, 1, _stats},
138 {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
139 + {"export", "[<device>]", 0, 1, 1, 0, _export},
140 {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
141 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
142 {"mknodes", "[<device>]", 0, -1, 1, 0, _mknodes},