diff mbox series

[v2,10/13] libmultipath: move dm_rename__ before rename_partmap

Message ID 20241122211133.718861-11-bmarzins@redhat.com (mailing list archive)
State New
Headers show
Series multipath-tools: Handle tableless DM devices | expand

Commit Message

Benjamin Marzinski Nov. 22, 2024, 9:11 p.m. UTC
No functional changes.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/devmapper.c | 55 +++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 29 deletions(-)

Comments

Martin Wilck Nov. 22, 2024, 10:03 p.m. UTC | #1
On Fri, 2024-11-22 at 16:11 -0500, Benjamin Marzinski wrote:
> No functional changes.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>

I suggest squashing this into the previous patch.

Martin
diff mbox series

Patch

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index daaeebb4..751b45d8 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1480,7 +1480,32 @@  struct rename_data {
 };
 
 static int
-dm_rename__(const char *old, char *new, int skip_kpartx);
+dm_rename__(const char *old, char *new, int skip_kpartx)
+{
+	int r = 0;
+	struct dm_task __attribute__((cleanup(cleanup_dm_task))) *dmt = NULL;
+	uint32_t cookie = 0;
+	uint16_t udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
+
+	if (!(dmt = libmp_dm_task_create(DM_DEVICE_RENAME)))
+		return r;
+
+	if (!dm_task_set_name(dmt, old))
+		return r;
+
+	if (!dm_task_set_newname(dmt, new))
+		return r;
+
+	if (!dm_task_set_cookie(dmt, &cookie, udev_flags))
+		return r;
+
+	r = libmp_dm_task_run(dmt);
+	if (!r)
+		dm_log_error(2, DM_DEVICE_RENAME, dmt);
+
+	libmp_udev_wait(cookie);
+	return r;
+}
 
 static int
 rename_partmap (const char *name, void *data)
@@ -1520,34 +1545,6 @@  dm_rename_partmaps (const char * old, char * new, char *delim)
 	return do_foreach_partmaps(old, rename_partmap, &rd);
 }
 
-static int
-dm_rename__(const char *old, char *new, int skip_kpartx)
-{
-	int r = 0;
-	struct dm_task __attribute__((cleanup(cleanup_dm_task))) *dmt = NULL;
-	uint32_t cookie = 0;
-	uint16_t udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
-
-	if (!(dmt = libmp_dm_task_create(DM_DEVICE_RENAME)))
-		return r;
-
-	if (!dm_task_set_name(dmt, old))
-		return r;
-
-	if (!dm_task_set_newname(dmt, new))
-		return r;
-
-	if (!dm_task_set_cookie(dmt, &cookie, udev_flags))
-		return r;
-
-	r = libmp_dm_task_run(dmt);
-	if (!r)
-		dm_log_error(2, DM_DEVICE_RENAME, dmt);
-
-	libmp_udev_wait(cookie);
-	return r;
-}
-
 int
 dm_rename (const char * old, char * new, char *delim, int skip_kpartx)
 {