From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Thu, 20 May 2021 21:26:01 +0200 Subject: [PATCH] libmultipath: fix build without LIBDM_API_DEFERRED 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 Reviewed-by: Benjamin Marzinski Signed-off-by: Benjamin Marzinski --- libmultipath/devmapper.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 095cbc0c..47a6d60e 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; }