Skip to contentSkip to conversation

libmultipath: fix build without LIBDM_API_DEFERRED

PATCH In review [email protected] 2 participants 2 messages May 20, 2021 – May 24, 2021 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libmultipath: fix build without LIBDM_API_DEFERRED

From: Martin Wilck <[email protected]>

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

---
 libmultipath/devmapper.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
libmultipath/devmapper.c +8 -3
index 095cbc0..47a6d60 100644
@@ -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;
 }
Signature · 7 lines
2.31.1


--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Thu, May 20, 2021 at 09:52:08PM +0200, [email protected] wrote:

From: Martin Wilck <[email protected]>

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

Quoted 49 lines
---
 libmultipath/devmapper.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
libmultipath/devmapper.c +8 -3
index 095cbc0..47a6d60 100644
@@ -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;
 }
Signature · 1 line
2.31.1

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel