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
18 .RB [ \-c | \-C | \-\-columns ]
20 @@ -309,6 +312,11 @@ device_name in subsequent dmsetup comman
21 \fBblkdevname\fP (block device name),
22 \fBdevname\fP (map name for device-mapper devices, equal to blkdevname otherwise).
27 +Outputs information in key/value format to be imported by other programs.
30 .RB [ \-c | \-C | \-\-columns ]
32 Index: LVM2.2.02.98/tools/dmsetup.c
33 ===================================================================
34 --- LVM2.2.02.98.orig/tools/dmsetup.c
35 +++ LVM2.2.02.98/tools/dmsetup.c
36 @@ -1706,10 +1706,97 @@ static int _status(CMD_ARGS)
42 +static int _export(CMD_ARGS)
45 + struct dm_task *dmt = NULL;
47 + uint64_t start, length;
48 + char *target_type = NULL;
50 + const char *name = NULL;
51 + const char *uuid = NULL;
52 + struct dm_info info;
59 + if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
62 + if (!_set_task_device(dmt, name, 0))
65 + if (!dm_task_run(dmt))
68 + if (!dm_task_get_info(dmt, &info) || !info.exists)
72 + name = dm_task_get_name(dmt);
74 + uuid = dm_task_get_uuid(dmt);
75 + printf("DM_NAME=%s\n", name);
77 + if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
78 + printf("DM_UUID=%s\n", uuid);
81 + printf("DM_STATE=NOTPRESENT\n");
85 + printf("DM_STATE=%s\n",
86 + info.suspended ? "SUSPENDED" :
87 + (info.read_only ? "READONLY" : "ACTIVE"));
89 + if (!info.live_table && !info.inactive_table)
90 + printf("DM_TABLE_STATE=NONE\n");
92 + printf("DM_TABLE_STATE=%s%s%s\n",
93 + info.live_table ? "LIVE" : "",
94 + info.live_table && info.inactive_table ? "/" : "",
95 + info.inactive_table ? "INACTIVE" : "");
97 + if (info.open_count != -1)
98 + printf("DM_OPENCOUNT=%d\n", info.open_count);
100 + printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
102 + printf("DM_MAJOR=%d\n", info.major);
103 + printf("DM_MINOR=%d\n", info.minor);
105 + if (info.target_count != -1)
106 + printf("DM_TARGET_COUNT=%d\n", info.target_count);
108 + /* export all table types */
109 + next = dm_get_next_target(dmt, next, &start, &length,
110 + &target_type, ¶ms);
112 + printf("DM_TARGET_TYPES=%s", target_type);
114 + next = dm_get_next_target(dmt, next, &start, &length,
115 + &target_type, ¶ms);
117 + printf(",%s", target_type);
125 + dm_task_destroy(dmt);
129 /* Show target names and their version numbers */
130 static int _targets(CMD_ARGS)
134 @@ -3056,10 +3143,11 @@ static struct command _commands[] = {
135 {"ls", "[--target <target_type>] [--exec <command>] [-o <options>] [--tree]", 0, 0, 0, 0, _ls},
136 {"info", "[<device>]", 0, -1, 1, 0, _info},
137 {"deps", "[-o <options>] [<device>]", 0, -1, 1, 0, _deps},
138 {"stats", "<command> [<options>] [<devices>]", 1, -1, 1, 1, _stats},
139 {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
140 + {"export", "[<device>]", 0, 1, 1, 0, _export},
141 {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
142 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
143 {"mknodes", "[<device>]", 0, -1, 1, 0, _mknodes},
144 {"mangle", "[<device>]", 0, -1, 1, 0, _mangle},
145 {"udevcreatecookie", "", 0, 0, 0, 0, _udevcreatecookie},