device-mapper-multipath/0030-multipath-tools-add-compile-time-configuration-for-e.patch

59 lines
2.7 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 8 Sep 2023 22:26:22 +0200
Subject: [PATCH] multipath-tools: add compile time configuration for
"/etc/multipath"
Instead of hard-conding "/etc/multipath" as the path for the state
files "bindings", "prkeys", and "wwids", make this path configurable
via the "statedir" compile-time option. The default is currently still
/etc, it might change to /var/lib or similar in the future.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 4 +++-
libmultipath/defaults.h | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 39972d93..96206b2f 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -58,6 +58,7 @@ pkgconfdir := $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(etc_prefix)/etc/multipath/conf.d
configfile := $(etc_prefix)/etc/multipath.conf
+statedir := $(etc_prefix)/etc/multipath
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
devmapper_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir devmapper),/usr/include)
libudev_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir libudev),/usr/include)
@@ -88,7 +89,8 @@ WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implici
CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) \
-DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-DRUNTIME_DIR=\"$(runtimedir)\" -DCONFIG_DIR=\"$(configdir)\" \
- -DDEFAULT_CONFIGFILE=\"$(configfile)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
+ -DDEFAULT_CONFIGFILE=\"$(configfile)\" -DSTATE_DIR=\"$(statedir)\" \
+ -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index bc2d6388..d01f9712 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -66,9 +66,9 @@
#define MAX_DEV_LOSS_TMO UINT_MAX
#define DEFAULT_PIDFILE RUNTIME_DIR "/multipathd.pid"
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
-#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"
-#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids"
-#define DEFAULT_PRKEYS_FILE "/etc/multipath/prkeys"
+#define DEFAULT_BINDINGS_FILE STATE_DIR "/bindings"
+#define DEFAULT_WWIDS_FILE STATE_DIR "/wwids"
+#define DEFAULT_PRKEYS_FILE STATE_DIR "/prkeys"
#define MULTIPATH_SHM_BASE RUNTIME_DIR "/multipath/"