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 Index: LVM2.2.02.98/tools/dmsetup.c
40 ===================================================================
41 --- LVM2.2.02.98.orig/tools/dmsetup.c
42 +++ LVM2.2.02.98/tools/dmsetup.c
43 @@ -1706,10 +1706,97 @@ static int _status(CMD_ARGS)
49 +static int _export(CMD_ARGS)
52 + struct dm_task *dmt = NULL;
54 + uint64_t start, length;
55 + char *target_type = NULL;
57 + const char *name = NULL;
58 + const char *uuid = NULL;
59 + struct dm_info info;
66 + if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
69 + if (!_set_task_device(dmt, name, 0))
72 + if (!dm_task_run(dmt))
75 + if (!dm_task_get_info(dmt, &info) || !info.exists)
79 + name = dm_task_get_name(dmt);
81 + uuid = dm_task_get_uuid(dmt);
82 + printf("DM_NAME=%s\n", name);
84 + if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
85 + printf("DM_UUID=%s\n", uuid);
88 + printf("DM_STATE=NOTPRESENT\n");
92 + printf("DM_STATE=%s\n",
93 + info.suspended ? "SUSPENDED" :
94 + (info.read_only ? "READONLY" : "ACTIVE"));
96 + if (!info.live_table && !info.inactive_table)
97 + printf("DM_TABLE_STATE=NONE\n");
99 + printf("DM_TABLE_STATE=%s%s%s\n",
100 + info.live_table ? "LIVE" : "",
101 + info.live_table && info.inactive_table ? "/" : "",
102 + info.inactive_table ? "INACTIVE" : "");
104 + if (info.open_count != -1)
105 + printf("DM_OPENCOUNT=%d\n", info.open_count);
107 + printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
109 + printf("DM_MAJOR=%d\n", info.major);
110 + printf("DM_MINOR=%d\n", info.minor);
112 + if (info.target_count != -1)
113 + printf("DM_TARGET_COUNT=%d\n", info.target_count);
115 + /* export all table types */
116 + next = dm_get_next_target(dmt, next, &start, &length,
117 + &target_type, ¶ms);
119 + printf("DM_TARGET_TYPES=%s", target_type);
121 + next = dm_get_next_target(dmt, next, &start, &length,
122 + &target_type, ¶ms);
124 + printf(",%s", target_type);
132 + dm_task_destroy(dmt);
136 /* Show target names and their version numbers */
137 static int _targets(CMD_ARGS)
141 @@ -3056,10 +3143,11 @@ static struct command _commands[] = {
142 {"message", "<device> <sector> <message>", 2, -1, 0, _message},
143 {"ls", "[--target <target_type>] [--exec <command>] [-o options] [--tree]", 0, 0, 0, _ls},
144 {"info", "[<device>]", 0, -1, 1, _info},
145 {"deps", "[-o options] [<device>]", 0, -1, 1, _deps},
146 {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, _status},
147 + {"export", "[<device>]", 0, 1, 1, _export},
148 {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, _status},
149 {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, _wait},
150 {"mknodes", "[<device>]", 0, -1, 1, _mknodes},
151 {"mangle", "[<device>]", 0, -1, 1, _mangle},
152 {"udevcreatecookie", "", 0, 0, 0, _udevcreatecookie},