[PATCH 13/44] libmpathutil: export cleanup_udev_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This function is useful in multiple callers.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmpathutil/libmpathutil.version | 4 ++++
 libmpathutil/util.c               | 6 ++++++
 libmpathutil/util.h               | 3 +++
 libmultipath/print.c              | 6 ------
 tests/Makefile                    | 2 +-
 5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/libmpathutil/libmpathutil.version b/libmpathutil/libmpathutil.version
index fee74a3..86450f4 100644
--- a/libmpathutil/libmpathutil.version
+++ b/libmpathutil/libmpathutil.version
@@ -133,3 +133,7 @@ LIBMPATHUTIL_2.0 {
 LIBMPATHUTIL_2.1 {
 	libmp_basename;
 };
+
+LIBMPATHUTIL_2.2 {
+	cleanup_udev_device;
+};
diff --git a/libmpathutil/util.c b/libmpathutil/util.c
index 23d303f..67db3c8 100644
--- a/libmpathutil/util.c
+++ b/libmpathutil/util.c
@@ -373,3 +373,9 @@ void cleanup_ucharp(unsigned char **p)
 {
 	free(*p);
 }
+
+void cleanup_udev_device(struct udev_device **udd)
+{
+	if (*udd)
+		udev_device_unref(*udd);
+}
diff --git a/libmpathutil/util.h b/libmpathutil/util.h
index 4997fed..c19f749 100644
--- a/libmpathutil/util.h
+++ b/libmpathutil/util.h
@@ -10,6 +10,7 @@
 #include <inttypes.h>
 #include <stdbool.h>
 #include <stdio.h>
+#include <libudev.h>
 
 size_t strchop(char *);
 
@@ -139,4 +140,6 @@ static inline void clear_bit_in_bitfield(unsigned int bit, struct bitfield *bf)
 
 void cleanup_charp(char **p);
 void cleanup_ucharp(unsigned char **p);
+void cleanup_udev_device(struct udev_device **udd);
+
 #endif /* _UTIL_H */
diff --git a/libmultipath/print.c b/libmultipath/print.c
index d592001..b7af913 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -436,12 +436,6 @@ snprint_multipath_vpd_data(struct strbuf *buff,
 	return append_strbuf_str(buff, "[undef]");
 }
 
-static void cleanup_udev_device(struct udev_device **udd)
-{
-	if (*udd)
-		udev_device_unref(*udd);
-}
-
 static int
 snprint_multipath_max_sectors_kb(struct strbuf *buff, const struct multipath *mpp)
 {
diff --git a/tests/Makefile b/tests/Makefile
index 4005204..8afa8c6 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -53,7 +53,7 @@ vpd-test_OBJDEPS :=  $(multipathdir)/discovery.o
 vpd-test_LIBDEPS := -ludev -lpthread -ldl
 alias-test_TESTDEPS := test-log.o
 alias-test_OBJDEPS := $(mpathutildir)/util.o
-alias-test_LIBDEPS := -lpthread -ldl
+alias-test_LIBDEPS := -ludev -lpthread -ldl
 valid-test_OBJDEPS := $(multipathdir)/valid.o $(multipathdir)/discovery.o
 valid-test_LIBDEPS := -lmount -ludev -lpthread -ldl
 devt-test_LIBDEPS := -ludev
-- 
2.45.2





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux