Skip to contentSkip to conversation

LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...

PATCH [email protected] 1 participant 1 message Feb 15, 2012

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at sourceware.org 2012-02-15 11:39:38

Modified files:
. : WHATS_NEW_DM
libdm : libdevmapper.h libdm-common.c libdm-common.h

Log message:
Add dm_task_get_name_mangled/unmangled to libdevmapper.

dm_task_get_name_mangled will always return mangled form of the name while the dm_task_get_name_unmangled will always return unmangled form of the name irrespective of the global setting (dm_set/get_name_mangling_mode).

This is handy in situations where we need to detect whether the name is already mangled or not. Also display functions make use of it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.559&r2=1.560
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.180&r2=1.181
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.139&r2=1.140
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.h.diff?cvsroot=lvm2&r1=1.12&r2=1.13

WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@
 Version 1.02.71 - 
 ====================================
+  Add dm_task_get_name_mangled/unmangled to libdevmapper.
   Mangle device name on dm_task_set_name/newname call if necessary.
   Add dm_set/get_name_mangling_mode to set/get name mangling in libdevmapper.
   Add configure --with-default-name-mangling.
libdm/libdevmapper.h +9 -0
@@ -171,6 +171,7 @@
 struct dm_names *dm_task_get_names(struct dm_task *dmt);
 struct dm_versions *dm_task_get_versions(struct dm_task *dmt);
 
+
 int dm_task_set_ro(struct dm_task *dmt);
 int dm_task_set_newname(struct dm_task *dmt, const char *newname);
 int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid);
@@ -293,6 +294,14 @@
 dm_string_mangling_t dm_get_name_mangling_mode(void);
 
 /*
+ * Get mangled/unmangled form of the device-mapper name
+ * irrespective of the global setting (set by dm_set_name_mangling_mode).
+ * The name returned needs to be freed after use by calling dm_free!
+ */
+char *dm_task_get_name_mangled(const struct dm_task *dmt);
+char *dm_task_get_name_unmangled(const struct dm_task *dmt);
+
+/*
  * Configure the device-mapper directory
  */
 int dm_set_dev_dir(const char *dir);
libdm/libdm-common.c +88 -0

100 lines not on this page · raw message

libdm/libdm-common.h +3 -0
@@ -23,6 +23,9 @@
 int mangle_name(const char *str, size_t len, char *buf,
 		size_t buf_len, dm_string_mangling_t mode);
 
+int unmangle_name(const char *str, size_t len, char *buf,
+		  size_t buf_len, dm_string_mangling_t mode);
+
 struct target *create_target(uint64_t start,
 			     uint64_t len,
 			     const char *type, const char *params);