[PATCH 2/2] libmultipath: dm_task_get_errno() is not always available

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

 



From: Martin Wilck <mwilck@xxxxxxxx>

The function was added in LVM2 2.02.122. The DM version is
1.02.99. Fall back to errno if dm_task_get_errno() doesn't exist.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 libmultipath/Makefile    | 4 ++++
 libmultipath/devmapper.c | 2 ++
 libmultipath/devmapper.h | 5 +++++
 multipathd/Makefile      | 4 ++++
 4 files changed, 15 insertions(+)

diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index e5dac5e..62ba16e 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -24,6 +24,10 @@ ifneq ($(call check_func,dm_task_no_flush,/usr/include/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
 endif
 
+ifneq ($(call check_func,dm_task_get_errno,/usr/include/libdevmapper.h),0)
+	CFLAGS += -DLIBDM_API_GET_ERRNO
+endif
+
 ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
 	CFLAGS += -DLIBDM_API_COOKIE
 endif
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index b4d77cb..7f09361 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -119,6 +119,8 @@ dm_lib_prereq (void)
 	int v[3];
 #if defined(LIBDM_API_HOLD_CONTROL)
 	int minv[3] = {1, 2, 111};
+#elif defined(LIBDM_API_GET_ERRNO)
+	int minv[3] = {1, 2, 99};
 #elif defined(LIBDM_API_DEFERRED)
 	int minv[3] = {1, 2, 89};
 #elif defined(DM_SUBSYSTEM_UDEV_FLAG0)
diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
index f568ab5..f469c98 100644
--- a/libmultipath/devmapper.h
+++ b/libmultipath/devmapper.h
@@ -85,6 +85,11 @@ struct multipath *dm_get_multipath(const char *name);
 	((v[0] == minv[0]) && (v[1] == minv[1]) && (v[2] >= minv[2])) \
 )
 
+#ifndef LIBDM_API_GET_ERRNO
+#include <errno.h>
+#define dm_task_get_errno(x) errno
+#endif
+
 #define dm_log_error(lvl, cmd, dmt)			      \
 	condlog(lvl, "%s: libdm task=%d error: %s", __func__, \
 		cmd, strerror(dm_task_get_errno(dmt)))	      \
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 8d90117..632b82b 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,5 +1,9 @@
 include ../Makefile.inc
 
+ifneq ($(call check_func,dm_task_get_errno,/usr/include/libdevmapper.h),0)
+	CFLAGS += -DLIBDM_API_GET_ERRNO
+endif
+
 #
 # debugging stuff
 #
-- 
2.29.0


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel




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

  Powered by Linux