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.98.orig/man/dmsetup.8.in
9 +++ LVM2.2.02.98/man/dmsetup.8.in
10 @@ -17,10 +17,13 @@ dmsetup \- low level logical volume mana
11 .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }]
13 .RI [ + ]< sectors >| auto | none ]
24 @@ -283,10 +286,14 @@ Otherwise a table is read from standard
25 The optional uuid can be used in place of
26 device_name in subsequent dmsetup commands.
27 If successful a device will appear as
28 /dev/mapper/<device-name>.
29 See below for information on the table format.
33 +Outputs information in key/value format to be imported by other programs.
39 --- LVM2.2.02.130/tools/dmsetup.c.orig 2015-09-09 18:44:39.471523160 +0200
40 +++ LVM2.2.02.130/tools/dmsetup.c 2015-09-09 18:48:33.918179988 +0200
41 @@ -2189,6 +2189,93 @@
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 @@ -5139,6 +5226,7 @@
136 {"stats", "<command> [<options>] [<devices>]", 1, -1, 1, 1, _stats},
137 {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, 0, _status},
138 {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, 0, _status},
139 + {"export", "[<device>]", 0, 1, 1, 0, _export},
140 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, 0, _wait},
141 {"mknodes", "[<device>]", 0, -1, 1, 0, _mknodes},
142 {"mangle", "[<device>]", 0, -1, 1, 0, _mangle},