]> sourceware.org Git - lvm2.git/commitdiff
dmsetup: add mangled/unmangled_uuid to for info -c
authorPeter Rajnoha <prajnoha@redhat.com>
Wed, 10 Oct 2012 15:02:59 +0000 (17:02 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Wed, 10 Oct 2012 15:16:15 +0000 (17:16 +0200)
Following the same logic already used for name mangling.

tools/dmsetup.c

index 0ac970f704e0fc4a6dc1bd5f8f865ea24f0df6e4..8d24293117053730dc531d02c80a12effc0bee2e 100644 (file)
@@ -2319,6 +2319,38 @@ static int _dm_uuid_disp(struct dm_report *rh,
        return dm_report_field_string(rh, field, &uuid);
 }
 
+static int _dm_mangled_uuid_disp(struct dm_report *rh,
+                                struct dm_pool *mem __attribute__((unused)),
+                                struct dm_report_field *field,
+                                const void *data, void *private __attribute__((unused)))
+{
+       char *uuid;
+       int r = 0;
+
+       if ((uuid = dm_task_get_uuid_mangled((const struct dm_task *) data))) {
+               r = dm_report_field_string(rh, field, (const char * const *) &uuid);
+               dm_free(uuid);
+       }
+
+       return r;
+}
+
+static int _dm_unmangled_uuid_disp(struct dm_report *rh,
+                                  struct dm_pool *mem __attribute__((unused)),
+                                  struct dm_report_field *field,
+                                  const void *data, void *private __attribute__((unused)))
+{
+       char *uuid;
+       int r = 0;
+
+       if ((uuid = dm_task_get_uuid_unmangled((const struct dm_task *) data))) {
+               r = dm_report_field_string(rh, field, (const char * const *) &uuid);
+               dm_free(uuid);
+       }
+
+       return r;
+}
+
 static int _dm_read_ahead_disp(struct dm_report *rh,
                               struct dm_pool *mem __attribute__((unused)),
                               struct dm_report_field *field, const void *data,
@@ -2740,6 +2772,8 @@ FIELD_F(TASK, STR, "Name", 16, dm_name, "name", "Name of mapped device.")
 FIELD_F(TASK, STR, "MangledName", 16, dm_mangled_name, "mangled_name", "Mangled name of mapped device.")
 FIELD_F(TASK, STR, "UnmangledName", 16, dm_unmangled_name, "unmangled_name", "Unmangled name of mapped device.")
 FIELD_F(TASK, STR, "UUID", 32, dm_uuid, "uuid", "Unique (optional) identifier for mapped device.")
+FIELD_F(TASK, STR, "MangledUUID", 32, dm_mangled_uuid, "mangled_uuid", "Mangled unique (optional) identifier for mapped device.")
+FIELD_F(TASK, STR, "UnmangledUUID", 32, dm_unmangled_uuid, "unmangled_uuid", "Unmangled unique (optional) identifier for mapped device.")
 
 /* FIXME Next one should be INFO */
 FIELD_F(TASK, NUM, "RAhead", 6, dm_read_ahead, "read_ahead", "Read ahead in sectors.")
This page took 0.048411 seconds and 5 git commands to generate.