master - libdm: refactor internal mangling functions
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b0f48b9533b9fd13aaf0ad1bca4cbf68330e60b8 Commit: b0f48b9533b9fd13aaf0ad1bca4cbf68330e60b8 Parent: f65754e6fc0e7e1eb17f058fe92db1ea6eead809 Author: Peter Rajnoha <[email protected]> AuthorDate: Wed Oct 10 16:59:11 2012 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Wed Oct 10 16:59:11 2012 +0200
libdm: refactor internal mangling functions
(un)mangle_name -> (un)mangle_string check_multiple_mangled_name_allowed -> check_multiple_mangled_string_allowed
Just for clarity as the same functions will be reused to (un)mangle dm UUIDs.
--- libdm/ioctl/libdm-iface.c | 4 +- libdm/libdm-common.c | 55 +++++++++++++++++++++++---------------------- libdm/libdm-common.h | 11 +++++---- 3 files changed, 36 insertions(+), 34 deletions(-)
libdm/ioctl/libdm-iface.c +2 -2
@@ -1559,10 +1559,10 @@ static int _do_dm_ioctl_unmangle_name(char *name)if (mode ==DM_STRING_MANGLING_NONE )return 1 ; -if (!check_multiple_mangled_name_allowed (mode, name)) +if (!check_multiple_mangled_string_allowed (name,"name" , mode)) return_0; -if ((r =unmangle_name (name,DM_NAME_LEN , buf,sizeof (buf), mode)) <0 ) { +if ((r =unmangle_string (name,"name" ,DM_NAME_LEN , buf,sizeof (buf), mode)) <0 ) {log_debug ("_do_dm_ioctl_unmangle_name: failed to " "unmangle \"%s\"" , name);return 0 ;
libdm/libdm-common.c +28 -27
135 lines not on this page · raw message
libdm/libdm-common.h +6 -5
@@ -22,13 +22,14 @@#define DEV_NAME (dmt) (dmt->mangled_dev_name ? : dmt->dev_name) -int mangle_name (const char *str,size_t len,char *buf, -size_t buf_len,dm_string_mangling_t mode); +int mangle_string (const char *str,const char *str_name,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); +int unmangle_string (const char *str,const char *str_name,size_t len, +char *buf,size_t buf_len,dm_string_mangling_t mode); -int check_multiple_mangled_name_allowed (dm_string_mangling_t mode,const char *name); +int check_multiple_mangled_string_allowed (const char *str,const char *str_name, +dm_string_mangling_t mode); struct target *create_target(uint64_t start, uint64_t len,