Move dm_task_set_newname to libdm-common.c
PATCH 1/6 Move dm_task_set_newname to libdm-common.c
Add support for device name mangling (to comply with udev whitelist) patchset.
This is a more elaborate proposal of the former patch:
[lvm-devel][PATCH] Add support for escaping device-mapper names (to be in sync with udev whitelist)
This patch #1 is just a preparation - the dm_task_set_newname is moved from libdm-iface.c to libdm-common.c (where the dm_task_set_name is already). These fns will call new functions for setting the name mangling.
Peter
--- libdm/ioctl/libdm-iface.c | 21 --------------------- libdm/libdm-common.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-)
libdm/ioctl/libdm-iface.c +0 -21
@@ -745,27 +745,6 @@ int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid)return 1 ; } -int dm_task_set_newname (struct dm_task *dmt,const char *newname) -{ -if (strchr (newname,'/' )) { -log_error ("Name \"%s\" invalid. It contains \"/\"." , newname); -return 0 ; - } - -if (strlen (newname) >=DM_NAME_LEN ) { -log_error ("Name \"%s\" too long" , newname); -return 0 ; - } - -if (!(dmt->newname =dm_strdup (newname))) { -log_error ("dm_task_set_newname: strdup(%s) failed" , newname); -return 0 ; - } - dmt->new_uuid =0 ; - -return 1 ; -} -int dm_task_set_message (struct dm_task *dmt,const char *message) {if (!(dmt->message =dm_strdup (message))) {
libdm/libdm-common.c +21 -0
@@ -338,6 +338,27 @@ int dm_task_set_name(struct dm_task *dmt, const char *name)return 1 ; } +int dm_task_set_newname (struct dm_task *dmt,const char *newname) +{ +if (strchr (newname,'/' )) { +log_error ("Name \"%s\" invalid. It contains \"/\"." , newname); +return 0 ; + } + +if (strlen (newname) >=DM_NAME_LEN ) { +log_error ("Name \"%s\" too long" , newname); +return 0 ; + } + +if (!(dmt->newname =dm_strdup (newname))) { +log_error ("dm_task_set_newname: strdup(%s) failed" , newname); +return 0 ; + } + dmt->new_uuid =0 ; + +return 1 ; +} +int dm_task_set_uuid (struct dm_task *dmt,const char *uuid) {dm_free (dmt->uuid);