]> git.pld-linux.org Git - packages/lvm2.git/blob - device-mapper-dmsetup-export.patch
post/preun/postun scripts for clvmd added
[packages/lvm2.git] / device-mapper-dmsetup-export.patch
1 diff -dur -x '*~' -x '*.orig' -x '*.rej' LVM2.2.02.98.orig/man/dmsetup.8.in LVM2.2.02.98/man/dmsetup.8.in
2 --- LVM2.2.02.98.orig/man/dmsetup.8.in  2012-10-15 16:24:58.000000000 +0200
3 +++ LVM2.2.02.98/man/dmsetup.8.in       2012-10-25 10:24:13.000000000 +0200
4 @@ -43,6 +43,9 @@
5  .RI [ device_name ]
6  .RE
7  .br
8 +.B dmsetup export
9 +.RI [ device_name ]
10 +.br
11  .B dmsetup load
12  .I device_name
13  .RB [ \-\-table
14 @@ -287,6 +290,12 @@
15  See below for information on the table format.
16  .br
17  .TP
18 +.B export
19 +.RI [ device_name ]
20 +.br
21 +Outputs information in key/value format to be imported by other programs.
22 +.br
23 +.TP
24  .B deps
25  .RB [ \-o
26  .IR options ]
27 diff -dur -x '*~' -x '*.orig' -x '*.rej' LVM2.2.02.98.orig/tools/dmsetup.c LVM2.2.02.98/tools/dmsetup.c
28 --- LVM2.2.02.98.orig/tools/dmsetup.c   2012-10-25 10:23:32.000000000 +0200
29 +++ LVM2.2.02.98/tools/dmsetup.c        2012-10-25 10:24:35.000000000 +0200
30 @@ -1725,6 +1725,94 @@
31         return r;
32  }
33  
34 +static int _export(int argc, char **argv, void *data)
35 +{
36 +       int r = 0;
37 +       struct dm_task *dmt = NULL;
38 +       void *next = NULL;
39 +       uint64_t start, length;
40 +       char *target_type = NULL;
41 +       char *params;
42 +       struct dm_names *names = (struct dm_names *) data;
43 +       const char *name = NULL;
44 +       const char *uuid = NULL;
45 +       struct dm_info info;
46 +
47 +       if (data)
48 +               name = names->name;
49 +       else if (argc == 2)
50 +               name = argv[1];
51 +
52 +       if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
53 +               goto out;
54 +
55 +       if (!_set_task_device(dmt, name, 0))
56 +               goto out;
57 +
58 +       if (!dm_task_run(dmt))
59 +               goto out;
60 +
61 +       if (!dm_task_get_info(dmt, &info) || !info.exists)
62 +               goto out;
63 +
64 +       if (!name)
65 +               name = dm_task_get_name(dmt);
66 +
67 +       uuid = dm_task_get_uuid(dmt);
68 +       printf("DM_NAME=%s\n", name);
69 +
70 +       if ((uuid = dm_task_get_uuid(dmt)) && *uuid)
71 +               printf("DM_UUID=%s\n", uuid);
72 +
73 +       if (!info.exists) {
74 +               printf("DM_STATE=NOTPRESENT\n");
75 +               goto out;
76 +       }
77 +
78 +       printf("DM_STATE=%s\n",
79 +              info.suspended ? "SUSPENDED" :
80 +              (info.read_only ? " READONLY" : "ACTIVE"));
81 +
82 +       if (!info.live_table && !info.inactive_table)
83 +               printf("DM_TABLE_STATE=NONE\n");
84 +       else
85 +               printf("DM_TABLE_STATE=%s%s%s\n",
86 +                      info.live_table ? "LIVE" : "",
87 +                      info.live_table && info.inactive_table ? "/" : "",
88 +                      info.inactive_table ? "INACTIVE" : "");
89 +
90 +       if (info.open_count != -1)
91 +               printf("DM_OPENCOUNT=%d\n", info.open_count);
92 +
93 +       printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr);
94 +
95 +       printf("DM_MAJOR=%d\n", info.major);
96 +       printf("DM_MINOR=%d\n", info.minor);
97 +
98 +       if (info.target_count != -1)
99 +               printf("DM_TARGET_COUNT=%d\n", info.target_count);
100 +
101 +       /* export all table types */
102 +       next = dm_get_next_target(dmt, next, &start, &length,
103 +                                 &target_type, &params);
104 +       if (target_type) {
105 +               printf("DM_TARGET_TYPES=%s", target_type);
106 +               while (next) {
107 +                       next = dm_get_next_target(dmt, next, &start, &length,
108 +                                                 &target_type, &params);
109 +                       if (target_type)
110 +                               printf(",%s", target_type);
111 +               }
112 +               printf("\n");
113 +       }
114 +
115 +       r = 1;
116 +      out:
117 +       if (dmt)
118 +               dm_task_destroy(dmt);
119 +       return r;
120 +}
121 +
122  /* Show target names and their version numbers */
123  static int _targets(CMD_ARGS)
124  {
125 @@ -3075,6 +3163,7 @@
126         {"info", "[<device>]", 0, -1, 1, _info},
127         {"deps", "[-o options] [<device>]", 0, -1, 1, _deps},
128         {"status", "[<device>] [--noflush] [--target <target_type>]", 0, -1, 1, _status},
129 +       {"export", "[<device>]", 0, -1, 1, _export},
130         {"table", "[<device>] [--target <target_type>] [--showkeys]", 0, -1, 1, _status},
131         {"wait", "<device> [<event_nr>] [--noflush]", 0, 2, 0, _wait},
132         {"mknodes", "[<device>]", 0, -1, 1, _mknodes},
This page took 0.031771 seconds and 3 git commands to generate.