Skip to contentSkip to conversation

Last-minute mutipath-tools fixes

PATCH New [email protected] 1 participant 3 messages Nov 5, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

cover Last-minute mutipath-tools fixes

From: Martin Wilck <[email protected]>

Hi Christophe,

Ben has finished the review of my musl/alpine series.

Now there are these two patches that I'd ask you to include before tagging. The first one was posted before in the "[PATCH] multipath-tools: delete auto-generated tests/test-log.d file with make clean" thread. The other one is a build fix for Debian Jessie. It seems I failed to send it last time, sorry about that.

I hope we'll now be able to get this merged and tagged soon.

Regards
Martin

Martin Wilck (2):
libmultipath tests: delete test-log.d during "make clean"
libmultipath: dm_task_get_errno() is not always available

 libmultipath/Makefile    | 4 ++++
 libmultipath/devmapper.c | 2 ++
 libmultipath/devmapper.h | 5 +++++
 multipathd/Makefile      | 4 ++++
 tests/Makefile           | 3 ++-
 5 files changed, 17 insertions(+), 1 deletion(-)
Signature · 7 lines
2.29.0


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
#1 lore raw

PATCH 1/2 libmultipath tests: delete test-log.d during "make clean"

From: Martin Wilck <[email protected]>

test-log.d was not cleaned out. Fix it.

---
 tests/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/Makefile +2 -1
index 3bacabd..d26b3ce 100644
@@ -14,6 +14,7 @@ LIBDEPS += -L$(multipathdir) -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka
 
 TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \
 	 alias directio valid devt
+HELPERS := test-lib.o test-log.o
 
 .SILENT: $(TESTS:%=%.o)
 .PRECIOUS: $(TESTS:%=%-test)
@@ -74,7 +75,7 @@ lib/libchecktur.so:
 	@LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) \
 		valgrind --leak-check=full --error-exitcode=128 ./$< >$@ 2>&1
 
-OBJS = $(TESTS:%=%.o) test-lib.o
+OBJS = $(TESTS:%=%.o) $(HELPERS)
 
 test_clean:
 	$(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr)
Signature · 7 lines
2.29.0


--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
#2 lore raw

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

In reply to [email protected]

From: Martin Wilck <[email protected]>

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.

---
 libmultipath/Makefile    | 4 ++++
 libmultipath/devmapper.c | 2 ++
 libmultipath/devmapper.h | 5 +++++
 multipathd/Makefile      | 4 ++++
 4 files changed, 15 insertions(+)
libmultipath/Makefile +4 -0
index e5dac5e..62ba16e 100644
@@ -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
libmultipath/devmapper.c +2 -0
index b4d77cb..7f09361 100644
@@ -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)
libmultipath/devmapper.h +5 -0
index f568ab5..f469c98 100644
@@ -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)))	      \
multipathd/Makefile +4 -0
index 8d90117..632b82b 100644
@@ -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
 #
Signature · 7 lines
2.29.0


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