[dm-devel] [PATCH] libmultipath: fix build without LIBDM_API_DEFERRED

mwilck at suse.com mwilck at suse.com
Thu May 20 19:52:08 UTC 2021


From: Martin Wilck <mwilck at suse.com>

Build fails on distributions that don't support DM_DEFERRED_REMOVE
(libdevmapper < 1.02.89). Fix it.

Resolves: https://github.com/opensvc/multipath-tools/issues/7
Tested-by: Paul Menzel <pmenzel at molgen.mpg.de>
---
 libmultipath/devmapper.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 095cbc0..47a6d60 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -49,6 +49,9 @@ static int dm_conf_verbosity;
 
 #ifdef LIBDM_API_DEFERRED
 static int dm_cancel_remove_partmaps(const char * mapname);
+#define __DR_UNUSED__ /* empty */
+#else
+#define __DR_UNUSED__ __attribute__((unused))
 #endif
 
 static int do_foreach_partmaps(const char * mapname,
@@ -384,7 +387,8 @@ libmp_dm_task_create(int task)
 #define do_deferred(x) ((x) == DEFERRED_REMOVE_ON || (x) == DEFERRED_REMOVE_IN_PROGRESS)
 
 static int
-dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags, int deferred_remove) {
+dm_simplecmd (int task, const char *name, int no_flush, int need_sync,
+	      uint16_t udev_flags, int deferred_remove __DR_UNUSED__) {
 	int r = 0;
 	int udev_wait_flag = ((need_sync || udev_flags) &&
 			      (task == DM_DEVICE_RESUME ||
@@ -1122,7 +1126,8 @@ dm_flush_map_nopaths(const char * mapname, int deferred_remove)
 #else
 
 int
-dm_flush_map_nopaths(const char * mapname, int deferred_remove)
+dm_flush_map_nopaths(const char * mapname,
+		     int deferred_remove __attribute__((unused)))
 {
 	return _dm_flush_map(mapname, 1, 0, 0, 0);
 }
@@ -1573,7 +1578,7 @@ dm_cancel_deferred_remove (struct multipath *mpp)
 #else
 
 int
-dm_cancel_deferred_remove (struct multipath *mpp)
+dm_cancel_deferred_remove (struct multipath *mpp __attribute__((unused)))
 {
 	return 0;
 }
-- 
2.31.1





More information about the dm-devel mailing list