diff mbox series

[2/8] libmultipath: move get_udev_for_mpp to sysfs.c

Message ID 20240417184644.6193-3-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: max_sectors_kb rework | expand

Commit Message

Martin Wilck April 17, 2024, 6:46 p.m. UTC
No functional changes, just code movement.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/configure.c | 20 --------------------
 libmultipath/sysfs.c     | 19 +++++++++++++++++++
 libmultipath/sysfs.h     |  4 ++++
 3 files changed, 23 insertions(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 4ecf6ba..89ac03d 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -453,26 +453,6 @@  pgcmp (struct multipath * mpp, struct multipath * cmpp)
 	return r;
 }
 
-static struct udev_device *
-get_udev_for_mpp(const struct multipath *mpp)
-{
-	dev_t devnum;
-	struct udev_device *udd;
-
-	if (!mpp || !has_dm_info(mpp)) {
-		condlog(1, "%s called with empty mpp", __func__);
-		return NULL;
-	}
-
-	devnum = makedev(mpp->dmi.major, mpp->dmi.minor);
-	udd = udev_device_new_from_devnum(udev, 'b', devnum);
-	if (!udd) {
-		condlog(1, "failed to get udev device for %s", mpp->alias);
-		return NULL;
-	}
-	return udd;
-}
-
 void trigger_partitions_udev_change(struct udev_device *dev,
 				    const char *action, int len)
 {
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 328951e..afe9de9 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -339,3 +339,22 @@  bool sysfs_is_multipathed(struct path *pp, bool set_wwid)
 
 	return found;
 }
+
+struct udev_device *get_udev_for_mpp(const struct multipath *mpp)
+{
+	dev_t devnum;
+	struct udev_device *udd;
+
+	if (!mpp || !has_dm_info(mpp)) {
+		condlog(1, "%s called with empty mpp", __func__);
+		return NULL;
+	}
+
+	devnum = makedev(mpp->dmi.major, mpp->dmi.minor);
+	udd = udev_device_new_from_devnum(udev, 'b', devnum);
+	if (!udd) {
+		condlog(1, "failed to get udev device for %s", mpp->alias);
+		return NULL;
+	}
+	return udd;
+}
diff --git a/libmultipath/sysfs.h b/libmultipath/sysfs.h
index 2db86bd..3be3f66 100644
--- a/libmultipath/sysfs.h
+++ b/libmultipath/sysfs.h
@@ -39,4 +39,8 @@  do {									\
 int sysfs_get_size (struct path *pp, unsigned long long * size);
 int sysfs_check_holders(char * check_devt, char * new_devt);
 bool sysfs_is_multipathed(struct path *pp, bool set_wwid);
+
+struct multipath;
+struct udev_device *get_udev_for_mpp(const struct multipath *mpp);
+
 #endif