summaryrefslogtreecommitdiffstats
path: root/tools/dmsetup.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-02-15 12:06:17 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2012-02-15 12:06:17 +0000
commitd4aa0496fba23e0dc338c15108bb6a3ce41b3629 (patch)
treee13eebf3060021a5d82a8b61789ee4fab8c86797 /tools/dmsetup.c
parent0f49ede3b10902d49166b4954da6a81700747002 (diff)
downloadlvm2-d4aa0496fba23e0dc338c15108bb6a3ce41b3629.tar.gz
lvm2-d4aa0496fba23e0dc338c15108bb6a3ce41b3629.tar.xz
lvm2-d4aa0496fba23e0dc338c15108bb6a3ce41b3629.zip
Add 'mangled_name' and 'unmangled_name' fields to dmsetup info -c -o.
Diffstat (limited to 'tools/dmsetup.c')
-rw-r--r--tools/dmsetup.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 1c41f7fa..af9095f7 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2262,6 +2262,38 @@ static int _dm_name_disp(struct dm_report *rh,
return dm_report_field_string(rh, field, &name);
}
+static int _dm_mangled_name_disp(struct dm_report *rh,
+ struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field, const void *data,
+ void *private __attribute__((unused)))
+{
+ char *name;
+ int r = 0;
+
+ if ((name = dm_task_get_name_mangled((const struct dm_task *) data))) {
+ r = dm_report_field_string(rh, field, (const char **) &name);
+ dm_free(name);
+ }
+
+ return r;
+}
+
+static int _dm_unmangled_name_disp(struct dm_report *rh,
+ struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field, const void *data,
+ void *private __attribute__((unused)))
+{
+ char *name;
+ int r = 0;
+
+ if ((name = dm_task_get_name_unmangled((const struct dm_task *) data))) {
+ r = dm_report_field_string(rh, field, (const char **) &name);
+ dm_free(name);
+ }
+
+ return r;
+}
+
static int _dm_uuid_disp(struct dm_report *rh,
struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field,
@@ -2693,6 +2725,8 @@ static const struct dm_report_object_type _report_types[] = {
static const struct dm_report_field_type _report_fields[] = {
/* *INDENT-OFF* */
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.")
/* FIXME Next one should be INFO */