diff mbox series

[v2,30/37] multipath-tools: add compile time configuration for "/etc/multipath"

Message ID 20230911163846.27197-31-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: user-friendly names rework | expand

Commit Message

Martin Wilck Sept. 11, 2023, 4:38 p.m. UTC
From: Martin Wilck <mwilck@suse.com>

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>
---
 Makefile.inc            | 4 +++-
 libmultipath/defaults.h | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Benjamin Marzinski Sept. 13, 2023, 10:32 p.m. UTC | #1
On Mon, Sep 11, 2023 at 06:38:39PM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> 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.
> 
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  Makefile.inc            | 4 +++-
>  libmultipath/defaults.h | 6 +++---
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index 39972d9..96206b2 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 bc2d638..d01f971 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/"
>  
>  
> -- 
> 2.42.0
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/Makefile.inc b/Makefile.inc
index 39972d9..96206b2 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 bc2d638..d01f971 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/"