device-mapper-multipath-0.9.4-1

Update to the head of the upstream staging branch
  * Previous patches 0001-0032 are intlcude in the source tarball
  * Patches 0001-0010 are from the upstream staging branch
Rename redhat patches
  * Previous patches 0033-0044 are not patches 0011-0022
Add dependency on libmount
This commit is contained in:
Benjamin Marzinski 2023-01-26 19:02:53 -06:00
parent bf5e5e4891
commit 8e8d008d17
57 changed files with 1400 additions and 4219 deletions

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ multipath-tools-091027.tar.gz
/multipath-tools-0.8.9.tgz
/multipath-tools-0.9.0.tgz
/multipath-tools-0.9.3.tgz
/multipath-tools-0.9.4.tgz

View File

@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Koetsier <github.com@unicast.nl>
Date: Thu, 27 Oct 2022 19:29:28 +0200
Subject: [PATCH] libmultipath: fix 'show paths format' failure
Prevent 'multipathd show paths format "%c"' from failing on orphan paths.
For orphan paths the checker class isn't set, which caused
snprint_path_checker() to fail which in turn caused 'show paths format' to fail
when the format string contained "%c".
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/print.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index d7d522c8..3193dbe0 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -734,8 +734,12 @@ snprint_host_adapter (struct strbuf *buff, const struct path * pp)
static int
snprint_path_checker (struct strbuf *buff, const struct path * pp)
{
- const struct checker * c = &pp->checker;
- return snprint_str(buff, checker_name(c));
+ const char * n = checker_name(&pp->checker);
+
+ if (n)
+ return snprint_str(buff, n);
+ else
+ return snprint_str(buff, "(null)");
}
static int

View File

@ -0,0 +1,159 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Dec 2022 17:41:10 -0600
Subject: [PATCH] multipathd: make pr registration consistent
multipathd was inconsistent on what it did with persistent reservations
when a multipath device was created. If a multipath device with a
configured reservation key was created during configure(), multipathd
would try to read the registered keys using an active path. If it saw a
matching key, it would set the prflag, but not attempt to register the
key on any of the other paths. This means that if a new path had
appeared while multipathd was not running, it wouldn't register the key
on this path.
If the multipath device was created during ev_add_path(), multipathd
would used the added path to check if there was a matching key and if
there was, register the key only on the added path and then set the
prflag. This could be problematic if the device was created with
multiple paths, for instance because find_mutipaths was set to "yes" and
a second path just appeared. In this case, if the device happened to be
only registered on the second path, it would not get registered on the
first path.
If the multipath device was added to multipathd during a call to
ev_add_map(), multipathd wouldn't set the prflag or register the key on
any paths.
After a device was created with the prflag set, if a new path appeared
before the creation uevent, and multipathd was forced to delay adding
it, when it finally updated the multipath device, the key would be
registered on all paths, fixing any paths missed during creation.
However, if a new path appeared after the creation uevent, the key would
only be registered on that new path. Any paths that were missed on
creation would stay missed.
persistent key registration needs to be handled consistently. This
patch does so by making sure that however a multipath device is added to
multipathd, it will check to see if the configured key is registered. If
it is, multipathd will set the prflag and register the key on all the
currently active paths.
When a new path is added, multipathd will use it to check for active
keys, as before. But if it finds a matching key and prflag isn't
currently set, it will register the key on all paths.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/main.c | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 1e1b254f..f7212d7b 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -586,13 +586,26 @@ flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) {
return false;
}
+static void
+pr_register_active_paths(struct multipath *mpp)
+{
+ unsigned int i, j;
+ struct path *pp;
+ struct pathgroup *pgp;
+
+ vector_foreach_slot (mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ if ((pp->state == PATH_UP) || (pp->state == PATH_GHOST))
+ mpath_pr_event_handle(pp);
+ }
+ }
+}
+
static int
update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
{
int retries = 3;
char *params __attribute__((cleanup(cleanup_charp))) = NULL;
- struct path *pp;
- int i;
retry:
condlog(4, "%s: updating new map", mpp->alias);
@@ -609,15 +622,6 @@ retry:
mpp->action = ACT_RELOAD;
- if (mpp->prflag) {
- vector_foreach_slot(mpp->paths, pp, i) {
- if ((pp->state == PATH_UP) || (pp->state == PATH_GHOST)) {
- /* persistent reservation check*/
- mpath_pr_event_handle(pp);
- }
- }
- }
-
if (setup_map(mpp, &params, vecs)) {
condlog(0, "%s: failed to setup new map in update", mpp->alias);
retries = -1;
@@ -643,6 +647,11 @@ fail:
sync_map_state(mpp);
+ if (!mpp->prflag)
+ update_map_pr(mpp);
+ if (mpp->prflag)
+ pr_register_active_paths(mpp);
+
if (retries < 0)
condlog(0, "%s: failed reload in new map update", mpp->alias);
return 0;
@@ -1191,6 +1200,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int start_waiter = 0;
int ret;
int ro;
+ unsigned char prflag = 0;
/*
* need path UID to go any further
@@ -1234,6 +1244,8 @@ rescan:
verify_paths(mpp);
mpp->action = ACT_RELOAD;
+ prflag = mpp->prflag;
+ mpath_pr_event_handle(pp);
} else {
if (!should_multipath(pp, vecs->pathvec, vecs->mpvec)) {
orphan_path(pp, "only one path");
@@ -1252,9 +1264,6 @@ rescan:
goto fail; /* leave path added to pathvec */
}
- /* persistent reservation check*/
- mpath_pr_event_handle(pp);
-
/* ro check - if new path is ro, force map to be ro as well */
ro = sysfs_get_ro(pp);
if (ro == 1)
@@ -1319,6 +1328,10 @@ rescan:
sync_map_state(mpp);
if (retries >= 0) {
+ if (start_waiter)
+ update_map_pr(mpp);
+ if (mpp->prflag && !prflag)
+ pr_register_active_paths(mpp);
condlog(2, "%s [%s]: path added to devmap %s",
pp->dev, pp->dev_t, mpp->alias);
return 0;
@@ -2852,6 +2865,8 @@ configure (struct vectors * vecs, enum force_reload_types reload_type)
if (remember_wwid(mpp->wwid) == 1)
trigger_paths_udev_change(mpp, true);
update_map_pr(mpp);
+ if (mpp->prflag)
+ pr_register_active_paths(mpp);
}
/*

View File

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 18:22:59 +0200
Subject: [PATCH] fixup! Makefile.inc: fix man and include paths
Paths would now be wrong with the default (empty) prefix.
Fix it.
Fixes: 2b2885c ("Makefile.inc: fix man and include paths")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 4d843ce5..32001434 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -89,9 +89,9 @@ modulesloaddir = $(prefix)/$(SYSTEMDPATH)/modules-load.d
multipathdir = $(TOPDIR)/libmultipath
daemondir = $(TOPDIR)/multipathd
mpathutildir = $(TOPDIR)/libmpathutil
-man8dir = $(prefix)/share/man/man8
-man5dir = $(prefix)/share/man/man5
-man3dir = $(prefix)/share/man/man3
+man8dir = $(usr_prefix)/share/man/man8
+man5dir = $(usr_prefix)/share/man/man5
+man3dir = $(usr_prefix)/share/man/man3
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
@@ -102,7 +102,7 @@ mpathvaliddir = $(TOPDIR)/libmpathvalid
thirdpartydir = $(TOPDIR)/third-party
libdmmpdir = $(TOPDIR)/libdmmp
nvmedir = $(TOPDIR)/libmultipath/nvme
-includedir = $(prefix)/include
+includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d

View File

@ -0,0 +1,166 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Dec 2022 17:41:11 -0600
Subject: [PATCH] libmultipath: make prflag an enum
In preparation for a future patch, make prflag an enum, and change the
reply of cli_getprstatus() to a string.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmpathpersist/mpath_persist_int.c | 2 +-
libmultipath/structs.h | 8 +++++++-
multipathd/cli_handlers.c | 17 +++++++++--------
multipathd/main.c | 14 +++++++-------
4 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c
index 6924b379..a84d9474 100644
--- a/libmpathpersist/mpath_persist_int.c
+++ b/libmpathpersist/mpath_persist_int.c
@@ -783,7 +783,7 @@ int update_map_pr(struct multipath *mpp)
if (isFound)
{
- mpp->prflag = 1;
+ mpp->prflag = PRFLAG_SET;
condlog(2, "%s: prflag flag set.", mpp->alias );
}
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 9e2c1ab0..f2265300 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -375,6 +375,12 @@ struct path {
typedef int (pgpolicyfn) (struct multipath *, vector);
+
+enum prflag_value {
+ PRFLAG_UNSET,
+ PRFLAG_SET,
+};
+
struct multipath {
char wwid[WWID_SIZE];
char alias_old[WWID_SIZE];
@@ -449,7 +455,7 @@ struct multipath {
int prkey_source;
struct be64 reservation_key;
uint8_t sa_flags;
- unsigned char prflag;
+ int prflag;
int all_tg_pt;
struct gen_multipath generic_mp;
bool fpin_must_reload;
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index e65fb75c..7ee2729f 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -1277,6 +1277,10 @@ cli_shutdown (void * v, struct strbuf *reply, void * data)
static int
cli_getprstatus (void * v, struct strbuf *reply, void * data)
{
+ static const char * const prflag_str[] = {
+ [PRFLAG_UNSET] = "unset\n",
+ [PRFLAG_SET] = "set\n",
+ };
struct multipath * mpp;
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, KEY_MAP);
@@ -1287,10 +1291,7 @@ cli_getprstatus (void * v, struct strbuf *reply, void * data)
if (!mpp)
return 1;
- condlog(3, "%s: prflag = %u", param, (unsigned int)mpp->prflag);
-
- if (print_strbuf(reply, "%d", mpp->prflag) < 0)
- return 1;
+ append_strbuf_str(reply, prflag_str[mpp->prflag]);
condlog(3, "%s: reply = %s", param, get_strbuf_str(reply));
@@ -1310,8 +1311,8 @@ cli_setprstatus(void * v, struct strbuf *reply, void * data)
if (!mpp)
return 1;
- if (!mpp->prflag) {
- mpp->prflag = 1;
+ if (mpp->prflag != PRFLAG_SET) {
+ mpp->prflag = PRFLAG_SET;
condlog(2, "%s: prflag set", param);
}
@@ -1332,8 +1333,8 @@ cli_unsetprstatus(void * v, struct strbuf *reply, void * data)
if (!mpp)
return 1;
- if (mpp->prflag) {
- mpp->prflag = 0;
+ if (mpp->prflag != PRFLAG_UNSET) {
+ mpp->prflag = PRFLAG_UNSET;
condlog(2, "%s: prflag unset", param);
}
diff --git a/multipathd/main.c b/multipathd/main.c
index f7212d7b..722235c7 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -647,9 +647,9 @@ fail:
sync_map_state(mpp);
- if (!mpp->prflag)
+ if (mpp->prflag == PRFLAG_UNSET)
update_map_pr(mpp);
- if (mpp->prflag)
+ if (mpp->prflag == PRFLAG_SET)
pr_register_active_paths(mpp);
if (retries < 0)
@@ -1200,7 +1200,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int start_waiter = 0;
int ret;
int ro;
- unsigned char prflag = 0;
+ unsigned char prflag = PRFLAG_UNSET;
/*
* need path UID to go any further
@@ -1330,7 +1330,7 @@ rescan:
if (retries >= 0) {
if (start_waiter)
update_map_pr(mpp);
- if (mpp->prflag && !prflag)
+ if (mpp->prflag == PRFLAG_SET && prflag == PRFLAG_UNSET)
pr_register_active_paths(mpp);
condlog(2, "%s [%s]: path added to devmap %s",
pp->dev, pp->dev_t, mpp->alias);
@@ -2492,7 +2492,7 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
}
if (newstate == PATH_UP || newstate == PATH_GHOST) {
- if (pp->mpp->prflag) {
+ if (pp->mpp->prflag == PRFLAG_SET) {
/*
* Check Persistent Reservation.
*/
@@ -2865,7 +2865,7 @@ configure (struct vectors * vecs, enum force_reload_types reload_type)
if (remember_wwid(mpp->wwid) == 1)
trigger_paths_udev_change(mpp, true);
update_map_pr(mpp);
- if (mpp->prflag)
+ if (mpp->prflag == PRFLAG_SET)
pr_register_active_paths(mpp);
}
@@ -3840,7 +3840,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
{
condlog(0,"%s: Reservation registration failed. Error: %d", pp->dev, ret);
}
- mpp->prflag = 1;
+ mpp->prflag = PRFLAG_SET;
free(param);
out:

View File

@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:09:52 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: Fix paths for systemd
With prefix=/usr, systemd files were installed under /usr/usr/lib,
which is bogus. Clean this up, and document how to handle systemd's
"rootprefix" options. Remove the previous SYSTEMDPATH option.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 32001434..351358a9 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -53,10 +53,6 @@ ifndef SYSTEMD
endif
endif
-ifndef SYSTEMDPATH
- SYSTEMDPATH=usr/lib
-endif
-
ifndef DEVMAPPER_INCDIR
ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
@@ -78,14 +74,22 @@ ifndef LINUX_HEADERS_INCDIR
LINUX_HEADERS_INCDIR = /usr/include
endif
+# Paths. All these can be overridden on the "make" command line.
prefix =
+# Prefix for binaries
exec_prefix = $(prefix)
+# Prefix for non-essential libraries (libdmmp)
usr_prefix = $(prefix)
+# Where to install systemd-related files. systemd is usually installed under /usr
+# Note: some systemd installations use separate "prefix" and "rootprefix".
+# In this case, override only unitdir to use systemd's "rootprefix" instead of $(systemd_prefix)
+systemd_prefix := /usr
+unitdir := $(systemd_prefix)/lib/systemd/system
+tmpfilesdir := $(systemd_prefix)/lib/tmpfiles.d
+modulesloaddir := $(systemd_prefix)/lib/modules-load.d
+libudevdir := $(systemd_prefix)/lib/udev
+udevrulesdir := $(libudevdir)/rules.d
bindir = $(exec_prefix)/sbin
-libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
-tmpfilesdir = $(prefix)/$(SYSTEMDPATH)/tmpfiles.d
-udevrulesdir = $(libudevdir)/rules.d
-modulesloaddir = $(prefix)/$(SYSTEMDPATH)/modules-load.d
multipathdir = $(TOPDIR)/libmultipath
daemondir = $(TOPDIR)/multipathd
mpathutildir = $(TOPDIR)/libmpathutil
@@ -95,7 +99,6 @@ man3dir = $(usr_prefix)/share/man/man3
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
-unitdir = $(prefix)/$(SYSTEMDPATH)/systemd/system
mpathpersistdir = $(TOPDIR)/libmpathpersist
mpathcmddir = $(TOPDIR)/libmpathcmd
mpathvaliddir = $(TOPDIR)/libmpathvalid

View File

@ -0,0 +1,152 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Dec 2022 17:41:12 -0600
Subject: [PATCH] multipathd: handle no active paths in update_map_pr
When a multipath device is first created, if it has a reservation key
configured, update_map_pr() will check for a matching key on the active
paths. If there were no active paths to check with, multipathd was
leaving mpp->prflag in PRFLAG_UNSET, as if there were no matching keys.
It's possible that when update_map_pr() is called, all the paths will be
in the PATH_PENDING state because the checkers haven't completed yet. In
this case, multipathd was treating the device as having no registered
keys without ever checking.
To solve this, multipath devices now start with prflag = PRFLAG_UNKNOWN.
It will remain in this state until multipathd actually tries to get the
registered keys down a path. If the map is in this state, it will check
newly active paths, and if it finds a matching key, it will register
the key down all active paths.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmpathpersist/mpath_persist_int.c | 8 ++++++++
libmultipath/structs.h | 1 +
multipathd/cli_handlers.c | 1 +
multipathd/main.c | 19 ++++++++++++++-----
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c
index a84d9474..8b52b746 100644
--- a/libmpathpersist/mpath_persist_int.c
+++ b/libmpathpersist/mpath_persist_int.c
@@ -738,6 +738,7 @@ int update_map_pr(struct multipath *mpp)
if (!get_be64(mpp->reservation_key))
{
/* Nothing to do. Assuming pr mgmt feature is disabled*/
+ mpp->prflag = PRFLAG_UNSET;
condlog(4, "%s: reservation_key not set in multipath.conf",
mpp->alias);
return MPATH_PR_SUCCESS;
@@ -749,6 +750,13 @@ int update_map_pr(struct multipath *mpp)
condlog(0,"%s : failed to alloc resp in update_map_pr", mpp->alias);
return MPATH_PR_OTHER;
}
+ if (count_active_paths(mpp) == 0)
+ {
+ condlog(0,"%s: No available paths to check pr status",
+ mpp->alias);
+ return MPATH_PR_OTHER;
+ }
+ mpp->prflag = PRFLAG_UNSET;
ret = mpath_prin_activepath(mpp, MPATH_PRIN_RKEY_SA, resp, noisy);
if (ret != MPATH_PR_SUCCESS )
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index f2265300..e2294323 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -377,6 +377,7 @@ typedef int (pgpolicyfn) (struct multipath *, vector);
enum prflag_value {
+ PRFLAG_UNKNOWN,
PRFLAG_UNSET,
PRFLAG_SET,
};
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 7ee2729f..ec5db1b8 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -1278,6 +1278,7 @@ static int
cli_getprstatus (void * v, struct strbuf *reply, void * data)
{
static const char * const prflag_str[] = {
+ [PRFLAG_UNKNOWN] = "unknown\n",
[PRFLAG_UNSET] = "unset\n",
[PRFLAG_SET] = "set\n",
};
diff --git a/multipathd/main.c b/multipathd/main.c
index 722235c7..bdeffe76 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -647,7 +647,7 @@ fail:
sync_map_state(mpp);
- if (mpp->prflag == PRFLAG_UNSET)
+ if (mpp->prflag != PRFLAG_SET)
update_map_pr(mpp);
if (mpp->prflag == PRFLAG_SET)
pr_register_active_paths(mpp);
@@ -1330,7 +1330,7 @@ rescan:
if (retries >= 0) {
if (start_waiter)
update_map_pr(mpp);
- if (mpp->prflag == PRFLAG_SET && prflag == PRFLAG_UNSET)
+ if (mpp->prflag == PRFLAG_SET && prflag != PRFLAG_SET)
pr_register_active_paths(mpp);
condlog(2, "%s [%s]: path added to devmap %s",
pp->dev, pp->dev_t, mpp->alias);
@@ -2492,13 +2492,17 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
}
if (newstate == PATH_UP || newstate == PATH_GHOST) {
- if (pp->mpp->prflag == PRFLAG_SET) {
+ if (pp->mpp->prflag != PRFLAG_UNSET) {
+ int prflag = pp->mpp->prflag;
/*
* Check Persistent Reservation.
*/
condlog(2, "%s: checking persistent "
"reservation registration", pp->dev);
mpath_pr_event_handle(pp);
+ if (pp->mpp->prflag == PRFLAG_SET &&
+ prflag != PRFLAG_SET)
+ pr_register_active_paths(pp->mpp);
}
}
@@ -3788,6 +3792,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
goto out;
}
+ mpp->prflag = PRFLAG_UNSET;
ret = prin_do_scsi_ioctl(pp->dev, MPATH_PRIN_RKEY_SA, resp, 0);
if (ret != MPATH_PR_SUCCESS )
{
@@ -3858,12 +3863,12 @@ int mpath_pr_event_handle(struct path *pp)
struct multipath * mpp;
if (pp->bus != SYSFS_BUS_SCSI)
- return 0;
+ goto no_pr;
mpp = pp->mpp;
if (!get_be64(mpp->reservation_key))
- return -1;
+ goto no_pr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
@@ -3876,4 +3881,8 @@ int mpath_pr_event_handle(struct path *pp)
pthread_attr_destroy(&attr);
rc = pthread_join(thread, NULL);
return 0;
+
+no_pr:
+ pp->mpp->prflag = PRFLAG_UNSET;
+ return 0;
}

View File

@ -1,113 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 13:24:34 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: don't take values from
environment
Don't use environment variables to initialize LIB, RUN, SYSTEMD, SYSTEMDPATH,
DEVMAPPER_INCDIR, LIBUDEV_INCDIR, and LINUX_HEADERS_INCDIR. Taking
such variables from the environment is generally discouraged
(see https://www.gnu.org/software/make/manual/html_node/Environment.html).
Overriding variables from the commandline is still possible
(https://www.gnu.org/software/make/manual/html_node/Overriding.html).
So now, when building multipath-tools, rather then running
"RUN=/somedir make", users need to run "make RUN=/somedir".
This simplifies the Makefile without losing important functionality.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 60 ++++++++++++++++++++++------------------------------
1 file changed, 25 insertions(+), 35 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 351358a9..d897ac7a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -20,59 +20,49 @@ SCSI_DH_MODULES_PRELOAD :=
EXTRAVERSION := $(shell rev=$$(git rev-parse --short=7 HEAD 2>/dev/null); echo $${rev:+-g$$rev})
+# PKGCONFIG must be read from the environment to enable compilation
+# in Debian multiarch setups
PKGCONFIG ?= pkg-config
ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifndef LIB
- ifeq ($(shell test -d /lib64 && echo 1),1)
- LIB=lib64
- else
- LIB=lib
- endif
+ifeq ($(shell test -d /lib64 && echo 1),1)
+ LIB=lib64
+else
+ LIB=lib
endif
-ifndef RUN
- ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
- RUN=run
- else
- RUN=var/run
- endif
+ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
+ RUN=run
+else
+ RUN=var/run
endif
-ifndef SYSTEMD
- ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
- SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
- else
- ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
- SYSTEMD = $(shell systemctl --version 2> /dev/null | \
- sed -n 's/systemd \([0-9]*\).*/\1/p')
- endif
+ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
+ SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
+else
+ ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
+ SYSTEMD = $(shell systemctl --version 2> /dev/null | \
+ sed -n 's/systemd \([0-9]*\).*/\1/p')
endif
endif
-ifndef DEVMAPPER_INCDIR
- ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
- DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
- else
- DEVMAPPER_INCDIR = /usr/include
- endif
+ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
+ DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
+else
+ DEVMAPPER_INCDIR = /usr/include
endif
-ifndef LIBUDEV_INCDIR
- ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
- LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
- else
- LIBUDEV_INCDIR = /usr/include
- endif
+ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
+ LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
+else
+ LIBUDEV_INCDIR = /usr/include
endif
# Allow user to override default location.
-ifndef LINUX_HEADERS_INCDIR
- LINUX_HEADERS_INCDIR = /usr/include
-endif
+LINUX_HEADERS_INCDIR = /usr/include
# Paths. All these can be overridden on the "make" command line.
prefix =

View File

@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Dec 2022 17:41:13 -0600
Subject: [PATCH] multipathd: add missing newline to cli_del_map reply
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/cli_handlers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index ec5db1b8..44bf43df 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -760,7 +760,7 @@ cli_del_map (void * v, struct strbuf *reply, void * data)
}
rc = ev_remove_map(param, alias, minor, vecs);
if (rc == 2)
- append_strbuf_str(reply, "delayed");
+ append_strbuf_str(reply, "delayed\n");
free(alias);
return rc;

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Dec 2022 17:41:14 -0600
Subject: [PATCH] libmultipath: skip extra vector work in remove_maps
Instead of repeatedly removing the first vector element, and shifting
the rest to fill in, call remove_map() without a vector, so it just
frees the devices. The vector will be completely cleaned up by
vector_free() immediately afterwards.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs_vec.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 5a618767..f3fdc5a6 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -392,10 +392,8 @@ remove_maps(struct vectors * vecs)
if (!vecs)
return;
- vector_foreach_slot (vecs->mpvec, mpp, i) {
- remove_map(mpp, vecs->pathvec, vecs->mpvec);
- i--;
- }
+ vector_foreach_slot (vecs->mpvec, mpp, i)
+ remove_map(mpp, vecs->pathvec, NULL);
vector_free(vecs->mpvec);
vecs->mpvec = NULL;

View File

@ -1,63 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 15:25:31 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: get rid of RUN
Just use $(runtimedir). Also, make the code more compact by using
the "if" function instead of a conditional.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 10 ++--------
libmultipath/defaults.h | 2 +-
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index d897ac7a..b4ec647c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -34,12 +34,6 @@ else
LIB=lib
endif
-ifeq ($(shell test -L /var/run -o ! -d /var/run && echo 1),1)
- RUN=run
-else
- RUN=var/run
-endif
-
ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
else
@@ -99,7 +93,7 @@ includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
-runtimedir := /$(RUN)
+runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
GZIP_PROG = gzip -9 -c
RM = rm -f
@@ -143,7 +137,7 @@ WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implici
-Werror=implicit-function-declaration -Werror=format-security \
$(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
CPPFLAGS := $(FORTIFY_OPT) \
- -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" -DRUN_DIR=\"${RUN}\" \
+ -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 3d552b33..a5e9ea0c 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -62,7 +62,7 @@
#define DEV_LOSS_TMO_UNSET 0U
#define MAX_DEV_LOSS_TMO UINT_MAX
-#define DEFAULT_PIDFILE "/" RUN_DIR "/multipathd.pid"
+#define DEFAULT_PIDFILE RUNTIME_DIR "/multipathd.pid"
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
#define DEFAULT_CONFIGFILE "/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"

View File

@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 20 Dec 2022 17:41:15 -0600
Subject: [PATCH] libmultipath: orphan paths if coalesce_paths frees newmp
If coalesce_paths() is called without a mpvec, it will free all the
multipath devices on newmp at the end. This will clear pp->mpp from the
path, but it doesn't completely unitialize them. cli_add_map() can call
coalsce_paths() this way, when adding a device that doesn't currently
exist. cli_add_map() first creates the device in the kernel, and then
calls ev_add_map() to add it to multipathd. If something goes wrong in
ev_add_map(), the paths will still be initialized, even though they're
orphans.
Fix this by calling remove_map() to orphan the paths that belong to
the multipath devices being deleted by coalesce_paths().
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/configure.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index e551047a..e689f8a7 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1273,8 +1273,11 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
ret = CP_OK;
out:
free(size_mismatch_seen);
- if (!mpvec)
- free_multipathvec(newmp, KEEP_PATHS);
+ if (!mpvec) {
+ vector_foreach_slot (newmp, mpp, i)
+ remove_map(mpp, vecs->pathvec, NULL);
+ vector_free(newmp);
+ }
return ret;
}

View File

@ -1,38 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:14:22 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: more compact code for LIB
Use make's "if" function instead of a conditional.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index b4ec647c..c39cec9b 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -28,12 +28,6 @@ ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifeq ($(shell test -d /lib64 && echo 1),1)
- LIB=lib64
-else
- LIB=lib
-endif
-
ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
else
@@ -80,6 +74,7 @@ mpathutildir = $(TOPDIR)/libmpathutil
man8dir = $(usr_prefix)/share/man/man8
man5dir = $(usr_prefix)/share/man/man5
man3dir = $(usr_prefix)/share/man/man3
+LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath

View File

@ -0,0 +1,609 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 9 Nov 2022 21:20:58 +0100
Subject: [PATCH] libmultipath: is_path_valid(): check if device is in use
To check whether we will be able to add a given device can be part
of a multipath map, we have two tests in check_path_valid():
released_to_systemd() and the O_EXCL test. The former isn't helpful
if "multipath -u" is called for the first time for a given device,
and the latter is only used in the "find_multipaths smart" case, because
actively opening the device with O_EXCL, even for a very short time, is prone
to races with other processes.
It turns out that this may cause issues in some scenarios. We saw problems in
once case where "find_multipaths greedy" was used with a single
non-multipahted root disk and a very large number of multipath LUNs.
The root disk would first be classified as multipath device. multipathd
would try to create a map, fail (because the disk was mounted) and
trigger another uevent. But because of the very large number of multipath
devices, this event was queued up behind thousands of other events, and
the root device timed out eventually.
While a simple workaround for the given problem would be proper blacklisting
or using a different find_multipaths mode, I am proposing a different
solution here. An additional test is added in is_path_valid() which
checks whether the given device is currently in use by 1. sysfs holders,
2. mounts (from /proc/self/mountinfo) or 3. swaps (from /proc/swaps). 2.
and 3. are similar to systemd's device detection after switching root.
This must not only be done for the device itself, but also for all its
partitions. For mountinfo and swaps, libmount is utilized.
With this patch, "multipath -u" will make devices with mounted or otherwise
used partitions available to systemd early, without waiting for multipathd
to fail setting up the map and re-triggering an uevent. This should avoid
the issue described above even without blacklisting. The downside of it
is a longer runtime of "multipath -u" for almost all devices, in particular
for real multipath devices. The runtime required for the new checks was in the
order of 0.1ms-1ms in my tests. Moreover, there is a certain risk that devices may
wrongly classified as non-multipath because of transient mounts or holders
created by other processes.
To make this code compile on older distributions, we need some additional
checks in create-config.mk.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/build-and-unittest.yaml | 2 +-
create-config.mk | 11 +-
libmpathutil/libmpathutil.version | 6 +
libmpathutil/util.c | 12 +
libmpathutil/util.h | 2 +
libmultipath/Makefile | 2 +-
libmultipath/alias.c | 11 -
libmultipath/valid.c | 270 ++++++++++++++++++++++
tests/Makefile | 2 +-
tests/valid.c | 48 ++++
10 files changed, 351 insertions(+), 15 deletions(-)
diff --git a/.github/workflows/build-and-unittest.yaml b/.github/workflows/build-and-unittest.yaml
index abf17bf0..9e6c0e89 100644
--- a/.github/workflows/build-and-unittest.yaml
+++ b/.github/workflows/build-and-unittest.yaml
@@ -31,7 +31,7 @@ jobs:
sudo apt-get install --yes gcc
make perl-base pkg-config valgrind
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
- libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
+ libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev libmount-dev
- name: build
run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
diff --git a/create-config.mk b/create-config.mk
index 2a95ec56..f128375f 100644
--- a/create-config.mk
+++ b/create-config.mk
@@ -23,7 +23,7 @@ check_cmd = $(shell \
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \
- if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
+ if grep -Eq "^(extern[[:blank:]]+)?[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
found=1; \
status="yes"; \
else \
@@ -104,6 +104,15 @@ ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h
FPIN_SUPPORT = 1
endif
+libmount_h := $(shell $(PKGCONFIG) --variable=includedir mount)/libmount/libmount.h
+ifneq ($(call check_func,mnt_unref_cache,$(libmount_h)),0)
+ DEFINES += LIBMOUNT_HAS_MNT_UNREF_CACHE
+endif
+
+ifneq ($(call check_func,mnt_table_parse_swaps,$(libmount_h)),0)
+ DEFINES += LIBMOUNT_SUPPORTS_SWAP
+endif
+
ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
ANA_SUPPORT := 1
endif
diff --git a/libmpathutil/libmpathutil.version b/libmpathutil/libmpathutil.version
index 1238fc93..dd007be4 100644
--- a/libmpathutil/libmpathutil.version
+++ b/libmpathutil/libmpathutil.version
@@ -133,3 +133,9 @@ LIBMPATHUTIL_1.1 {
global:
cleanup_fd_ptr;
} LIBMPATHUTIL_1.0;
+
+LIBMPATHUTIL_1.2 {
+global:
+ cleanup_vector_free;
+ cleanup_fclose;
+} LIBMPATHUTIL_1.0;
diff --git a/libmpathutil/util.c b/libmpathutil/util.c
index 9662e1ed..92f25a50 100644
--- a/libmpathutil/util.c
+++ b/libmpathutil/util.c
@@ -386,6 +386,18 @@ void cleanup_mutex(void *arg)
pthread_mutex_unlock(arg);
}
+void cleanup_vector_free(void *arg)
+{
+ if (arg)
+ vector_free((vector)arg);
+}
+
+void cleanup_fclose(void *p)
+{
+ if (p)
+ fclose(p);
+}
+
struct bitfield *alloc_bitfield(unsigned int maxbit)
{
unsigned int n;
diff --git a/libmpathutil/util.h b/libmpathutil/util.h
index 75e20fd8..99a471d0 100644
--- a/libmpathutil/util.h
+++ b/libmpathutil/util.h
@@ -48,6 +48,8 @@ int should_exit(void);
void cleanup_fd_ptr(void *arg);
void cleanup_free_ptr(void *arg);
void cleanup_mutex(void *arg);
+void cleanup_vector_free(void *arg);
+void cleanup_fclose(void *p);
struct scandir_result {
struct dirent **di;
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 3df851e2..61aa611f 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -7,7 +7,7 @@ DEVLIB := libmultipath.so
CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS)
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
- -lurcu -laio $(SYSTEMD_LIBDEPS)
+ -lmount -lurcu -laio $(SYSTEMD_LIBDEPS)
# object files referencing MULTIPATH_DIR or CONFIG_DIR
# they need to be recompiled for unit tests
diff --git a/libmultipath/alias.c b/libmultipath/alias.c
index 05201224..c0139a2e 100644
--- a/libmultipath/alias.c
+++ b/libmultipath/alias.c
@@ -667,11 +667,6 @@ static int _check_bindings_file(const struct config *conf, FILE *file,
return rc;
}
-static void cleanup_fclose(void *p)
-{
- fclose(p);
-}
-
static int alias_compar(const void *p1, const void *p2)
{
const char *alias1 = (*(struct mpentry * const *)p1)->alias;
@@ -684,12 +679,6 @@ static int alias_compar(const void *p1, const void *p2)
return alias1 ? -1 : alias2 ? 1 : 0;
}
-static void cleanup_vector_free(void *arg)
-{
- if (arg)
- vector_free((vector)arg);
-}
-
/*
* check_alias_settings(): test for inconsistent alias configuration
*
diff --git a/libmultipath/valid.c b/libmultipath/valid.c
index a6aa9215..d4dae3ed 100644
--- a/libmultipath/valid.c
+++ b/libmultipath/valid.c
@@ -17,6 +17,8 @@
#include <stddef.h>
#include <errno.h>
#include <libudev.h>
+#include <dirent.h>
+#include <libmount/libmount.h>
#include "vector.h"
#include "config.h"
@@ -30,12 +32,271 @@
#include "mpath_cmd.h"
#include "valid.h"
+static int subdir_filter(const struct dirent *ent)
+{
+ unsigned int j;
+ static char const *const skip[] = {
+ ".",
+ "..",
+ "holders",
+ "integrity",
+ "mq",
+ "power",
+ "queue",
+ "slaves",
+ "trace",
+ };
+
+ if (ent->d_type != DT_DIR)
+ return 0;
+
+ for (j = 0; j < ARRAY_SIZE(skip); j++)
+ if (!strcmp(skip[j], ent->d_name))
+ return 0;
+ return 1;
+}
+
+static int read_partitions(const char *syspath, vector parts)
+{
+ struct scandir_result sr = { .n = 0 };
+ char path[PATH_MAX], *last;
+ char *prop;
+ int i;
+
+ strlcpy(path, syspath, sizeof(path));
+ sr.n = scandir(path, &sr.di, subdir_filter, NULL);
+ if (sr.n == -1)
+ return -errno;
+
+ pthread_cleanup_push_cast(free_scandir_result, &sr);
+
+ /* parts[0] is the whole disk */
+ if ((prop = strdup(strrchr(path, '/') + 1)) != NULL) {
+ if (vector_alloc_slot(parts))
+ vector_set_slot(parts, prop);
+ else
+ free(prop);
+ }
+
+ last = path + strlen(path);
+ for (i = 0; i < sr.n; i++) {
+ struct stat st;
+
+ /* only add dirs that have the "partition" attribute */
+ snprintf(last, sizeof(path) - (last - path), "/%s/partition",
+ sr.di[i]->d_name);
+
+ if (stat(path, &st) == 0 &&
+ (prop = strdup(sr.di[i]->d_name)) != NULL) {
+ if (vector_alloc_slot(parts))
+ vector_set_slot(parts, prop);
+ else
+ free(prop);
+ }
+ }
+
+ pthread_cleanup_pop(1);
+ return 0;
+}
+
+static int no_dots(const struct dirent *ent)
+{
+ const char *name = ent->d_name;
+
+ if (name[0] == '.' &&
+ (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))
+ return 0;
+ return 1;
+}
+
+static int check_holders(const char *syspath)
+{
+ struct scandir_result __attribute__((cleanup(free_scandir_result)))
+ sr = { .n = 0 };
+
+ sr.n = scandir(syspath, &sr.di, no_dots, NULL);
+ if (sr.n > 0)
+ condlog(4, "%s: found holders under %s", __func__, syspath);
+ return sr.n;
+}
+
+static int check_all_holders(const struct _vector *parts)
+{
+ char syspath[PATH_MAX];
+ const char *sysname;
+ unsigned int j;
+
+ if (VECTOR_SIZE(parts) == 0)
+ return 0;
+
+ if (safe_sprintf(syspath, "/sys/class/block/%s/holders",
+ (const char *)VECTOR_SLOT(parts, 0)))
+ return -EOVERFLOW;
+
+ if (check_holders(syspath) > 0)
+ return 1;
+
+ j = 1;
+ vector_foreach_slot_after(parts, sysname, j) {
+ if (safe_sprintf(syspath, "/sys/class/block/%s/%s/holders",
+ (const char *)VECTOR_SLOT(parts, 0), sysname))
+ return -EOVERFLOW;
+ if (check_holders(syspath) > 0)
+ return 1;
+ }
+ return 0;
+}
+
+static void cleanup_table(void *arg)
+{
+ if (arg)
+ mnt_free_table((struct libmnt_table *)arg);
+}
+
+static void cleanup_cache(void *arg)
+{
+ if (arg)
+#ifdef LIBMOUNT_HAS_MNT_UNREF_CACHE
+ mnt_unref_cache((struct libmnt_cache *)arg);
+#else
+ mnt_free_cache((struct libmnt_cache *)arg);
+#endif
+}
+
+/*
+ * Passed a vector of partitions and a libmount table,
+ * check if any of the partitions in the vector is referenced in the table.
+ * Note that mnt_table_find_srcpath() also resolves mounts by symlinks.
+ */
+static int check_mnt_table(const struct _vector *parts,
+ struct libmnt_table *tbl,
+ const char *table_name)
+{
+ unsigned int i;
+ const char *sysname;
+ char devpath[PATH_MAX];
+
+ vector_foreach_slot(parts, sysname, i) {
+ if (!safe_sprintf(devpath, "/dev/%s", sysname) &&
+ mnt_table_find_srcpath(tbl, devpath,
+ MNT_ITER_FORWARD) != NULL) {
+ condlog(4, "%s: found %s in %s", __func__,
+ sysname, table_name);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int check_mountinfo(const struct _vector *parts)
+{
+ static const char mountinfo[] = "/proc/self/mountinfo";
+ struct libmnt_table *tbl;
+ struct libmnt_cache *cache;
+ FILE *stream;
+ int used = 0, ret;
+
+ tbl = mnt_new_table();
+ if (!tbl )
+ return -errno;
+
+ pthread_cleanup_push(cleanup_table, tbl);
+ cache = mnt_new_cache();
+ if (cache) {
+ pthread_cleanup_push(cleanup_cache, cache);
+ if (mnt_table_set_cache(tbl, cache) == 0) {
+ stream = fopen(mountinfo, "r");
+ if (stream != NULL) {
+ pthread_cleanup_push(cleanup_fclose, stream);
+ ret = mnt_table_parse_stream(tbl, stream, mountinfo);
+ pthread_cleanup_pop(1);
+
+ if (ret == 0)
+ used = check_mnt_table(parts, tbl,
+ "mountinfo");
+ }
+ }
+ pthread_cleanup_pop(1);
+ }
+ pthread_cleanup_pop(1);
+ return used;
+}
+
+#ifdef LIBMOUNT_SUPPORTS_SWAP
+static int check_swaps(const struct _vector *parts)
+{
+ struct libmnt_table *tbl;
+ struct libmnt_cache *cache;
+ int used = 0, ret;
+
+ tbl = mnt_new_table();
+ if (!tbl )
+ return -errno;
+
+ pthread_cleanup_push(cleanup_table, tbl);
+ cache = mnt_new_cache();
+ if (cache) {
+ pthread_cleanup_push(cleanup_cache, cache);
+ if (mnt_table_set_cache(tbl, cache) == 0) {
+ ret = mnt_table_parse_swaps(tbl, NULL);
+ if (ret == 0)
+ used = check_mnt_table(parts, tbl, "swaps");
+ }
+ pthread_cleanup_pop(1);
+ }
+ pthread_cleanup_pop(1);
+ return used;
+}
+#else
+static int check_swaps(const struct _vector *parts __attribute__((unused)))
+{
+ return 0;
+}
+#endif
+
+
+/*
+ * Given a block device, check if the device itself or any of its
+ * partitions is in use
+ * - by sysfs holders (e.g. LVM)
+ * - mounted according to /proc/self/mountinfo
+ * - used as swap
+ */
+static int is_device_in_use(struct udev_device *udevice)
+{
+ const char *syspath;
+ vector parts;
+ int used = 0, ret;
+
+ syspath = udev_device_get_syspath(udevice);
+ if (!syspath)
+ return -ENOMEM;
+
+ parts = vector_alloc();
+ if (!parts)
+ return -ENOMEM;
+
+ pthread_cleanup_push_cast(free_strvec, parts);
+ if ((ret = read_partitions(syspath, parts)) == 0)
+ used = check_all_holders(parts) > 0 ||
+ check_mountinfo(parts) > 0 ||
+ check_swaps(parts) > 0;
+ pthread_cleanup_pop(1);
+
+ if (ret < 0)
+ return ret;
+
+ condlog(3, "%s: %s is %sin use", __func__, syspath, used ? "" : "not ");
+ return used;
+}
+
int
is_path_valid(const char *name, struct config *conf, struct path *pp,
bool check_multipathd)
{
int r;
int fd;
+ const char *prop;
if (!pp || !name || !conf)
return PATH_IS_ERROR;
@@ -80,6 +341,10 @@ is_path_valid(const char *name, struct config *conf, struct path *pp,
if (!pp->udev)
return PATH_IS_ERROR;
+ prop = udev_device_get_property_value(pp->udev, "DEVTYPE");
+ if (prop == NULL || strcmp(prop, "disk"))
+ return PATH_IS_NOT_VALID;
+
r = pathinfo(pp, conf, DI_SYSFS | DI_WWID | DI_BLACKLIST);
if (r == PATHINFO_SKIPPED)
return PATH_IS_NOT_VALID;
@@ -96,6 +361,11 @@ is_path_valid(const char *name, struct config *conf, struct path *pp,
return PATH_IS_ERROR;
}
+ if ((conf->find_multipaths == FIND_MULTIPATHS_GREEDY ||
+ conf->find_multipaths == FIND_MULTIPATHS_SMART) &&
+ is_device_in_use(pp->udev) > 0)
+ return PATH_IS_NOT_VALID;
+
if (conf->find_multipaths == FIND_MULTIPATHS_GREEDY)
return PATH_IS_VALID;
diff --git a/tests/Makefile b/tests/Makefile
index 860338b2..1648ab9d 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -55,7 +55,7 @@ vpd-test_LIBDEPS := -ludev -lpthread -ldl
alias-test_TESTDEPS := test-log.o
alias-test_LIBDEPS := -lpthread -ldl
valid-test_OBJDEPS := $(multipathdir)/valid.o $(multipathdir)/discovery.o
-valid-test_LIBDEPS := -ludev -lpthread -ldl
+valid-test_LIBDEPS := -lmount -ludev -lpthread -ldl
devt-test_LIBDEPS := -ludev
mpathvalid-test_LIBDEPS := -ludev -lpthread -ldl
mpathvalid-test_OBJDEPS := $(mpathvaliddir)/mpath_valid.o
diff --git a/tests/valid.c b/tests/valid.c
index 398b771e..70329324 100644
--- a/tests/valid.c
+++ b/tests/valid.c
@@ -83,6 +83,13 @@ struct udev_device *__wrap_udev_device_new_from_subsystem_sysname(struct udev *u
return NULL;
}
+/* For devtype check */
+const char *__wrap_udev_device_get_property_value(struct udev_device *udev_device, const char *property)
+{
+ check_expected(property);
+ return mock_ptr_type(char *);
+}
+
/* For the "hidden" check in pathinfo() */
const char *__wrap_udev_device_get_sysattr_value(struct udev_device *udev_device,
const char *sysattr)
@@ -97,6 +104,12 @@ int __wrap_add_foreign(struct udev_device *udev_device)
return mock_type(int);
}
+/* For is_device_used() */
+const char *__wrap_udev_device_get_sysname(struct udev_device *udev_device)
+{
+ return mock_ptr_type(char *);
+}
+
/* called from pathinfo() */
int __wrap_filter_devnode(struct config *conf, const struct _vector *elist,
const char *vendor, const char * product, const char *dev)
@@ -165,6 +178,11 @@ int __wrap_is_failed_wwid(const char *wwid)
return ret;
}
+const char *__wrap_udev_device_get_syspath(struct udev_device *udevice)
+{
+ return mock_ptr_type(char *);
+}
+
int __wrap_check_wwids_file(char *wwid, int write_wwid)
{
bool passed = mock_type(bool);
@@ -225,6 +243,8 @@ static void setup_passing(char *name, char *wwid, unsigned int check_multipathd,
will_return(__wrap_udev_device_new_from_subsystem_sysname, true);
will_return(__wrap_udev_device_new_from_subsystem_sysname,
name);
+ expect_string(__wrap_udev_device_get_property_value, property, "DEVTYPE");
+ will_return(__wrap_udev_device_get_property_value, "disk");
if (stage == STAGE_GET_UDEV_DEVICE)
return;
if (stage == STAGE_PATHINFO_REAL) {
@@ -250,6 +270,10 @@ static void setup_passing(char *name, char *wwid, unsigned int check_multipathd,
return;
will_return(__wrap_is_failed_wwid, WWID_IS_NOT_FAILED);
will_return(__wrap_is_failed_wwid, wwid);
+ /* avoid real is_device_in_use() check */
+ if (conf.find_multipaths == FIND_MULTIPATHS_GREEDY ||
+ conf.find_multipaths == FIND_MULTIPATHS_SMART)
+ will_return(__wrap_udev_device_get_syspath, NULL);
if (stage == STAGE_IS_FAILED)
return;
will_return(__wrap_check_wwids_file, false);
@@ -347,6 +371,30 @@ static void test_check_multipathd(void **state)
assert_int_equal(is_path_valid(name, &conf, &pp, true),
PATH_IS_ERROR);
assert_string_equal(pp.dev, name);
+
+ /* test pass because connect succeeded. succeed getting udev. Wrong DEVTYPE */
+ memset(&pp, 0, sizeof(pp));
+ setup_passing(name, NULL, CHECK_MPATHD_RUNNING, STAGE_CHECK_MULTIPATHD);
+ will_return(__wrap_udev_device_new_from_subsystem_sysname, true);
+ will_return(__wrap_udev_device_new_from_subsystem_sysname,
+ name);
+ expect_string(__wrap_udev_device_get_property_value, property, "DEVTYPE");
+ will_return(__wrap_udev_device_get_property_value, "partition");
+ assert_int_equal(is_path_valid(name, &conf, &pp, true),
+ PATH_IS_NOT_VALID);
+ assert_string_equal(pp.dev, name);
+
+ /* test pass because connect succeeded. succeed getting udev. Bad DEVTYPE */
+ memset(&pp, 0, sizeof(pp));
+ setup_passing(name, NULL, CHECK_MPATHD_RUNNING, STAGE_CHECK_MULTIPATHD);
+ will_return(__wrap_udev_device_new_from_subsystem_sysname, true);
+ will_return(__wrap_udev_device_new_from_subsystem_sysname,
+ name);
+ expect_string(__wrap_udev_device_get_property_value, property, "DEVTYPE");
+ will_return(__wrap_udev_device_get_property_value, NULL);
+ assert_int_equal(is_path_valid(name, &conf, &pp, true),
+ PATH_IS_NOT_VALID);
+ assert_string_equal(pp.dev, name);
}
static void test_pathinfo(void **state)

View File

@ -1,139 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:17:40 +0200
Subject: [PATCH] multipath-tools: Makefiles: simplify code for include dirs
Use make's if function, and use lower-case latters for make variable
names that represent directories, such as elsewhere.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 16 +++-------------
kpartx/Makefile | 2 +-
libmultipath/Makefile | 14 +++++++-------
libmultipath/prioritizers/Makefile | 2 +-
multipathd/Makefile | 4 ++--
5 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index c39cec9b..38bd1d80 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -37,20 +37,7 @@ else
endif
endif
-ifeq ($(shell $(PKGCONFIG) --modversion devmapper >/dev/null 2>&1 && echo 1), 1)
- DEVMAPPER_INCDIR = $(shell $(PKGCONFIG) --variable=includedir devmapper)
-else
- DEVMAPPER_INCDIR = /usr/include
-endif
-
-ifeq ($(shell $(PKGCONFIG) --modversion libudev >/dev/null 2>&1 && echo 1), 1)
- LIBUDEV_INCDIR = $(shell $(PKGCONFIG) --variable=includedir libudev)
-else
- LIBUDEV_INCDIR = /usr/include
-endif
-
# Allow user to override default location.
-LINUX_HEADERS_INCDIR = /usr/include
# Paths. All these can be overridden on the "make" command line.
prefix =
@@ -89,6 +76,9 @@ pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
+devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/usr/include)
+libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
+kernel_incdir := /usr/include
GZIP_PROG = gzip -9 -c
RM = rm -f
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 742d3bcd..bdf2d035 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -9,7 +9,7 @@ LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -ldevmapper
-ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_COOKIE
endif
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 3b60a525..f0df27c0 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -22,31 +22,31 @@ ifdef SYSTEMD
endif
endif
-ifneq ($(call check_func,dm_task_no_flush,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_FLUSH
endif
-ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_GET_ERRNO
endif
-ifneq ($(call check_func,dm_task_set_cookie,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_COOKIE
endif
-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(LIBUDEV_INCDIR)/libudev.h),0)
+ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
CPPFLAGS += -DLIBUDEV_API_RECVBUF
endif
-ifneq ($(call check_func,dm_task_deferred_remove,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_DEFERRED
endif
-ifneq ($(call check_func,dm_hold_control_dev,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_HOLD_CONTROL
endif
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0)
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
CPPFLAGS += -DFPIN_EVENT_HANDLER
endif
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index 400f7735..97155f51 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -26,7 +26,7 @@ LIBS = \
libpriopath_latency.so \
libpriosysfs.so
-ifneq ($(call check_file,$(LINUX_HEADERS_INCDIR)/linux/nvme_ioctl.h),0)
+ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
LIBS += libprioana.so
CPPFLAGS += -I../nvme
endif
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 3ce9465e..c462d7b1 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,10 +1,10 @@
include ../Makefile.inc
-ifneq ($(call check_func,dm_task_get_errno,$(DEVMAPPER_INCDIR)/libdevmapper.h),0)
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_GET_ERRNO
endif
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(LINUX_HEADERS_INCDIR)/scsi/fc/fc_els.h),0)
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
CPPFLAGS += -DFPIN_EVENT_HANDLER
FPIN_SUPPORT = 1
endif

View File

@ -0,0 +1,55 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 2 Jan 2023 12:39:36 +0100
Subject: [PATCH] libmpathpersist: use conf->timeout for updating persistent
reservations
On systems with many LUNs, multipathd may fail to respond within the
default timeout to a "setprkey" command because the vecs lock is held
by the path checker. Honor the globally configured uxsock timeout in
libmpathpersist.
Reported-by: boposki (github.com/opensvc/multipath-tools/pull/58)
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_updatepr.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libmpathpersist/mpath_updatepr.c b/libmpathpersist/mpath_updatepr.c
index 4529a82b..36bd777e 100644
--- a/libmpathpersist/mpath_updatepr.c
+++ b/libmpathpersist/mpath_updatepr.c
@@ -14,6 +14,9 @@
#include <mpath_persist.h>
#include "debug.h"
#include "mpath_cmd.h"
+#include "vector.h"
+#include "globals.h"
+#include "config.h"
#include "uxsock.h"
#include "mpathpr.h"
@@ -24,6 +27,12 @@ static int do_update_pr(char *alias, char *cmd, char *key)
char str[256];
char *reply;
int ret = 0;
+ int timeout;
+ struct config *conf;
+
+ conf = get_multipath_config();
+ timeout = conf->uxsock_timeout;
+ put_multipath_config(conf);
fd = mpath_connect();
if (fd == -1) {
@@ -41,7 +50,7 @@ static int do_update_pr(char *alias, char *cmd, char *key)
mpath_disconnect(fd);
return -1;
}
- ret = recv_packet(fd, &reply, DEFAULT_REPLY_TIMEOUT);
+ ret = recv_packet(fd, &reply, timeout);
if (ret < 0) {
condlog(2, "%s: message=%s recv error=%d", alias, str, errno);
ret = -1;

View File

@ -1,185 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:25:04 +0200
Subject: [PATCH] multipath-tools: Makefiles: use $(mandir)
Simply use $(mandir) rather than 3 different variables.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 4 +---
kpartx/Makefile | 6 +++---
libdmmp/Makefile | 8 ++++----
libmpathpersist/Makefile | 10 +++++-----
mpathpersist/Makefile | 6 +++---
multipath/Makefile | 12 ++++++------
multipathd/Makefile | 10 +++++-----
7 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 38bd1d80..f3c84771 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -58,9 +58,7 @@ bindir = $(exec_prefix)/sbin
multipathdir = $(TOPDIR)/libmultipath
daemondir = $(TOPDIR)/multipathd
mpathutildir = $(TOPDIR)/libmpathutil
-man8dir = $(usr_prefix)/share/man/man8
-man5dir = $(usr_prefix)/share/man/man5
-man3dir = $(usr_prefix)/share/man/man3
+mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
diff --git a/kpartx/Makefile b/kpartx/Makefile
index bdf2d035..464925ad 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -32,12 +32,12 @@ install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -m 644 dm-parts.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
$(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
$(INSTALL_PROGRAM) -m 644 del-part-nodes.rules $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
$(RM) $(DESTDIR)$(libudevdir)/kpartx_id
$(RM) $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
$(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index e4589250..985b694b 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -45,17 +45,17 @@ install:
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- $(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(man3dir)
- $(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(man3dir) docs/man/*.3
+ $(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
+ $(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3
uninstall:
$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
$(RM) $(DESTDIR)$(includedir)/$(HEADERS)
$(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
- @for file in $(DESTDIR)$(man3dir)/dmmp_*; do \
+ @for file in $(DESTDIR)$(mandir)/man3/dmmp_*; do \
$(RM) $$file; \
done
- $(RM) $(DESTDIR)$(man3dir)/libdmmp.h*
+ $(RM) $(DESTDIR)$(mandir)/man3/libdmmp.h*
$(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
clean: dep_clean
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 4e1717ef..479524d4 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -36,17 +36,17 @@ install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir)
+ $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(man3dir)
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(man3dir)
+ $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(mandir)/man3
+ $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(mandir)/man3
$(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir)
uninstall:
$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_in.3
- $(RM) $(DESTDIR)$(man3dir)/mpath_persistent_reserve_out.3
+ $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_in.3
+ $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_out.3
$(RM) $(DESTDIR)$(includedir)/mpath_persist.h
$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
diff --git a/mpathpersist/Makefile b/mpathpersist/Makefile
index 2219c86a..d62537b5 100644
--- a/mpathpersist/Makefile
+++ b/mpathpersist/Makefile
@@ -19,8 +19,8 @@ $(EXEC): $(OBJS)
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
clean: dep_clean
$(RM) core *.o $(EXEC)
@@ -29,7 +29,7 @@ include $(wildcard $(OBJS:.o=.d))
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
dep_clean:
$(RM) $(OBJS:.o=.d)
diff --git a/multipath/Makefile b/multipath/Makefile
index 116348e2..1c4e7a52 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -28,10 +28,10 @@ install:
$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir)
$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
ifneq ($(SCSI_DH_MODULES_PRELOAD),)
$(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
@@ -44,8 +44,8 @@ uninstall:
$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
- $(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
clean: dep_clean
$(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf
diff --git a/multipathd/Makefile b/multipathd/Makefile
index c462d7b1..78aefee0 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -89,14 +89,14 @@ ifdef SYSTEMD
$(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).socket $(DESTDIR)$(unitdir)
endif
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(man8dir)
- $(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(mandir)/man8
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC) $(DESTDIR)$(bindir)/$(CLI)
- $(RM) $(DESTDIR)$(man8dir)/$(EXEC).8
- $(RM) $(DESTDIR)$(man8dir)/$(CLI).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(RM) $(DESTDIR)$(mandir)/man8/$(CLI).8
$(RM) $(DESTDIR)$(unitdir)/$(EXEC).service
$(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket

View File

@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 30 Nov 2022 21:07:45 +0100
Subject: [PATCH] libmultipath: pathinfo: don't fail for devices lacking
INQUIRY properties
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some SAS devices (e.g. Seagate factory recertified 'white label' drives) may
come with the Vendor field blank. This causes Multipath to fail to
complete the discovery of those devices.
Such devices violate the SCSI Spec. From the SPC-6, §6.7.2:
"The T10 VENDOR IDENTIFICATION field contains eight bytes of left-aligned
ASCII data (see 4.3.1) identifying the manufacturer of the logical unit. The
T10 vendor identification shall be one assigned by INCITS.".
But as we don't identify WWIDs by vendor and product, we don't need to discard
these devices right away. We can go ahead fingers crossed, and hope that the
the other VPD pages for the device are correct.
We obviously can't look up reasonable device properties for such devices in
our hwtable. It would be up to the user to deal with that.
Reported by: Allyn Malventano (github.com/opensvc/multipath-tools/issues/56)
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d9ee2cb9..67ac0e6d 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1472,6 +1472,7 @@ scsi_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable)
{
struct udev_device *parent;
const char *attr_path = NULL;
+ static const char unknown[] = "UNKNOWN";
parent = pp->udev;
while (parent) {
@@ -1492,19 +1493,22 @@ scsi_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable)
if (!attr_path || pp->sg_id.host_no == -1)
return PATHINFO_FAILED;
- if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0)
- return PATHINFO_FAILED;;
-
+ if (sysfs_get_vendor(parent, pp->vendor_id, SCSI_VENDOR_SIZE) <= 0) {
+ condlog(1, "%s: broken device without vendor ID", pp->dev);
+ strlcpy(pp->vendor_id, unknown, SCSI_VENDOR_SIZE);
+ }
condlog(3, "%s: vendor = %s", pp->dev, pp->vendor_id);
- if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0)
- return PATHINFO_FAILED;;
-
+ if (sysfs_get_model(parent, pp->product_id, PATH_PRODUCT_SIZE) <= 0) {
+ condlog(1, "%s: broken device without product ID", pp->dev);
+ strlcpy(pp->product_id, unknown, PATH_PRODUCT_SIZE);
+ }
condlog(3, "%s: product = %s", pp->dev, pp->product_id);
- if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) < 0)
- return PATHINFO_FAILED;;
-
+ if (sysfs_get_rev(parent, pp->rev, PATH_REV_SIZE) < 0) {
+ condlog(2, "%s: broken device without revision", pp->dev);
+ strlcpy(pp->rev, unknown, PATH_REV_SIZE);
+ }
condlog(3, "%s: rev = %s", pp->dev, pp->rev);
/*

View File

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:34:34 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: simplify expression for
SYSTEMD
Use a shell "or" function here. Note the use of "strip" to remove
the whitespace that are caused by the line break.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index f3c84771..1a08b8fa 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -28,14 +28,8 @@ ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifeq ($(shell $(PKGCONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
- SYSTEMD = $(shell $(PKGCONFIG) --modversion libsystemd | awk '{print $$1}')
-else
- ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
- SYSTEMD = $(shell systemctl --version 2> /dev/null | \
- sed -n 's/systemd \([0-9]*\).*/\1/p')
- endif
-endif
+SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \
+ $(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
# Allow user to override default location.

View File

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 25 Jan 2023 11:35:38 +0100
Subject: [PATCH] libmultipath: bump ABI version to 18.0.0
Commit 6b81153 ("libmultipath: make prflag an enum") changed
the size and member offsets of struct multipath.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/libmultipath.version | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index faef2a2d..015623cc 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 {
put_multipath_config;
};
-LIBMULTIPATH_17.0.0 {
+LIBMULTIPATH_18.0.0 {
global:
/* symbols referenced by multipath and multipathd */
add_foreign;

View File

@ -1,68 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:53:04 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: untangle paths and source
directories
Only the installation paths can be customized. Move the definitions
of $(multipathdir) etc. further down.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 1a08b8fa..6ec8201b 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -31,8 +31,6 @@ endif
SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \
$(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
-# Allow user to override default location.
-
# Paths. All these can be overridden on the "make" command line.
prefix =
# Prefix for binaries
@@ -49,20 +47,11 @@ modulesloaddir := $(systemd_prefix)/lib/modules-load.d
libudevdir := $(systemd_prefix)/lib/udev
udevrulesdir := $(libudevdir)/rules.d
bindir = $(exec_prefix)/sbin
-multipathdir = $(TOPDIR)/libmultipath
-daemondir = $(TOPDIR)/multipathd
-mpathutildir = $(TOPDIR)/libmpathutil
mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
libdir = $(prefix)/$(LIB)/multipath
-mpathpersistdir = $(TOPDIR)/libmpathpersist
-mpathcmddir = $(TOPDIR)/libmpathcmd
-mpathvaliddir = $(TOPDIR)/libmpathvalid
-thirdpartydir = $(TOPDIR)/third-party
-libdmmpdir = $(TOPDIR)/libdmmp
-nvmedir = $(TOPDIR)/libmultipath/nvme
includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
@@ -124,6 +113,18 @@ SHARED_FLAGS = -shared
LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
BIN_LDFLAGS = -pie
+# Source code directories. Don't modify.
+
+multipathdir = $(TOPDIR)/libmultipath
+daemondir = $(TOPDIR)/multipathd
+mpathutildir = $(TOPDIR)/libmpathutil
+mpathpersistdir = $(TOPDIR)/libmpathpersist
+mpathcmddir = $(TOPDIR)/libmpathcmd
+mpathvaliddir = $(TOPDIR)/libmpathvalid
+thirdpartydir = $(TOPDIR)/third-party
+libdmmpdir = $(TOPDIR)/libdmmp
+nvmedir = $(TOPDIR)/libmultipath/nvme
+
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \
if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \

View File

@ -15,7 +15,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 866ab274..8c5a08a2 100644
index 2e25d2ea..540e1dfc 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -34,9 +34,9 @@ endif

View File

@ -1,110 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:17:00 +0200
Subject: [PATCH] multipath-tools: Makefiles: replace $(libdir) by $(plugindir)
The make variables $(libdir) and $(plugindir) are redundant.
I overlooked that in af15832 ("multipath-tools: make multipath_dir a
compiled-in option"). While libdir has existed longer, I think
plugindir describes better what this path is used for, so replace
libdir by plugindir.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 1 -
libmpathutil/Makefile | 1 -
libmultipath/Makefile | 2 +-
libmultipath/checkers/Makefile | 4 ++--
libmultipath/foreign/Makefile | 4 ++--
libmultipath/prioritizers/Makefile | 4 ++--
6 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 6ec8201b..17707a3e 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -51,7 +51,6 @@ mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
syslibdir = $(prefix)/$(LIB)
usrlibdir = $(usr_prefix)/$(LIB)
-libdir = $(prefix)/$(LIB)/multipath
includedir = $(usr_prefix)/include
pkgconfdir = $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 68b1c7d6..c913c761 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -54,7 +54,6 @@ abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index f0df27c0..c7d4fc99 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -119,7 +119,7 @@ test-lib: ../tests/$(LIBS)
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(plugindir)
$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index c9a2c4ca..39ad76e0 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -25,10 +25,10 @@ libcheck%.so: %.o
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done
+ for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile
index d0232f20..8bf9047b 100644
--- a/libmultipath/foreign/Makefile
+++ b/libmultipath/foreign/Makefile
@@ -17,10 +17,10 @@ libforeign-%.so: %.o
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done
+ for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index 97155f51..72eefe49 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -37,10 +37,10 @@ libprio%.so: %.o
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install: $(LIBS)
- $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(libdir)
+ $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(libdir)/$$file; done
+ for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(RM) core *.a *.o *.gz *.so

View File

@ -43,10 +43,10 @@ index 8d15d2ea..eff690fd 100644
udev_device_get_properties_list_entry(udev)) {
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 1fea9d5a..eef3c605 100644
index b4dccd1b..284282c6 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1353,9 +1353,14 @@ keywords. Both are regular expressions. For a full description of these keywords
@@ -1367,9 +1367,14 @@ keywords. Both are regular expressions. For a full description of these keywords
Regular expression for an udev property. All
devices that have matching udev properties will be excluded/included.
The handling of the \fIproperty\fR keyword is special,
@ -62,7 +62,7 @@ index 1fea9d5a..eef3c605 100644
.
.RS
.PP
@@ -1366,10 +1371,6 @@ Blacklisting by missing properties is only applied to devices which do have the
@@ -1380,10 +1385,6 @@ Blacklisting by missing properties is only applied to devices which do have the
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
set. Previously, it was applied to every device, possibly causing devices to be
blacklisted because of temporary I/O error conditions.

View File

@ -1,112 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:35:48 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: use simple make variables
consistently
"Simply expanded" make variables are generally preferred over "recursively
expanded" make variables, unless they reference other variables that are
defined over overwritten further down in the Makefile (see
https://www.gnu.org/software/make/manual/html_node/Flavors.html).
Using them makes the code easier to read and even somewhat faster.
We've been adding simply expanded variables over time, but most older
code still uses recursively expanded ones. Try to be consistent, at least
in Makefile.inc.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 17707a3e..86602e2a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -32,11 +32,11 @@ SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null
$(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
# Paths. All these can be overridden on the "make" command line.
-prefix =
+prefix :=
# Prefix for binaries
-exec_prefix = $(prefix)
+exec_prefix := $(prefix)
# Prefix for non-essential libraries (libdmmp)
-usr_prefix = $(prefix)
+usr_prefix := $(prefix)
# Where to install systemd-related files. systemd is usually installed under /usr
# Note: some systemd installations use separate "prefix" and "rootprefix".
# In this case, override only unitdir to use systemd's "rootprefix" instead of $(systemd_prefix)
@@ -46,13 +46,13 @@ tmpfilesdir := $(systemd_prefix)/lib/tmpfiles.d
modulesloaddir := $(systemd_prefix)/lib/modules-load.d
libudevdir := $(systemd_prefix)/lib/udev
udevrulesdir := $(libudevdir)/rules.d
-bindir = $(exec_prefix)/sbin
+bindir := $(exec_prefix)/sbin
mandir := $(usr_prefix)/share/man
LIB := $(if $(shell test -d /lib64 && echo 1),lib64,lib)
-syslibdir = $(prefix)/$(LIB)
-usrlibdir = $(usr_prefix)/$(LIB)
-includedir = $(usr_prefix)/include
-pkgconfdir = $(usrlibdir)/pkgconfig
+syslibdir := $(prefix)/$(LIB)
+usrlibdir := $(usr_prefix)/$(LIB)
+includedir := $(usr_prefix)/include
+pkgconfdir := $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
configdir := $(prefix)/etc/multipath/conf.d
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
@@ -60,10 +60,10 @@ devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/
libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
kernel_incdir := /usr/include
-GZIP_PROG = gzip -9 -c
-RM = rm -f
-LN = ln -sf
-INSTALL_PROGRAM = install
+GZIP_PROG := gzip -9 -c
+RM := rm -f
+LN := ln -sf
+INSTALL_PROGRAM := install
NV_VERSION_SCRIPT = $(VERSION_SCRIPT:%.version=%-nv.version)
# $(call TEST_CC_OPTION,option,fallback)
@@ -106,23 +106,23 @@ CPPFLAGS := $(FORTIFY_OPT) \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
-BIN_CFLAGS = -fPIE -DPIE
-LIB_CFLAGS = -fPIC
-SHARED_FLAGS = -shared
+BIN_CFLAGS := -fPIE -DPIE
+LIB_CFLAGS := -fPIC
+SHARED_FLAGS := -shared
LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
-BIN_LDFLAGS = -pie
+BIN_LDFLAGS := -pie
# Source code directories. Don't modify.
-multipathdir = $(TOPDIR)/libmultipath
-daemondir = $(TOPDIR)/multipathd
-mpathutildir = $(TOPDIR)/libmpathutil
-mpathpersistdir = $(TOPDIR)/libmpathpersist
-mpathcmddir = $(TOPDIR)/libmpathcmd
-mpathvaliddir = $(TOPDIR)/libmpathvalid
-thirdpartydir = $(TOPDIR)/third-party
-libdmmpdir = $(TOPDIR)/libdmmp
-nvmedir = $(TOPDIR)/libmultipath/nvme
+multipathdir := $(TOPDIR)/libmultipath
+daemondir := $(TOPDIR)/multipathd
+mpathutildir := $(TOPDIR)/libmpathutil
+mpathpersistdir := $(TOPDIR)/libmpathpersist
+mpathcmddir := $(TOPDIR)/libmpathcmd
+mpathvaliddir := $(TOPDIR)/libmpathvalid
+thirdpartydir := $(TOPDIR)/third-party
+libdmmpdir := $(TOPDIR)/libdmmp
+nvmedir := $(TOPDIR)/libmultipath/nvme
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \

View File

@ -1,24 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 17:40:30 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: fix a log message
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index 86602e2a..77790ddf 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -159,7 +159,7 @@ check_var = $(shell \
found=0; \
status="no"; \
fi; \
- echo 1>&2 "Checking for .. $1 in $2 ... $$status"; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
echo "$$found" \
)

View File

@ -1,129 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 16:40:27 +0200
Subject: [PATCH] multipath-tools: Makefile.inc: set systemd-specific flags
Define SYSTEMD_CPPFLAGS and SYSTEMD_LIBDEPS, and use them in Makefiles.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 3 +++
libmpathutil/Makefile | 13 ++-----------
libmultipath/Makefile | 14 +++-----------
multipathd/Makefile | 25 ++++++++-----------------
4 files changed, 16 insertions(+), 39 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 77790ddf..2cf25745 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -97,6 +97,9 @@ ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers
WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)
+SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
+SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
+
OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \
-Werror=implicit-function-declaration -Werror=format-security \
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index c913c761..4be75d2d 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -8,19 +8,10 @@ DEVLIB = libmpathutil.so
LIBS = $(DEVLIB).$(SONAME)
VERSION_SCRIPT := libmpathutil.version
-CPPFLAGS += -I. -I$(multipathdir) -I$(mpathcmddir)
+CPPFLAGS += -I. -I$(multipathdir) -I$(mpathcmddir) $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS) -D_GNU_SOURCE
-LIBDEPS += -lpthread -ldl -ludev -L$(mpathcmddir) -lmpathcmd
-
-ifdef SYSTEMD
- CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
- ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
- LIBDEPS += -lsystemd
- else
- LIBDEPS += -lsystemd-daemon
- endif
-endif
+LIBDEPS += -lpthread -ldl -ludev -L$(mpathcmddir) -lmpathcmd $(SYSTEMD_LIBDEPS)
# object files referencing MULTIPATH_DIR or CONFIG_DIR
# they need to be recompiled for unit tests
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index c7d4fc99..009f26a3 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -8,19 +8,11 @@ DEVLIB = libmultipath.so
LIBS = $(DEVLIB).$(SONAME)
VERSION_SCRIPT := libmultipath.version
-CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE
+CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS)
-LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd -lurcu -laio
-
-ifdef SYSTEMD
- CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
- ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
- LIBDEPS += -lsystemd
- else
- LIBDEPS += -lsystemd-daemon
- endif
-endif
+LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
+ -lurcu -laio $(SYSTEMD_LIBDEPS)
ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_FLUSH
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 78aefee0..cdda371b 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -18,14 +18,17 @@ endif
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \
$(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
- -DBINDIR='"$(bindir)"'
+ -DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
+ CPPFLAGS += -DNO_DMEVENTS_POLL
+endif
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
-CLI_LIBDEPS := -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread
-LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
- -ldevmapper $(CLI_LIBDEPS)
-
+CLI_LIBDEPS := -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
+ -ludev -ldl -lurcu -lpthread $(SYSTEMD_LIBDEPS)
+LIBDEPS := -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
+ -ldevmapper $(CLI_LIBDEPS)
ifeq ($(READLINE),libedit)
RL_CPPFLAGS = -DUSE_LIBEDIT
@@ -40,18 +43,6 @@ RL_CPPFLAGS += -DBROKEN_RL_COMPLETION_FUNC
endif
endif
-ifdef SYSTEMD
- CPPFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
- ifeq ($(shell test $(SYSTEMD) -gt 209 && echo 1), 1)
- CLI_LIBDEPS += -lsystemd
- else
- CLI_LIBDEPS += -lsystemd-daemon
- endif
-endif
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
- CPPFLAGS += -DNO_DMEVENTS_POLL
-endif
-
OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o init_unwinder.o

View File

@ -9,14 +9,14 @@ still being generic.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
Makefile.inc | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 8c5a08a2..e6e7f7d7 100644
index 540e1dfc..748911e2 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -74,19 +74,31 @@ INSTALL_PROGRAM := install
@@ -78,11 +78,23 @@ ORIG_LDFLAGS := $(LDFLAGS)
SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
@ -37,15 +37,14 @@ index 8c5a08a2..e6e7f7d7 100644
+endif
+WARNFLAGS := -Werror -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \
-Werror=implicit-function-declaration -Werror=format-security \
- $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
-CPPFLAGS := $(FORTIFY_OPT) \
- -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
+ $(WNOCLOBBERED) -Werror=cast-qual \
+ $(ERROR_DISCARDED_QUALIFIERS) -Wstrict-prototypes
+CPPFLAGS := -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
- $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS)
-CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) \
+ $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS) -Wstrict-prototypes
+CPPFLAGS := $(CPPFLAGS) \
-DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-DRUNTIME_DIR=\"$(runtimedir)\" \
-DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
@@ -90,7 +102,7 @@ CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
SHARED_FLAGS := -shared

View File

@ -1,54 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 18:51:52 +0200
Subject: [PATCH] multipathd: Makefile: fix compilation flags for libedit
The workaround for the wrong prototype in older libedit versions
had ended up in the code for libreadline. Fix it, and use simple
make variables.
Fixes: 2bd80f6 ("multipathd: fix incompatible pointer type error with libedit")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/Makefile | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/multipathd/Makefile b/multipathd/Makefile
index cdda371b..7221b6af 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -31,17 +31,17 @@ LIBDEPS := -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
-ldevmapper $(CLI_LIBDEPS)
ifeq ($(READLINE),libedit)
-RL_CPPFLAGS = -DUSE_LIBEDIT
-RL_LIBDEPS += -ledit
-endif
-ifeq ($(READLINE),libreadline)
-RL_CPPFLAGS += -DUSE_LIBREADLINE
-RL_LIBDEPS += -lreadline
-# See comment in uxclnt.c
+RL_CPPFLAGS := -DUSE_LIBEDIT
+RL_LIBDEPS := -ledit
+# See comment in multipathc.c
ifeq ($(shell sed -En 's/.*\<Function\s*\*rl_completion_entry_function;.*/yes/p' /usr/include/editline/readline.h),yes)
RL_CPPFLAGS += -DBROKEN_RL_COMPLETION_FUNC
endif
endif
+ifeq ($(READLINE),libreadline)
+RL_CPPFLAGS := -DUSE_LIBREADLINE
+RL_LIBDEPS := -lreadline
+endif
OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o init_unwinder.o
@@ -52,8 +52,6 @@ ifeq ($(FPIN_SUPPORT),1)
OBJS += fpin_handlers.o
endif
-
-
EXEC = multipathd
CLI = multipathc

View File

@ -1,136 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 21:59:36 +0200
Subject: [PATCH] multipath-tools Makefiles: clean up executable Makefiles
Move the EXEC definition to the top, and use simple make variables
where possible.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
kpartx/Makefile | 15 +++++++--------
multipath/Makefile | 6 +++---
multipathd/Makefile | 30 ++++++++++++++----------------
3 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 464925ad..7ceae96b 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -3,20 +3,19 @@
#
include ../Makefile.inc
-CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-CFLAGS += $(BIN_CFLAGS)
-LDFLAGS += $(BIN_LDFLAGS)
-
-LIBDEPS += -ldevmapper
+EXEC := kpartx
+CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_COOKIE
endif
-OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
- gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o
+CFLAGS += $(BIN_CFLAGS)
+LDFLAGS += $(BIN_LDFLAGS)
+LIBDEPS += -ldevmapper
-EXEC = kpartx
+OBJS := bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
+ gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o
all: $(EXEC)
diff --git a/multipath/Makefile b/multipath/Makefile
index 1c4e7a52..7f7b341d 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -3,15 +3,15 @@
#
include ../Makefile.inc
+EXEC := multipath
+
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir)
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathutildir) -lmpathutil \
-L$(mpathcmddir) -lmpathcmd -lpthread -ldevmapper -ldl -ludev
-EXEC = multipath
-
-OBJS = main.o
+OBJS := main.o
all: $(EXEC) multipath.rules tmpfiles.conf
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 7221b6af..bb8f7770 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,27 +1,30 @@
include ../Makefile.inc
+EXEC := multipathd
+CLI := multipathc
+
+CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \
+ $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
+ awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
+ -DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
+
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
+ CPPFLAGS += -DNO_DMEVENTS_POLL
+endif
ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
CPPFLAGS += -DLIBDM_API_GET_ERRNO
endif
-
ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
CPPFLAGS += -DFPIN_EVENT_HANDLER
FPIN_SUPPORT = 1
endif
+
#
# debugging stuff
#
#CPPFLAGS += -DLCKDBG
-#CPPFLAGS += -D_DEBUG_
#CPPFLAGS += -DLOGDBG
-CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir) -I$(thirdpartydir) \
- $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
- awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
- -DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
- CPPFLAGS += -DNO_DMEVENTS_POLL
-endif
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
@@ -43,18 +46,13 @@ RL_CPPFLAGS := -DUSE_LIBREADLINE
RL_LIBDEPS := -lreadline
endif
-OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
+CLI_OBJS := multipathc.o cli.o
+OBJS := main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o init_unwinder.o
-
-CLI_OBJS = multipathc.o cli.o
-
ifeq ($(FPIN_SUPPORT),1)
OBJS += fpin_handlers.o
endif
-EXEC = multipathd
-CLI = multipathc
-
all : $(EXEC) $(CLI)
$(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so

View File

@ -1,261 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 21:52:06 +0200
Subject: [PATCH] multipath-tools: Makefiles: use common code for libraries
Move shared code to Makefile.inc as far as possible. Use simple
make variables where possible.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 15 ++++++++++++++-
libdmmp/Makefile | 17 ++++++++---------
libmpathcmd/Makefile | 14 ++------------
libmpathpersist/Makefile | 14 ++------------
libmpathutil/Makefile | 14 +-------------
libmpathvalid/Makefile | 14 ++------------
libmultipath/Makefile | 12 +-----------
7 files changed, 30 insertions(+), 70 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 2cf25745..fe6bc088 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -64,7 +64,6 @@ GZIP_PROG := gzip -9 -c
RM := rm -f
LN := ln -sf
INSTALL_PROGRAM := install
-NV_VERSION_SCRIPT = $(VERSION_SCRIPT:%.version=%-nv.version)
# $(call TEST_CC_OPTION,option,fallback)
# Test if the C compiler supports the option.
@@ -127,6 +126,13 @@ thirdpartydir := $(TOPDIR)/third-party
libdmmpdir := $(TOPDIR)/libdmmp
nvmedir := $(TOPDIR)/libmultipath/nvme
+# Common code for libraries - library Makefiles just set DEVLIB
+# SONAME defaults to 0 (we use version scripts)
+SONAME := 0
+LIBS = $(DEVLIB).$(SONAME)
+VERSION_SCRIPT = $(DEVLIB:%.so=%.version)
+NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
+
# Check whether a function with name $1 has been declared in header file $2.
check_func = $(shell \
if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
@@ -175,3 +181,10 @@ check_var = $(shell \
%.abi: %.so
abidw $< >$@
+
+%-nv.version: %.version
+ @echo creating $@ from $<
+ @printf 'NOVERSION {\nglobal:\n' >$@
+ @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
+ @printf 'local:\n\t*;\n};\n' >>$@
+
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index 985b694b..67b6f86f 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -5,15 +5,14 @@
#
include ../Makefile.inc
-LIBDMMP_VERSION=0.2.0
-SONAME=$(LIBDMMP_VERSION)
-DEVLIB = libdmmp.so
-LIBS = $(DEVLIB).$(SONAME)
-PKGFILE = libdmmp.pc
-EXTRA_MAN_FILES = libdmmp.h.3
-HEADERS = libdmmp/libdmmp.h
-
-OBJS = libdmmp.o libdmmp_mp.o libdmmp_pg.o libdmmp_path.o libdmmp_misc.o
+LIBDMMP_VERSION := 0.2.0
+SONAME := $(LIBDMMP_VERSION)
+DEVLIB := libdmmp.so
+PKGFILE := libdmmp.pc
+EXTRA_MAN_FILES := libdmmp.h.3
+HEADERS := libdmmp/libdmmp.h
+
+OBJS := libdmmp.o libdmmp_mp.o libdmmp_pg.o libdmmp_path.o libdmmp_misc.o
CPPFLAGS += -I$(libdmmpdir) -I$(mpathcmddir) $(shell $(PKGCONFIG) --cflags json-c)
CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index 0f83fe7b..f705c7f0 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -1,13 +1,8 @@
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathcmd.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmpathcmd.version
-
+DEVLIB := libmpathcmd.so
CFLAGS += $(LIB_CFLAGS)
-
-OBJS = mpath_cmd.o
+OBJS := mpath_cmd.o
all: $(DEVLIB)
@@ -15,11 +10,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 479524d4..6f69168f 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -1,16 +1,11 @@
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathpersist.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT:= libmpathpersist.version
-
+DEVLIB := libmpathpersist.so
CFLAGS += $(LIB_CFLAGS) -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcmddir)
LDFLAGS += -L$(multipathdir) -L$(mpathutildir) -L$(mpathcmddir)
-
LIBDEPS += -lmultipath -lmpathutil -lmpathcmd -ldevmapper -lpthread -ldl
-OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
+OBJS := mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
all: $(DEVLIB)
@@ -18,11 +13,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 4be75d2d..5665af28 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -3,14 +3,9 @@
#
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathutil.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmpathutil.version
-
+DEVLIB := libmpathutil.so
CPPFLAGS += -I. -I$(multipathdir) -I$(mpathcmddir) $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS) -D_GNU_SOURCE
-
LIBDEPS += -lpthread -ldl -ludev -L$(mpathcmddir) -lmpathcmd $(SYSTEMD_LIBDEPS)
# object files referencing MULTIPATH_DIR or CONFIG_DIR
@@ -22,8 +17,6 @@ OBJS := parser.o vector.o util.o debug.o time-util.o \
all: $(DEVLIB)
-make_static = $(shell sed '/^static/!s/^\([a-z]\{1,\} \)/static \1/' <$1 >$2)
-
$(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
@@ -31,11 +24,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(DEVLIB): $(LIBS)
$(LN) $(LIBS) $@
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index 5dbfb923..bd4ccc0d 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -1,17 +1,12 @@
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmpathvalid.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmpathvalid.version
-
+DEVLIB := libmpathvalid.so
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir)
CFLAGS += $(LIB_CFLAGS)
-
LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
-L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd -ludev
-OBJS = mpath_valid.o
+OBJS := mpath_valid.o
all: $(LIBS)
@@ -20,11 +15,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
-Wl,--version-script=$(VERSION_SCRIPT)
$(LN) $(LIBS) $(DEVLIB)
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 009f26a3..9dc229ae 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -3,14 +3,9 @@
#
include ../Makefile.inc
-SONAME = 0
-DEVLIB = libmultipath.so
-LIBS = $(DEVLIB).$(SONAME)
-VERSION_SCRIPT := libmultipath.version
-
+DEVLIB := libmultipath.so
CPPFLAGS += -I$(mpathutildir) -I$(mpathcmddir) -I$(nvmedir) -D_GNU_SOURCE $(SYSTEMD_CPPFLAGS)
CFLAGS += $(LIB_CFLAGS)
-
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
-lurcu -laio $(SYSTEMD_LIBDEPS)
@@ -85,11 +80,6 @@ $(LIBS): $(OBJS) $(VERSION_SCRIPT)
$(DEVLIB): $(LIBS)
$(LN) $(LIBS) $@
-$(NV_VERSION_SCRIPT): $(VERSION_SCRIPT)
- @printf 'NOVERSION {\nglobal:\n' >$@
- @grep -P '^[ \t]+[a-zA-Z_][a-zA-Z0-9_]*;' $< >>$@
- @printf 'local:\n\t*;\n};\n' >>$@
-
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)

View File

@ -1,172 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 27 Oct 2022 22:18:22 +0200
Subject: [PATCH] multipath-tools: Makefiles: move common code to rules.mk
The library Makefiles contain a lot of similar rules. Just
maintain them in a single file.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathcmd/Makefile | 13 +------------
libmpathpersist/Makefile | 13 +------------
libmpathutil/Makefile | 13 +------------
libmpathvalid/Makefile | 13 ++-----------
libmultipath/Makefile | 16 ++--------------
rules.mk | 15 +++++++++++++++
6 files changed, 22 insertions(+), 61 deletions(-)
create mode 100644 rules.mk
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index f705c7f0..cfb202b8 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -6,18 +6,7 @@ OBJS := mpath_cmd.o
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 6f69168f..94672556 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -9,18 +9,7 @@ OBJS := mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o mpath_persist_int.o
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 5665af28..5ab33c09 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -17,18 +17,7 @@ OBJS := parser.o vector.o util.o debug.o time-util.o \
all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+include $(TOPDIR)/rules.mk
install: all
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index bd4ccc0d..88034df3 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -8,18 +8,9 @@ LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
OBJS := mpath_valid.o
-all: $(LIBS)
+all: $(DEVLIB)
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) \
- -Wl,--version-script=$(VERSION_SCRIPT)
- $(LN) $(LIBS) $(DEVLIB)
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+include $(TOPDIR)/rules.mk
install: $(LIBS)
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 9dc229ae..e24eab8a 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -56,6 +56,8 @@ OBJS := $(OBJS-O) $(OBJS-U)
all: $(DEVLIB)
+include $(TOPDIR)/rules.mk
+
nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
@@ -72,20 +74,6 @@ nvme-ioctl.c: nvme/nvme-ioctl.c
nvme-ioctl.h: nvme/nvme-ioctl.h
$(call make_static,$<,$@)
-
-$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
-
-$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
- -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
-
-abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
-
../tests/$(LIBS): $(OBJS-O) $(OBJS-T) $(VERSION_SCRIPT)
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
-o $@ $(OBJS-O) $(OBJS-T) $(LIBDEPS)
diff --git a/rules.mk b/rules.mk
new file mode 100644
index 00000000..c1d80820
--- /dev/null
+++ b/rules.mk
@@ -0,0 +1,15 @@
+# Copyright (c) SUSE LLC
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+$(DEVLIB): $(LIBS)
+ $(LN) $(LIBS) $@
+
+$(LIBS): $(OBJS) $(VERSION_SCRIPT)
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ -Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
+
+$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ -Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
+
+abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)

View File

@ -1,603 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 00:01:46 +0200
Subject: [PATCH] multipath-tools Makefiles: create config.mk
Rather than running the test scripts for certain system features
every time "make" is called, save the configuration in "config.mk"
and "libmultipath/autoconfig.h", and reuse it later. This reduces
build time, especially in subsequent builds, and the build output is
less garbled by compiler options.
It works by invoking the separate make file "create-config.mk" at
the beginning of the build process. Most of the complex makefile
functions are moved to "create-config.mk".
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/foreign.yaml | 2 +-
.gitignore | 2 +
Makefile | 19 +++-
Makefile.inc | 76 +--------------
create-config.mk | 144 +++++++++++++++++++++++++++++
kpartx/Makefile | 4 -
kpartx/devmapper.c | 1 +
kpartx/kpartx.c | 1 +
libdmmp/test/Makefile | 1 +
libmultipath/Makefile | 30 +-----
libmultipath/devmapper.h | 2 +-
libmultipath/dict.c | 1 +
libmultipath/prioritizers/Makefile | 2 +-
libmultipath/propsel.c | 1 +
libmultipath/uevent.c | 1 +
multipathd/Makefile | 11 ---
multipathd/fpin.h | 1 +
multipathd/main.c | 1 +
rules.mk | 3 +
tests/Makefile | 8 --
20 files changed, 179 insertions(+), 132 deletions(-)
create mode 100644 create-config.mk
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
index bd4e9c12..5a19913a 100644
--- a/.github/workflows/foreign.yaml
+++ b/.github/workflows/foreign.yaml
@@ -30,7 +30,7 @@ jobs:
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
run: >
tar cfv binaries.tar
- Makefile*
+ Makefile* config.mk
libmpathcmd/*.so* libmultipath/*.so* libmpathutil/*.so*
libmultipath/checkers/*.so libmultipath/prioritizers/*.so
libmultipath/foreign/*.so
diff --git a/.gitignore b/.gitignore
index 83f8a552..535353e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
*.gz
*.d
\#*
+config.mk
cscope.files
cscope.out
kpartx/kpartx
@@ -35,5 +36,6 @@ tests/*.out
tests/*.vgr
libmultipath/nvme-ioctl.c
libmultipath/nvme-ioctl.h
+libmultipath/autoconfig.h
*/*-nv.version
reference-abi
diff --git a/Makefile b/Makefile
index 27b4641f..1b28db62 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,14 @@ BUILDDIRS.clean := $(BUILDDIRS:=.clean) tests.clean
all: $(BUILDDIRS)
-$(BUILDDIRS):
+config.mk libmultipath/autoconfig.h:
+ @$(MAKE) -f create-config.mk
+ @echo ==== config.mk ====
+ @cat config.mk
+ @echo ==== autoconfig.h ====
+ @cat libmultipath/autoconfig.h
+
+$(BUILDDIRS): config.mk
$(MAKE) -C $@
$(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
@@ -83,7 +90,7 @@ libmultipath/checkers.install \
libmultipath/prioritizers.install \
libmultipath/foreign.install: libmultipath.install
-$(BUILDDIRS.clean):
+%.clean:
$(MAKE) -C ${@:.clean=} clean
%.install: %
@@ -92,8 +99,12 @@ $(BUILDDIRS.clean):
$(BUILDDIRS:=.uninstall):
$(MAKE) -C ${@:.uninstall=} uninstall
-clean: $(BUILDDIRS.clean)
- rm -rf abi abi.tar.gz abi-test compile_commands.json
+# If config.mk is missing, "make clean" in subdir either fails, or tries to
+# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
+clean:
+ @touch config.mk
+ $(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
+ rm -rf abi abi.tar.gz abi-test compile_commands.json config.mk
install: $(BUILDDIRS:=.install)
uninstall: $(BUILDDIRS:=.uninstall)
diff --git a/Makefile.inc b/Makefile.inc
index fe6bc088..415634f5 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -27,9 +27,9 @@ PKGCONFIG ?= pkg-config
ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-
-SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \
- $(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
+ifneq ($(CREATE_CONFIG),1)
+include $(TOPDIR)/config.mk
+endif
# Paths. All these can be overridden on the "make" command line.
prefix :=
@@ -65,37 +65,6 @@ RM := rm -f
LN := ln -sf
INSTALL_PROGRAM := install
-# $(call TEST_CC_OPTION,option,fallback)
-# Test if the C compiler supports the option.
-# Evaluates to "option" if yes, and "fallback" otherwise.
-TEST_CC_OPTION = $(shell \
- if echo 'int main(void){return 0;}' | \
- $(CC) -o /dev/null -c -Werror "$(1)" -xc - >/dev/null 2>&1; \
- then \
- echo "$(1)"; \
- else \
- echo "$(2)"; \
- fi)
-
-# "make" on some distros will fail on explicit '#' or '\#' in the program text below
-__HASH__ := \#
-# Check if _DFORTIFY_SOURCE=3 is supported.
-# On some distros (e.g. Debian Buster) it will be falsely reported as supported
-# but it doesn't seem to make a difference wrt the compilation result.
-FORTIFY_OPT := $(shell \
- if /bin/echo -e '$(__HASH__)include <string.h>\nint main(void) { return 0; }' | \
- $(CC) -o /dev/null -c -O2 -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
- then \
- echo "-D_FORTIFY_SOURCE=3"; \
- else \
- echo "-D_FORTIFY_SOURCE=2"; \
- fi)
-
-STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
-ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
-WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
-WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)
-
SYSTEMD_CPPFLAGS := $(if $(SYSTEMD),-DUSE_SYSTEMD=$(SYSTEMD))
SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo 1),-lsystemd,-lsystemd-daemon))
@@ -133,45 +102,6 @@ LIBS = $(DEVLIB).$(SONAME)
VERSION_SCRIPT = $(DEVLIB:%.so=%.version)
NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
-# Check whether a function with name $1 has been declared in header file $2.
-check_func = $(shell \
- if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
- echo "$$found" \
- )
-
-# Checker whether a file with name $1 exists
-check_file = $(shell \
- if [ -f "$1" ]; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking if $1 exists ... $$status"; \
- echo "$$found" \
- )
-
-# Check whether a file contains a variable with name $1 in header file $2
-check_var = $(shell \
- if grep -Eq "(^|[[:blank:]])$1([[:blank:]]|=|$$)" "$2"; then \
- found=1; \
- status="yes"; \
- else \
- found=0; \
- status="no"; \
- fi; \
- echo 1>&2 "Checking for $1 in $2 ... $$status"; \
- echo "$$found" \
- )
-
%.o: %.c
@echo building $@ because of $?
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
diff --git a/create-config.mk b/create-config.mk
new file mode 100644
index 00000000..2cc5284f
--- /dev/null
+++ b/create-config.mk
@@ -0,0 +1,144 @@
+# Copyright (c) SUSE LLC
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+TOPDIR := .
+CREATE_CONFIG := 1
+include $(TOPDIR)/Makefile.inc
+
+# Check whether a function with name $1 has been declared in header file $2.
+check_func = $(shell \
+ if grep -Eq "^[^[:blank:]]+[[:blank:]]+$1[[:blank:]]*(.*)*" "$2"; then \
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
+ echo "$$found" \
+ )
+
+# Checker whether a file with name $1 exists
+check_file = $(shell \
+ if [ -f "$1" ]; then \
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking if $1 exists ... $$status"; \
+ echo "$$found" \
+ )
+
+# Check whether a file contains a variable with name $1 in header file $2
+check_var = $(shell \
+ if grep -Eq "(^|[[:blank:]])$1([[:blank:]]|=|$$)" "$2"; then \
+ found=1; \
+ status="yes"; \
+ else \
+ found=0; \
+ status="no"; \
+ fi; \
+ echo 1>&2 "Checking for $1 in $2 ... $$status"; \
+ echo "$$found" \
+ )
+
+# Test special behavior of gcc 4.8 with nested initializers
+# gcc 4.8 compiles blacklist.c only with -Wno-missing-field-initializers
+TEST_MISSING_INITIALIZERS = $(shell \
+ echo 'struct A {int a, b;}; struct B {struct A a; int b;} b = {.a.a=1};' | \
+ $(CC) -c -Werror -Wmissing-field-initializers -o /dev/null -xc - >/dev/null 2>&1 \
+ || echo -Wno-missing-field-initializers)
+
+DEFINES :=
+
+ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_FLUSH
+endif
+
+ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_GET_ERRNO
+endif
+
+ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_COOKIE
+endif
+
+ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
+ DEFINES += LIBUDEV_API_RECVBUF
+endif
+
+ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_DEFERRED
+endif
+
+ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
+ DEFINES += LIBDM_API_HOLD_CONTROL
+endif
+
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
+ DEFINES += FPIN_EVENT_HANDLER
+ FPIN_SUPPORT = 1
+endif
+
+ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
+ ANA_SUPPORT := 1
+endif
+
+ifeq ($(ENABLE_DMEVENTS_POLL),0)
+ DEFINES += -DNO_DMEVENTS_POLL
+endif
+
+SYSTEMD := $(strip $(or $(shell $(PKGCONFIG) --modversion libsystemd 2>/dev/null | awk '{print $$1}'), \
+ $(shell systemctl --version 2>/dev/null | sed -n 's/systemd \([0-9]*\).*/\1/p')))
+
+
+# $(call TEST_CC_OPTION,option,fallback)
+# Test if the C compiler supports the option.
+# Evaluates to "option" if yes, and "fallback" otherwise.
+TEST_CC_OPTION = $(shell \
+ if echo 'int main(void){return 0;}' | \
+ $(CC) -o /dev/null -c -Werror "$(1)" -xc - >/dev/null 2>&1; \
+ then \
+ echo "$(1)"; \
+ else \
+ echo "$(2)"; \
+ fi)
+
+# "make" on some distros will fail on explicit '#' or '\#' in the program text below
+__HASH__ := \#
+# Check if _DFORTIFY_SOURCE=3 is supported.
+# On some distros (e.g. Debian Buster) it will be falsely reported as supported
+# but it doesn't seem to make a difference wrt the compilation result.
+FORTIFY_OPT := $(shell \
+ if /bin/echo -e '$(__HASH__)include <string.h>\nint main(void) { return 0; }' | \
+ $(CC) -o /dev/null -c -O2 -Werror -D_FORTIFY_SOURCE=3 -xc - 2>/dev/null; \
+ then \
+ echo "-D_FORTIFY_SOURCE=3"; \
+ else \
+ echo "-D_FORTIFY_SOURCE=2"; \
+ fi)
+
+STACKPROT :=
+
+all: $(multipathdir)/autoconfig.h $(TOPDIR)/config.mk
+
+$(multipathdir)/autoconfig.h:
+ @echo creating $@
+ @echo '#ifndef _AUTOCONFIG_H' >$@
+ @echo '#define _AUTOCONFIG_H' >>$@
+ @for x in $(DEFINES); do echo "#define $$x" >>$@; done
+ @echo '#endif' >>$@
+
+$(TOPDIR)/config.mk:
+ @echo creating $@
+ @echo "FPIN_SUPPORT := $(FPIN_SUPPORT)" >$@
+ @echo "FORTIFY_OPT := $(FORTIFY_OPT)" >>$@
+ @echo "SYSTEMD := $(SYSTEMD)" >>$@
+ @echo "ANA_SUPPORT := $(ANA_SUPPORT)" >>$@
+ @echo "STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)" >>$@
+ @echo "ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)" >>$@
+ @echo "WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)" >>$@
+ @echo "WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)" >>$@
+ @echo "W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)" >>$@
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 7ceae96b..31b1138a 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -6,10 +6,6 @@ include ../Makefile.inc
EXEC := kpartx
CPPFLAGS += -I. -I$(multipathdir) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_COOKIE
-endif
-
CFLAGS += $(BIN_CFLAGS)
LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -ldevmapper
diff --git a/kpartx/devmapper.c b/kpartx/devmapper.c
index bf14c784..f12762c5 100644
--- a/kpartx/devmapper.c
+++ b/kpartx/devmapper.c
@@ -9,6 +9,7 @@
#include <ctype.h>
#include <errno.h>
#include <sys/sysmacros.h>
+#include "autoconfig.h"
#include "devmapper.h"
#include "kpartx.h"
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 1d568c9e..46cb76ba 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -34,6 +34,7 @@
#include <ctype.h>
#include <libdevmapper.h>
+#include "autoconfig.h"
#include "devmapper.h"
#include "crc32.h"
#include "lopart.h"
diff --git a/libdmmp/test/Makefile b/libdmmp/test/Makefile
index 76b24d61..93de64a0 100644
--- a/libdmmp/test/Makefile
+++ b/libdmmp/test/Makefile
@@ -2,6 +2,7 @@
#
# Copyright (C) 2015-2016 Gris Ge <fge@redhat.com>
#
+TOPDIR := ../..
include ../../Makefile.inc
_libdmmpdir=../$(libdmmpdir)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index e24eab8a..1cc13577 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -9,34 +9,6 @@ CFLAGS += $(LIB_CFLAGS)
LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathutildir) -lmpathutil -L$(mpathcmddir) -lmpathcmd \
-lurcu -laio $(SYSTEMD_LIBDEPS)
-ifneq ($(call check_func,dm_task_no_flush,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_FLUSH
-endif
-
-ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_GET_ERRNO
-endif
-
-ifneq ($(call check_func,dm_task_set_cookie,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_COOKIE
-endif
-
-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,$(libudev_incdir)/libudev.h),0)
- CPPFLAGS += -DLIBUDEV_API_RECVBUF
-endif
-
-ifneq ($(call check_func,dm_task_deferred_remove,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_DEFERRED
-endif
-
-ifneq ($(call check_func,dm_hold_control_dev,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_HOLD_CONTROL
-endif
-
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
- CPPFLAGS += -DFPIN_EVENT_HANDLER
-endif
-
# object files referencing MULTIPATH_DIR or CONFIG_DIR
# they need to be recompiled for unit tests
OBJS-U := prio.o checkers.o foreign.o config.o
@@ -97,7 +69,7 @@ uninstall:
$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
+ $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
diff --git a/libmultipath/devmapper.h b/libmultipath/devmapper.h
index 703f3bf8..42f8eccd 100644
--- a/libmultipath/devmapper.h
+++ b/libmultipath/devmapper.h
@@ -1,6 +1,6 @@
#ifndef _DEVMAPPER_H
#define _DEVMAPPER_H
-
+#include "autoconfig.h"
#include "structs.h"
#define TGT_MPATH "multipath"
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index aa93fe43..6fc77315 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <inttypes.h>
#include <libudev.h>
+#include "autoconfig.h"
#include "mpath_cmd.h"
#include "dict.h"
#include "strbuf.h"
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index 72eefe49..a699e8a6 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -26,7 +26,7 @@ LIBS = \
libpriopath_latency.so \
libpriosysfs.so
-ifneq ($(call check_file,$(kernel_incdir)/linux/nvme_ioctl.h),0)
+ifneq ($(ANA_SUPPORT),1)
LIBS += libprioana.so
CPPFLAGS += -I../nvme
endif
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index d4f19897..d1d5cc25 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -5,6 +5,7 @@
*/
#include <stdio.h>
+#include "autoconfig.h"
#include "nvme-lib.h"
#include "checkers.h"
#include "vector.h"
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 57447ca0..bbc8e9e5 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -42,6 +42,7 @@
#include <sys/time.h>
#include <libudev.h>
+#include "autoconfig.h"
#include "debug.h"
#include "list.h"
#include "uevent.h"
diff --git a/multipathd/Makefile b/multipathd/Makefile
index bb8f7770..587bb916 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -8,17 +8,6 @@ CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathpersistdir) -I$(mpathcm
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }') \
-DBINDIR='"$(bindir)"' $(SYSTEMD_CPPFLAGS)
-ifeq ($(ENABLE_DMEVENTS_POLL),0)
- CPPFLAGS += -DNO_DMEVENTS_POLL
-endif
-ifneq ($(call check_func,dm_task_get_errno,$(devmapper_incdir)/libdevmapper.h),0)
- CPPFLAGS += -DLIBDM_API_GET_ERRNO
-endif
-ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,$(kernel_incdir)/scsi/fc/fc_els.h),0)
- CPPFLAGS += -DFPIN_EVENT_HANDLER
- FPIN_SUPPORT = 1
-endif
-
#
# debugging stuff
#
diff --git a/multipathd/fpin.h b/multipathd/fpin.h
index bfcc1ce2..3c374441 100644
--- a/multipathd/fpin.h
+++ b/multipathd/fpin.h
@@ -1,5 +1,6 @@
#ifndef __FPIN_H__
#define __FPIN_H__
+#include "autoconfig.h"
#ifdef FPIN_EVENT_HANDLER
void *fpin_fabric_notification_receiver(void *unused);
diff --git a/multipathd/main.c b/multipathd/main.c
index ba52d393..1e1b254f 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -4,6 +4,7 @@
* Copyright (c) 2005 Benjamin Marzinski, Redhat
* Copyright (c) 2005 Edward Goggin, EMC
*/
+#include "autoconfig.h"
#include <unistd.h>
#include <sys/stat.h>
#include <libdevmapper.h>
diff --git a/rules.mk b/rules.mk
index c1d80820..d8612527 100644
--- a/rules.mk
+++ b/rules.mk
@@ -13,3 +13,6 @@ $(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
+
+$(TOPDIR)/config.mk $(multipathdir)/autoconfig.h:
+ $(MAKE) -C $(TOPDIR) -f create-config.mk
diff --git a/tests/Makefile b/tests/Makefile
index 3a5b161c..d9856d17 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,14 +3,6 @@ include ../Makefile.inc
# directory where to run the tests
TESTDIR := $(CURDIR)
-# Test special behavior of gcc 4.8 with nested initializers
-# gcc 4.8 compiles blacklist.c only with -Wno-missing-field-initializers
-TEST_MISSING_INITIALIZERS = $(shell \
- echo 'struct A {int a, b;}; struct B {struct A a; int b;} b = {.a.a=1};' | \
- $(CC) -c -Werror -Wmissing-field-initializers -o /dev/null -xc - >/dev/null 2>&1 \
- || echo -Wno-missing-field-initializers)
-W_MISSING_INITIALIZERS := $(call TEST_MISSING_INITIALIZERS)
-
CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir) -I$(daemondir) \
-DTESTCONFDIR=\"$(TESTDIR)/conf.d\"
CFLAGS += $(BIN_CFLAGS) -Wno-unused-parameter $(W_MISSING_INITIALIZERS)

View File

@ -14,10 +14,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f3fccedd..c883fd02 100644
index 67ac0e6d..7fdbc1c3 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1176,13 +1176,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
@@ -1177,13 +1177,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
good_len = 8;
break;
case 2:
@ -33,7 +33,7 @@ index f3fccedd..c883fd02 100644
good_len = 8;
break;
default:
@@ -1200,10 +1196,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
@@ -1201,10 +1197,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
break;
case 0x8:
/* SCSI Name: Prio 3 */

View File

@ -1,879 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 12:39:06 +0200
Subject: [PATCH] multipath-tools Makefiles: enable quiet build
Like many other projects, make it possible to print much less
output during build. Verbose output is enabled with "make V=1", as
usual.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile | 12 +++----
Makefile.inc | 10 +++---
kpartx/Makefile | 41 ++++++++++++-----------
libdmmp/Makefile | 48 +++++++++++++-------------
libdmmp/test/Makefile | 8 ++---
libmpathcmd/Makefile | 20 +++++------
libmpathpersist/Makefile | 32 +++++++++---------
libmpathutil/Makefile | 14 ++++----
libmpathvalid/Makefile | 20 +++++------
libmultipath/Makefile | 30 ++++++++---------
libmultipath/checkers/Makefile | 8 ++---
libmultipath/foreign/Makefile | 8 ++---
libmultipath/prioritizers/Makefile | 8 ++---
mpathpersist/Makefile | 18 +++++-----
multipath/Makefile | 54 ++++++++++++++++--------------
multipathd/Makefile | 42 ++++++++++++-----------
rules.mk | 8 ++---
tests/Makefile | 23 +++++++------
18 files changed, 206 insertions(+), 198 deletions(-)
diff --git a/Makefile b/Makefile
index 1b28db62..e3ce1a8d 100644
--- a/Makefile
+++ b/Makefile
@@ -38,17 +38,17 @@ config.mk libmultipath/autoconfig.h:
@cat libmultipath/autoconfig.h
$(BUILDDIRS): config.mk
- $(MAKE) -C $@
+ @$(MAKE) -C $@
$(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
- $(MAKE) -C ${@:.abi=} abi
+ @$(MAKE) -C ${@:.abi=} abi
# Create formal representation of the ABI
# Useful for verifying ABI compatibility
# Requires abidw from the abigail suite (https://sourceware.org/libabigail/)
.PHONY: abi
abi: $(LIB_BUILDDIRS:=.abi)
- mkdir -p $@
+ @mkdir -p $@
ln -ft $@ $(LIB_BUILDDIRS:=/*.abi)
abi.tar.gz: abi
@@ -91,13 +91,13 @@ libmultipath/checkers.install \
libmultipath/foreign.install: libmultipath.install
%.clean:
- $(MAKE) -C ${@:.clean=} clean
+ @$(MAKE) -C ${@:.clean=} clean
%.install: %
- $(MAKE) -C ${@:.install=} install
+ @$(MAKE) -C ${@:.install=} install
$(BUILDDIRS:=.uninstall):
- $(MAKE) -C ${@:.uninstall=} uninstall
+ @$(MAKE) -C ${@:.uninstall=} uninstall
# If config.mk is missing, "make clean" in subdir either fails, or tries to
# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
diff --git a/Makefile.inc b/Makefile.inc
index 415634f5..3e14cb8c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1,4 +1,4 @@
-#
+# -*- Makefile -*-
# Copyright (C) 2004 Christophe Varoqui, <christophe.varoqui@opensvc.com>
#
@@ -60,6 +60,8 @@ devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/
libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
kernel_incdir := /usr/include
+Q := $(if $(V),,@)
+
GZIP_PROG := gzip -9 -c
RM := rm -f
LN := ln -sf
@@ -104,13 +106,13 @@ NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
%.o: %.c
@echo building $@ because of $?
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
%.abi: %.so.0
- abidw $< >$@
+ $(Q)abidw $< >$@
%.abi: %.so
- abidw $< >$@
+ $(Q)abidw $< >$@
%-nv.version: %.version
@echo creating $@ from $<
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 31b1138a..7720a740 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -16,33 +16,34 @@ OBJS := bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
all: $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
install: $(EXEC) $(EXEC).8
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
- $(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d
- $(INSTALL_PROGRAM) -m 644 dm-parts.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
- $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
- $(INSTALL_PROGRAM) -m 644 del-part-nodes.rules $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)/rules.d
+ $(Q)$(INSTALL_PROGRAM) -m 644 dm-parts.rules $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
+ $(Q)$(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
+ $(Q)$(INSTALL_PROGRAM) -m 644 del-part-nodes.rules $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
- $(RM) $(DESTDIR)$(libudevdir)/kpartx_id
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/kpartx_id
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/11-dm-parts.rules
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/66-kpartx.rules
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/67-kpartx-compat.rules
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/68-del-part-nodes.rules
clean: dep_clean
- $(RM) core *.o $(EXEC)
+ $(Q)$(RM) core *.o $(EXEC)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index 67b6f86f..7693facb 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -23,62 +23,62 @@ all: $(LIBS) doc
.PHONY: doc clean install uninstall check speed_test dep_clean
$(LIBS): $(OBJS)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+ $(Q)$(LN) $(LIBS) $@
abi: $(DEVLIB:%.so=%.abi)
install:
- mkdir -p $(DESTDIR)$(usrlibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 644 -D \
+ @mkdir -p $(DESTDIR)$(usrlibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
+ $(Q)$(INSTALL_PROGRAM) -m 644 -D \
$(HEADERS) $(DESTDIR)$(includedir)/$(HEADERS)
- $(LN) $(LIBS) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 644 -D \
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -m 644 -D \
$(PKGFILE).in $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- perl -i -pe 's|__VERSION__|$(LIBDMMP_VERSION)|g' \
+ $(Q)perl -i -pe 's|__VERSION__|$(LIBDMMP_VERSION)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- perl -i -pe 's|__LIBDIR__|$(usrlibdir)|g' \
+ $(Q)perl -i -pe 's|__LIBDIR__|$(usrlibdir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
+ $(Q)perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
- $(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3
+ $(Q)$(INSTALL_PROGRAM) -d 755 $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 644 -t $(DESTDIR)$(mandir)/man3 docs/man/*.3
uninstall:
- $(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(includedir)/$(HEADERS)
- $(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(includedir)/$(HEADERS)
+ $(Q)$(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
@for file in $(DESTDIR)$(mandir)/man3/dmmp_*; do \
$(RM) $$file; \
done
- $(RM) $(DESTDIR)$(mandir)/man3/libdmmp.h*
- $(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man3/libdmmp.h*
+ $(Q)$(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
- $(MAKE) -C test clean
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ @$(MAKE) -C test clean
include $(wildcard $(OBJS:.o=.d))
check: all
- $(MAKE) -C test check
+ @$(MAKE) -C test check
speed_test: all
- $(MAKE) -C test speed_test
+ @$(MAKE) -C test speed_test
doc: docs/man/dmmp_strerror.3
docs/man/dmmp_strerror.3: $(HEADERS)
- TEMPFILE=$(shell mktemp); \
+ $(Q)TEMPFILE=$(shell mktemp); \
cat $^ | perl docs/doc-preclean.pl >$$TEMPFILE; \
LC_ALL=C \
KBUILD_BUILD_TIMESTAMP=`git log -n1 --pretty=%cd --date=iso -- $^` \
perl docs/kernel-doc -man $$TEMPFILE | \
perl docs/split-man.pl docs/man; \
- rm -f $$TEMPFILE
+ $(RM) -f $$TEMPFILE
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libdmmp/test/Makefile b/libdmmp/test/Makefile
index 93de64a0..9d0817c8 100644
--- a/libdmmp/test/Makefile
+++ b/libdmmp/test/Makefile
@@ -16,7 +16,7 @@ LDFLAGS += -L$(_libdmmpdir) -ldmmp
all: $(TEST_EXEC) $(SPD_TEST_EXEC)
check: $(TEST_EXEC) $(SPD_TEST_EXEC)
- sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
+ $(Q)sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
valgrind --quiet --leak-check=full \
--show-reachable=no --show-possibly-lost=no \
--trace-children=yes --error-exitcode=1 \
@@ -24,15 +24,15 @@ check: $(TEST_EXEC) $(SPD_TEST_EXEC)
$(MAKE) speed_test
speed_test: $(SPD_TEST_EXEC)
- sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
+ $(Q)sudo env LD_LIBRARY_PATH=$(_libdmmpdir):$(_mpathcmddir) \
time -p ./$(SPD_TEST_EXEC)
clean: dep_clean
- rm -f $(TEST_EXEC) $(SPD_TEST_EXEC)
+ $(Q)$(RM) -f $(TEST_EXEC) $(SPD_TEST_EXEC)
OBJS = $(TEST_EXEC).o $(SPD_TEST_EXEC).o
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
index cfb202b8..be615c2f 100644
--- a/libmpathcmd/Makefile
+++ b/libmpathcmd/Makefile
@@ -9,22 +9,22 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(includedir)
- $(INSTALL_PROGRAM) -m 644 mpath_cmd.h $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_cmd.h $(DESTDIR)$(includedir)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(RM) $(DESTDIR)$(includedir)/mpath_cmd.h
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(includedir)/mpath_cmd.h
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
index 94672556..8f9a43f6 100644
--- a/libmpathpersist/Makefile
+++ b/libmpathpersist/Makefile
@@ -12,28 +12,28 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(mandir)/man3
- $(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_in.3 $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_persistent_reserve_out.3 $(DESTDIR)$(mandir)/man3
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_persist.h $(DESTDIR)$(includedir)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_in.3
- $(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_out.3
- $(RM) $(DESTDIR)$(includedir)/mpath_persist.h
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_in.3
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man3/mpath_persistent_reserve_out.3
+ $(Q)$(RM) $(DESTDIR)$(includedir)/mpath_persist.h
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathutil/Makefile b/libmpathutil/Makefile
index 5ab33c09..f059de14 100644
--- a/libmpathutil/Makefile
+++ b/libmpathutil/Makefile
@@ -20,18 +20,18 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
index 88034df3..791a0398 100644
--- a/libmpathvalid/Makefile
+++ b/libmpathvalid/Makefile
@@ -13,21 +13,21 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
install: $(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
- $(INSTALL_PROGRAM) -m 644 mpath_valid.h $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpath_valid.h $(DESTDIR)$(includedir)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
- $(RM) $(DESTDIR)$(includedir)/mpath_valid.h
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(includedir)/mpath_valid.h
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 1cc13577..3df851e2 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -31,47 +31,47 @@ all: $(DEVLIB)
include $(TOPDIR)/rules.mk
nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-function -c -o $@ $<
# there are lots of "unused parameters" in dict.c
# because not all handler / snprint methods need all parameters
dict.o: dict.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
make_static = $(shell sed '/^static/!s/^\([a-z]\{1,\} \)/static \1/' <$1 >$2)
nvme-ioctl.c: nvme/nvme-ioctl.c
- $(call make_static,$<,$@)
+ $(Q)$(call make_static,$<,$@)
nvme-ioctl.h: nvme/nvme-ioctl.h
- $(call make_static,$<,$@)
+ $(Q)$(call make_static,$<,$@)
../tests/$(LIBS): $(OBJS-O) $(OBJS-T) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=`basename $@` \
-o $@ $(OBJS-O) $(OBJS-T) $(LIBDEPS)
- $(LN) $@ ${@:.so.0=.so}
+ $(Q)$(LN) $@ ${@:.so.0=.so}
# This rule is invoked from tests/Makefile, overriding configdir and plugindir
%-test.o: %.c
@echo building $@ because of $?
- $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
test-lib: ../tests/$(LIBS)
install: all
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(plugindir)
- $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(plugindir)
+ $(Q)$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
uninstall:
- $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
- $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+ $(Q)$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
clean: dep_clean
- $(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
+ $(Q)$(RM) core *.a *.o *.so *.so.* *.abi nvme-ioctl.c nvme-ioctl.h autoconfig.h $(NV_VERSION_SCRIPT)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index 39ad76e0..b3120611 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -22,16 +22,16 @@ LIBS= \
all: $(LIBS)
libcheck%.so: %.o
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
- $(RM) core *.a *.o *.gz *.so
+ $(Q)$(RM) core *.a *.o *.gz *.so
OBJS := $(LIBS:libcheck%.so=%.o)
.SECONDARY: $(OBJS)
@@ -39,4 +39,4 @@ OBJS := $(LIBS:libcheck%.so=%.o)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile
index 8bf9047b..0e245d6f 100644
--- a/libmultipath/foreign/Makefile
+++ b/libmultipath/foreign/Makefile
@@ -14,16 +14,16 @@ LIBS = libforeign-nvme.so
all: $(LIBS)
libforeign-%.so: %.o
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
- $(RM) core *.a *.o *.gz *.so
+ $(Q)$(RM) core *.a *.o *.gz *.so
OBJS := $(LIBS:libforeign-%.so=%.o)
.SECONDARY: $(OBJS)
@@ -31,4 +31,4 @@ OBJS := $(LIBS:libforeign-%.so=%.o)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index a699e8a6..e1688163 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -34,16 +34,16 @@ endif
all: $(LIBS)
libprio%.so: %.o
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^ $(LIBDEPS)
install: $(LIBS)
- $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
uninstall:
for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
- $(RM) core *.a *.o *.gz *.so
+ $(Q)$(RM) core *.a *.o *.gz *.so
OBJS = $(LIBS:libprio%.so=%.o) alua_rtpg.o
.SECONDARY: $(OBJS)
@@ -51,4 +51,4 @@ OBJS = $(LIBS:libprio%.so=%.o) alua_rtpg.o
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/mpathpersist/Makefile b/mpathpersist/Makefile
index d62537b5..f57c105c 100644
--- a/mpathpersist/Makefile
+++ b/mpathpersist/Makefile
@@ -14,22 +14,22 @@ OBJS = main.o
all: $(EXEC)
$(EXEC): $(OBJS)
- $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(CFLAGS) $(LIBDEPS)
+ $(Q)$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(CFLAGS) $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
clean: dep_clean
- $(RM) core *.o $(EXEC)
+ $(Q)$(RM) core *.o $(EXEC)
include $(wildcard $(OBJS:.o=.d))
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/multipath/Makefile b/multipath/Makefile
index 7f7b341d..73db991a 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -16,44 +16,46 @@ OBJS := main.o
all: $(EXEC) multipath.rules tmpfiles.conf
$(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
- $(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS) $(LIBDEPS)
install:
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
- $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
- $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir)
- $(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir)
- $(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
- $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 modules-load.conf $(DESTDIR)$(modulesloaddir)/multipath.conf
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
ifneq ($(SCSI_DH_MODULES_PRELOAD),)
- $(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
- for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
+ $(Q)$(INSTALL_PROGRAM) -m 644 scsi_dh.conf $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
+ $(Q)for _x in $(SCSI_DH_MODULES_PRELOAD); do echo "$$_x"; done \
>>$(DESTDIR)$(modulesloaddir)/scsi_dh.conf
endif
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC)
- $(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
- $(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
- $(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
- $(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
- $(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
+ $(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
+ $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
+ $(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
clean: dep_clean
- $(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf
+ $(Q)$(RM) core *.o $(EXEC) multipath.rules tmpfiles.conf
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
%: %.in
- sed 's,@RUNTIME_DIR@,$(runtimedir),' $< >$@
+ @echo creating $@
+ $(Q)sed 's,@RUNTIME_DIR@,$(runtimedir),' $< >$@
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 587bb916..9d531329 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -45,41 +45,43 @@ endif
all : $(EXEC) $(CLI)
$(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
- $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) $(LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) $(LIBDEPS)
multipathc.o: multipathc.c
- $(CC) $(CPPFLAGS) $(RL_CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(RL_CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
$(CLI): $(CLI_OBJS)
- $(CC) $(CFLAGS) $(CLI_OBJS) $(LDFLAGS) -o $@ $(CLI_LIBDEPS) $(RL_LIBDEPS)
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CFLAGS) $(CLI_OBJS) $(LDFLAGS) -o $@ $(CLI_LIBDEPS) $(RL_LIBDEPS)
cli_handlers.o: cli_handlers.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter -c -o $@ $<
install:
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
- $(INSTALL_PROGRAM) -m 755 $(CLI) $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
+ $(Q)$(INSTALL_PROGRAM) -m 755 $(CLI) $(DESTDIR)$(bindir)
ifdef SYSTEMD
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).socket $(DESTDIR)$(unitdir)
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).socket $(DESTDIR)$(unitdir)
endif
- $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
- $(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
+ $(Q)$(INSTALL_PROGRAM) -m 644 $(CLI).8 $(DESTDIR)$(mandir)/man8
uninstall:
- $(RM) $(DESTDIR)$(bindir)/$(EXEC) $(DESTDIR)$(bindir)/$(CLI)
- $(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
- $(RM) $(DESTDIR)$(mandir)/man8/$(CLI).8
- $(RM) $(DESTDIR)$(unitdir)/$(EXEC).service
- $(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket
+ $(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC) $(DESTDIR)$(bindir)/$(CLI)
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(CLI).8
+ $(Q)$(RM) $(DESTDIR)$(unitdir)/$(EXEC).service
+ $(Q)$(RM) $(DESTDIR)$(unitdir)/$(EXEC).socket
clean: dep_clean
- $(RM) core *.o $(EXEC) $(CLI)
+ $(Q)$(RM) core *.o $(EXEC) $(CLI)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
diff --git a/rules.mk b/rules.mk
index d8612527..c3a8e7ac 100644
--- a/rules.mk
+++ b/rules.mk
@@ -2,17 +2,17 @@
# SPDX-License-Identifier: GPL-2.0-or-later
$(DEVLIB): $(LIBS)
- $(LN) $(LIBS) $@
+ $(Q)$(LN) $(LIBS) $@
$(LIBS): $(OBJS) $(VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
$(LIBS:%.so.$(SONAME)=%-nv.so): $(OBJS) $(NV_VERSION_SCRIPT)
- $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
+ $(Q)$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ \
-Wl,--version-script=$(NV_VERSION_SCRIPT) -o $@ $(OBJS) $(LIBDEPS)
abi: $(LIBS:%.so.$(SONAME)=%-nv.abi)
$(TOPDIR)/config.mk $(multipathdir)/autoconfig.h:
- $(MAKE) -C $(TOPDIR) -f create-config.mk
+ $(Q)$(MAKE) -C $(TOPDIR) -f create-config.mk
diff --git a/tests/Makefile b/tests/Makefile
index d9856d17..021da0b0 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -12,7 +12,6 @@ TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \
alias directio valid devt mpathvalid strbuf sysfs features cli
HELPERS := test-lib.o test-log.o
-.SILENT: $(TESTS:%=%.o)
.PRECIOUS: $(TESTS:%=%-test)
all: $(TESTS:%=%.out)
@@ -71,11 +70,12 @@ features-test_LIBDEPS := -ludev -lpthread
cli-test_OBJDEPS := $(daemondir)/cli.o
%.o: %.c
- $(CC) $(CPPFLAGS) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $<
+ @echo building $@ because of $?
+ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $<
lib/libchecktur.so:
- mkdir -p lib
- cd lib && ln -s ../$(multipathdir)/*/*.so .
+ @mkdir -p lib
+ $(Q)cd lib && ln -s ../$(multipathdir)/*/*.so .
%.out: %-test lib/libchecktur.so
@echo == running $< ==
@@ -89,34 +89,35 @@ lib/libchecktur.so:
OBJS = $(TESTS:%=%.o) $(HELPERS)
test_clean:
- $(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so*
+ $(Q)$(RM) $(TESTS:%=%.out) $(TESTS:%=%.vgr) *.so*
valgrind_clean:
- $(RM) $(TESTS:%=%.vgr)
+ $(Q)$(RM) $(TESTS:%=%.vgr)
clean: test_clean valgrind_clean dep_clean
- $(RM) $(TESTS:%=%-test) $(OBJS) *.o.wrap
- $(RM) -rf lib conf.d
+ $(Q)$(RM) $(TESTS:%=%-test) $(OBJS) *.o.wrap
+ $(Q)$(RM) -rf lib conf.d
.SECONDARY: $(OBJS)
include $(wildcard $(OBJS:.o=.d))
dep_clean:
- $(RM) $(OBJS:.o=.d)
+ $(Q)$(RM) $(OBJS:.o=.d)
%.o.wrap: %.c
@sed -n 's/^.*__wrap_\([a-zA-Z0-9_]*\).*$$/-Wl,--wrap=\1/p' $< | \
sort -u | tr '\n' ' ' >$@
libmultipath.so.0: $(multipathdir)/libmultipath.so.0
- make -C $(multipathdir) configdir=$(TESTDIR)/conf.d plugindir=$(TESTDIR)/lib test-lib
+ @make -C $(multipathdir) configdir=$(TESTDIR)/conf.d plugindir=$(TESTDIR)/lib test-lib
# COLON will get expanded during second expansion below
COLON:=:
.SECONDEXPANSION:
%-test: %.o %.o.wrap $$($$@_OBJDEPS) $$($$@_TESTDEPS) $$($$@_TESTDEPS$$(COLON).o=.o.wrap) \
libmultipath.so.0 $(mpathutildir)/libmpathutil.so.0 $(mpathcmddir)/libmpathcmd.so.0 Makefile
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \
+ @echo building $@
+ $(Q)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \
$(LIBDEPS) $($@_LIBDEPS) \
$(shell cat $<.wrap) $(foreach dep,$($@_TESTDEPS),$(shell cat $(dep).wrap))

View File

@ -11,7 +11,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index e6e7f7d7..15f0b9f6 100644
index 748911e2..c07bcb0c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -16,7 +16,7 @@ READLINE :=

View File

@ -1,183 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 14:39:22 +0200
Subject: [PATCH] multipath-tools: quiet build support for top-level Makefile
This requires including "Makefile.inc" in the top-level Makefile,
too.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile | 32 ++++++++++++++++++------------
Makefile.inc | 8 ++++++--
create-config.mk | 1 -
libmultipath/checkers/Makefile | 2 +-
libmultipath/foreign/Makefile | 2 +-
libmultipath/prioritizers/Makefile | 2 +-
6 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index e3ce1a8d..b9e30234 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,9 @@
# Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@opensvc.com>
#
+TOPDIR := .
+include Makefile.inc
+
LIB_BUILDDIRS := \
libmpathcmd \
libmpathutil \
@@ -32,10 +35,12 @@ all: $(BUILDDIRS)
config.mk libmultipath/autoconfig.h:
@$(MAKE) -f create-config.mk
+ifeq ($(V),1)
@echo ==== config.mk ====
@cat config.mk
@echo ==== autoconfig.h ====
@cat libmultipath/autoconfig.h
+endif
$(BUILDDIRS): config.mk
@$(MAKE) -C $@
@@ -48,11 +53,12 @@ $(LIB_BUILDDIRS:=.abi): $(LIB_BUILDDIRS)
# Requires abidw from the abigail suite (https://sourceware.org/libabigail/)
.PHONY: abi
abi: $(LIB_BUILDDIRS:=.abi)
+ @echo creating abi
@mkdir -p $@
- ln -ft $@ $(LIB_BUILDDIRS:=/*.abi)
+ $(Q)ln -ft $@ $(LIB_BUILDDIRS:=/*.abi)
abi.tar.gz: abi
- tar cfz $@ abi
+ $(Q)tar cfz $@ abi
# Check the ABI against a reference.
# This requires the ABI from a previous run to be present
@@ -77,8 +83,8 @@ abi-test: abi reference-abi $(wildcard abi/*.abi)
# Create compile_commands.json, useful for using clangd with an IDE
# Requires bear (https://github.com/rizsotto/Bear)
compile_commands.json: Makefile Makefile.inc $(BUILDDIRS:=/Makefile)
- $(MAKE) clean
- bear -- $(MAKE)
+ $(Q)$(MAKE) clean
+ $(Q)bear -- $(MAKE)
libmpathutil libdmmp: libmpathcmd
libmultipath: libmpathutil
@@ -103,24 +109,24 @@ $(BUILDDIRS:=.uninstall):
# build it. Both is undesirable. Avoid it by creating config.mk temporarily.
clean:
@touch config.mk
- $(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
- rm -rf abi abi.tar.gz abi-test compile_commands.json config.mk
+ $(Q)$(MAKE) $(BUILDDIRS:=.clean) tests.clean || true
+ $(Q)$(RM) -r abi abi.tar.gz abi-test compile_commands.json config.mk
install: $(BUILDDIRS:=.install)
uninstall: $(BUILDDIRS:=.uninstall)
test-progs: all
- $(MAKE) -C tests progs
+ @$(MAKE) -C tests progs
test: all
- $(MAKE) -C tests all
+ @$(MAKE) -C tests all
valgrind-test: all
- $(MAKE) -C tests valgrind
+ @$(MAKE) -C tests valgrind
.PHONY: TAGS
TAGS:
- etags -a libmultipath/*.c
- etags -a libmultipath/*.h
- etags -a multipathd/*.c
- etags -a multipathd/*.h
+ @etags -a libmultipath/*.c
+ @etags -a libmultipath/*.h
+ @etags -a multipathd/*.c
+ @etags -a multipathd/*.h
diff --git a/Makefile.inc b/Makefile.inc
index 3e14cb8c..866ab274 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -27,7 +27,7 @@ PKGCONFIG ?= pkg-config
ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-ifneq ($(CREATE_CONFIG),1)
+ifneq ($(TOPDIR),.)
include $(TOPDIR)/config.mk
endif
@@ -60,7 +60,11 @@ devmapper_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir devmapper),/
libudev_incdir := $(or $(shell $(PKGCONFIG) --variable=includedir libudev),/usr/include)
kernel_incdir := /usr/include
-Q := $(if $(V),,@)
+ifeq ($(V),)
+Q := @
+# make's "Entering directory" messages are confusing in parallel mode
+#MAKEFLAGS = --no-print-directory
+endif
GZIP_PROG := gzip -9 -c
RM := rm -f
diff --git a/create-config.mk b/create-config.mk
index 2cc5284f..434dee06 100644
--- a/create-config.mk
+++ b/create-config.mk
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: GPL-2.0-or-later
TOPDIR := .
-CREATE_CONFIG := 1
include $(TOPDIR)/Makefile.inc
# Check whether a function with name $1 has been declared in header file $2.
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index b3120611..6f7cfb95 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -28,7 +28,7 @@ install:
$(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
+ $(Q)for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(Q)$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/foreign/Makefile b/libmultipath/foreign/Makefile
index 0e245d6f..b83213d6 100644
--- a/libmultipath/foreign/Makefile
+++ b/libmultipath/foreign/Makefile
@@ -20,7 +20,7 @@ install:
$(Q)$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
+ $(Q)for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(Q)$(RM) core *.a *.o *.gz *.so
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index e1688163..fdec36e7 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -40,7 +40,7 @@ install: $(LIBS)
$(Q)$(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(plugindir)
uninstall:
- for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
+ $(Q)for file in $(LIBS); do $(RM) $(DESTDIR)$(plugindir)/$$file; done
clean: dep_clean
$(Q)$(RM) core *.a *.o *.gz *.so

View File

@ -1,132 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 15:29:51 +0200
Subject: [PATCH] GitHub workflows: use make -j8 -Orecurse
Without -Orecurse, quiet make output is confusing in parallel mode
because make prints "Entering directory" and "Leaving directory"
messages before and after every target.
Use parallel compilation also in native.yaml and foreign.yaml.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
.github/workflows/abi.yaml | 2 +-
.github/workflows/build-and-unittest.yaml | 18 +++++++++---------
.github/workflows/coverity.yaml | 2 +-
.github/workflows/foreign.yaml | 4 ++--
.github/workflows/native.yaml | 6 +++---
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/.github/workflows/abi.yaml b/.github/workflows/abi.yaml
index 89b971cd..644fcb62 100644
--- a/.github/workflows/abi.yaml
+++ b/.github/workflows/abi.yaml
@@ -32,7 +32,7 @@ jobs:
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: create ABI
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) abi.tar.gz
- name: save ABI
uses: actions/upload-artifact@v1
with:
diff --git a/.github/workflows/build-and-unittest.yaml b/.github/workflows/build-and-unittest.yaml
index a5a0717d..8b6bb776 100644
--- a/.github/workflows/build-and-unittest.yaml
+++ b/.github/workflows/build-and-unittest.yaml
@@ -32,11 +32,11 @@ jobs:
libdevmapper-dev libreadline-dev libaio-dev libsystemd-dev
libudev-dev libjson-c-dev liburcu-dev libcmocka-dev libedit-dev
- name: build
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) test
- name: valgrind-test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
- name: valgrind-results
run: cat tests/*.vgr
- name: clean-nonroot-artifacts
@@ -65,11 +65,11 @@ jobs:
- name: set CC
run: echo CC=gcc-10 >> $GITHUB_ENV
- name: build
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) test
- name: valgrind-test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
- name: valgrind-results
run: cat tests/*.vgr
- name: clean-nonroot-artifacts
@@ -98,11 +98,11 @@ jobs:
- name: set CC
run: echo CC=clang >> $GITHUB_ENV
- name: build
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) READLINE=${{ matrix.rl }}
- name: test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) test
- name: valgrind-test
- run: make -O -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
+ run: make -Orecurse -j$(grep -c ^processor /proc/cpuinfo) valgrind-test
- name: valgrind-results
run: cat tests/*.vgr
- name: clean-nonroot-artifacts
diff --git a/.github/workflows/coverity.yaml b/.github/workflows/coverity.yaml
index 3c6b3824..321b94e0 100644
--- a/.github/workflows/coverity.yaml
+++ b/.github/workflows/coverity.yaml
@@ -32,7 +32,7 @@ jobs:
- name: build with cov-build
run: >
PATH="$PWD/coverity/bin:$PATH"
- cov-build --dir cov-int make -O -j"$(grep -c ^processor /proc/cpuinfo)"
+ cov-build --dir cov-int make -Orecurse -j"$(grep -c ^processor /proc/cpuinfo)"
- name: pack results
run: tar cfz multipath-tools.tgz cov-int
- name: submit results
diff --git a/.github/workflows/foreign.yaml b/.github/workflows/foreign.yaml
index 5a19913a..72ac24fb 100644
--- a/.github/workflows/foreign.yaml
+++ b/.github/workflows/foreign.yaml
@@ -21,11 +21,11 @@ jobs:
uses: actions/checkout@v1
- name: build and test
if: ${{ matrix.arch == '' || matrix.arch == '-i386' }}
- run: make test
+ run: make -j8 -Orecurse test
- name: build
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
# The build path is different between builder and runner
- run: make TESTDIR=${{ github.workspace }}/tests test-progs
+ run: make -j8 -Orecurse TESTDIR=${{ github.workspace }}/tests test-progs
- name: archive
if: ${{ matrix.arch != '' && matrix.arch != '-i386' }}
run: >
diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml
index 8b599209..68bf0984 100644
--- a/.github/workflows/native.yaml
+++ b/.github/workflows/native.yaml
@@ -92,10 +92,10 @@ jobs:
- name: checkout
uses: actions/checkout@v1
- name: build and test
- run: make test
+ run: make -j8 -Orecurse test
- name: clean
- run: make clean
+ run: make -j8 -Orecurse clean
- name: clang
env:
CC: clang
- run: make test
+ run: make -j8 -Orecurse test

View File

@ -12,7 +12,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index 15f0b9f6..881c1d52 100644
index c07bcb0c..e59313c6 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -12,7 +12,7 @@

View File

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 15:40:16 +0200
Subject: [PATCH] README.md: Move section about libedit and libreadline
This paragraph belongs in the "Customiting build" section.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index d003e1db..52ab776b 100644
--- a/README.md
+++ b/README.md
@@ -53,14 +53,9 @@ Building multipath-tools
========================
Prerequisites: development packages of for `libdevmapper`, `libaio`, `libudev`,
-`libjson-c`, `liburcu`, and `libsystemd`.
-
-To enable commandline history and TAB completion in the interactive mode *(which
-is entered with `multipathd -k` or `multipathc`)* you might also set `READLINE`
-make variable to `libedit` or `libreadline`, like `make READLINE=libreadline`.
-That requires a development package for the library you chose. Note that using
-libreadline may [make binary indistributable due to license
-incompatibility](https://github.com/opensvc/multipath-tools/issues/36).
+`libjson-c`, `liburcu`, and `libsystemd`. If commandline editing is enabled
+(see below), the development package for either `libedit` or `libreadline` is
+required as well.
Then, build and install multipath-tools with:
@@ -82,6 +77,12 @@ The following variables can be passed to the `make` command line:
* `configdir="/some/path"` : directory to search for configuration files.
This used to be the run-time option `config_dir` in earlier versions.
The default is `/etc/multipath/conf.d`.
+ * `READLINE=libedit` or `READLINE=libreadline`: enable command line history
+ and TAB completion in the interactive mode *(which is entered with `multipathd -k` or `multipathc`)*.
+ The respective development package will be required for building.
+ By default, command line editing is disabled.
+ Note that using libreadline may
+ [make binary indistributable due to license incompatibility](https://github.com/opensvc/multipath-tools/issues/36).
* `ENABLE_LIBDMMP=0`: disable building libdmmp
* `ENABLE_DMEVENTS_POLL=0`: disable support for the device-mapper event
polling API. For use with pre-5.0 kernels that don't support dmevent polling

View File

@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 15:42:15 +0200
Subject: [PATCH] README.md: Fix indentation in paragraph about device handlers
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 52ab776b..b1b78fbb 100644
--- a/README.md
+++ b/README.md
@@ -94,12 +94,12 @@ The following variables can be passed to the `make` command line:
early. This option causes a *modules-load.d(5)* configuration file to be
created, thus it depends on functionality provided by *systemd*.
This variable only matters for `make install`.
-
-Note: The usefulness of the preload list depends on the kernel configuration.
-It's especially useful if `scsi_mod` is builtin but `scsi_dh_alua` and
-other device handler modules are built as modules. If `scsi_mod` itself is compiled
-as a module, it might make more sense to use a module softdep for the same
-purpose.
+
+ **Note**: The usefulness of the preload list depends on the kernel configuration.
+ It's especially useful if `scsi_mod` is builtin but `scsi_dh_alua` and
+ other device handler modules are built as modules. If `scsi_mod` itself is compiled
+ as a module, it might make more sense to use a module softdep for the same
+ purpose.
See `Makefile.inc` for additional variables to customize paths and compiler
flags.

View File

@ -1,47 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 16:01:17 +0200
Subject: [PATCH] README.md: document options for paths and optimization
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index b1b78fbb..ab7dc3c9 100644
--- a/README.md
+++ b/README.md
@@ -101,8 +101,29 @@ The following variables can be passed to the `make` command line:
as a module, it might make more sense to use a module softdep for the same
purpose.
-See `Makefile.inc` for additional variables to customize paths and compiler
-flags.
+### Installation Paths
+
+ * `prefix`: The directory prefix for (almost) all files to be installed.
+ Distributions may want to set this to `/usr`.
+ **Note**: for multipath-tools, unlike many other packages, `prefix`
+ defaults to the empty string, which resolves to the root directory (`/`).
+ * `usr_prefix`: where to install those parts of the code that aren't necessary
+ for booting. You may want to set this to `/usr` if `prefix` is empty.
+ * `systemd_prefix`: Prefix for systemd-related files. It defaults to `/usr`.
+ Some systemd installations use separate `prefix` and `rootprefix`. On such
+ a distribution, set `prefix`, and override `unitdir` to use systemd's
+ `rootprefix`.
+ * `LIB`: the subdirectory under `prefix` where shared libraries will be
+ installed. By default, the makefile uses `/lib64` if this directory is
+ found on the build system, and `/lib` otherwise.
+
+See also `configdir` and `plugindir` above. See `Makefile.inc` for more
+fine-grained control.
+
+### Compiler Options
+
+Use `OPTFLAGS` to change optimization-related compiler options;
+e.g. `OPTFLAGS="-g -O0"` to disable all optimizations.
Special Makefile targets
------------------------

View File

@ -1,37 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 16:01:41 +0200
Subject: [PATCH] README.md: document how to customize build
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
README.md | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/README.md b/README.md
index ab7dc3c9..bbeb44fe 100644
--- a/README.md
+++ b/README.md
@@ -66,9 +66,21 @@ To uninstall, type:
make uninstall
+By default, the build will run quietly, just printing one-line messages
+about the files being built. To enable more verbose output, run `make V=1`.
+
Customizing the build
---------------------
+**Note**: With very few exceptions, the build process does not read
+configuration from the environment. So using syntax like
+
+ SOME_VAR=some_value make
+
+will **not** have the intended effect. Use the following instead:
+
+ make SOME_VAR=some_value
+
The following variables can be passed to the `make` command line:
* `plugindir="/some/path"`: directory where libmultipath plugins (path

View File

@ -1,63 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 28 Oct 2022 21:10:41 +0200
Subject: [PATCH] libmultipath: avoid -Warray-bounds error with gcc 12 and musl
libc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The following error is observed with gcc 12, strangely only with
MUSL libc:
In function __uatomic_inc,
inlined from lock at ../libmultipath/lock.h:24:2,
inlined from child at main.c:3523:3,
inlined from main at main.c:3755:11:
/usr/include/urcu/uatomic/x86.h:439:17: error: array subscript struct __uatomic_dummy[0] is partly outside array bounds of unsigned char[72] [-Werror=array-bounds]
The problem is that &(vecs->lock.waiters) is casted to a pointer to
struct { long[10]; } which goes beyond the "struct vectors".
We don't read or write from/to that memory, but the compiler complains either
way.
latest liburcu has a patch for it:
http://git.liburcu.org/?p=userspace-rcu.git;a=commitdiff;h=835b9ab3ca3777fe42e37e92096226ebd19ca75b
For now, just disable the warning in lock.h, using a pragma.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reported-by: Xose Vasquez Perez <xose.vasquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/lock.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libmultipath/lock.h b/libmultipath/lock.h
index 20ca77e6..9814be76 100644
--- a/libmultipath/lock.h
+++ b/libmultipath/lock.h
@@ -13,6 +13,11 @@ struct mutex_lock {
int waiters; /* uatomic access only */
};
+#if !defined(__GLIBC__) && defined(__GNUC__) && __GNUC__ == 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+#endif
+
static inline void init_lock(struct mutex_lock *a)
{
pthread_mutex_init(&a->mutex, NULL);
@@ -46,6 +51,10 @@ static inline bool lock_has_waiters(struct mutex_lock *a)
return (uatomic_read(&a->waiters) > 0);
}
+#if !defined(__GLIBC__) && defined(__GNUC__) && __GNUC__ == 12
+#pragma GCC diagnostic pop
+#endif
+
#define lock_cleanup_pop(a) pthread_cleanup_pop(1)
void cleanup_lock (void * data);

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 27 Sep 2022 12:14:09 +0200
Subject: [PATCH] multipath: avoid NULL string in released_to_systemd()
Fixes: b28c406 ("multipath -u: don't grab devices already passed to system")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/multipath/main.c b/multipath/main.c
index 7b69a3ce..b9f360b4 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -435,7 +435,8 @@ static bool released_to_systemd(void)
bool ret;
ret = dm_mp_dev_path != NULL && !strcmp(dm_mp_dev_path, "0");
- condlog(4, "%s: %s=%s -> %d", __func__, dmdp, dm_mp_dev_path, ret);
+ condlog(4, "%s: %s=%s -> %d", __func__, dmdp,
+ dm_mp_dev_path ? dm_mp_dev_path : "", ret);
return ret;
}

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 27 Sep 2022 12:28:26 +0200
Subject: [PATCH] libmultipath: avoid NULL string in is_udev_ready()
Fixes: 2b25a9e ("libmultipath: select_action(): force udev reload for uninitialized maps")
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index e5249fc1..e551047a 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -662,7 +662,8 @@ static bool is_udev_ready(struct multipath *cmpp)
env = udev_device_get_property_value(mpp_ud, "MPATH_DEVICE_READY");
rc = (env != NULL && !strcmp(env, "1"));
udev_device_unref(mpp_ud);
- condlog(4, "%s: %s: \"%s\" -> %d\n", __func__, cmpp->alias, env, rc);
+ condlog(4, "%s: %s: \"%s\" -> %d\n", __func__, cmpp->alias,
+ env ? env : "", rc);
return rc;
}

View File

@ -1,115 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 9 Nov 2022 15:49:41 -0600
Subject: [PATCH] libmultipath: impove add_feature() variable names
Use descriptive names, instead of single letters. No functional changes.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs.c | 63 +++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 31 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 7a2ff589..f90bd0b6 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -604,65 +604,66 @@ first_path (const struct multipath * mpp)
return pgp?VECTOR_SLOT(pgp->paths, 0):NULL;
}
-int add_feature(char **f, const char *n)
+int add_feature(char **features_p, const char *new_feat)
{
- int c = 0, d, l;
- char *e, *t;
- const char *p;
+ int count = 0, new_count, len;
+ char *tmp, *feats;
+ const char *ptr;
- if (!f)
+ if (!features_p)
return 1;
/* Nothing to do */
- if (!n || *n == '\0')
+ if (!new_feat || *new_feat == '\0')
return 0;
- l = strlen(n);
- if (isspace(*n) || isspace(*(n + l - 1))) {
- condlog(0, "internal error: feature \"%s\" has leading or trailing spaces", n);
+ len = strlen(new_feat);
+ if (isspace(*new_feat) || isspace(*(new_feat + len - 1))) {
+ condlog(0, "internal error: feature \"%s\" has leading or trailing spaces",
+ new_feat);
return 1;
}
- p = n;
- d = 1;
- while (*p != '\0') {
- if (isspace(*p) && !isspace(*(p + 1)) && *(p + 1) != '\0')
- d++;
- p++;
+ ptr = new_feat;
+ new_count = 1;
+ while (*ptr != '\0') {
+ if (isspace(*ptr) && !isspace(*(ptr + 1)) && *(ptr + 1) != '\0')
+ new_count++;
+ ptr++;
}
/* default feature is null */
- if(!*f)
+ if(!*features_p)
{
- l = asprintf(&t, "%0d %s", d, n);
- if(l == -1)
+ len = asprintf(&feats, "%0d %s", new_count, new_feat);
+ if(len == -1)
return 1;
- *f = t;
+ *features_p = feats;
return 0;
}
/* Check if feature is already present */
- e = *f;
- while ((e = strstr(e, n)) != NULL) {
- if (isspace(*(e - 1)) &&
- (isspace(*(e + l)) || *(e + l) == '\0'))
+ tmp = *features_p;
+ while ((tmp = strstr(tmp, new_feat)) != NULL) {
+ if (isspace(*(tmp - 1)) &&
+ (isspace(*(tmp + len)) || *(tmp + len) == '\0'))
return 0;
- e += l;
+ tmp += len;
}
/* Get feature count */
- c = strtoul(*f, &e, 10);
- if (*f == e || (!isspace(*e) && *e != '\0')) {
- condlog(0, "parse error in feature string \"%s\"", *f);
+ count = strtoul(*features_p, &tmp, 10);
+ if (*features_p == tmp || (!isspace(*tmp) && *tmp != '\0')) {
+ condlog(0, "parse error in feature string \"%s\"", *features_p);
return 1;
}
- c += d;
- if (asprintf(&t, "%0d%s %s", c, e, n) < 0)
+ count += new_count;
+ if (asprintf(&feats, "%0d%s %s", count, tmp, new_feat) < 0)
return 1;
- free(*f);
- *f = t;
+ free(*features_p);
+ *features_p = feats;
return 0;
}

View File

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 9 Nov 2022 15:49:42 -0600
Subject: [PATCH] multipathd: don't initialize the field width in show_path()
It's not used, so don't set it up.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/cli_handlers.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 5f0dd04e..e65fb75c 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -67,12 +67,7 @@ static int
show_path (struct strbuf *reply, struct vectors *vecs, struct path *pp,
char *style)
{
- fieldwidth_t *width __attribute__((cleanup(cleanup_ucharp))) = NULL;
-
- if ((width = alloc_path_layout()) == NULL)
- return 1;
- get_path_layout(vecs->pathvec, 1, width);
- if (snprint_path(reply, style, pp, 0) < 0)
+ if (snprint_path(reply, style, pp, NULL) < 0)
return 1;
return 0;
}

View File

@ -1,144 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 9 Nov 2022 15:49:43 -0600
Subject: [PATCH] libmultipath: improve remove_feature() variable names
Use descriptive names, instead of single letters. No functional changes.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs.c | 80 +++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 40 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index f90bd0b6..87e84d5d 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -668,86 +668,86 @@ int add_feature(char **features_p, const char *new_feat)
return 0;
}
-int remove_feature(char **f, const char *o)
+int remove_feature(char **features_p, const char *old_feat)
{
- int c = 0, d;
- char *e, *p, *n;
- const char *q;
+ int count = 0, len;
+ char *feats_start, *ptr, *new;
- if (!f || !*f)
+ if (!features_p || !*features_p)
return 1;
/* Nothing to do */
- if (!o || *o == '\0')
+ if (!old_feat || *old_feat == '\0')
return 0;
- d = strlen(o);
- if (isspace(*o) || isspace(*(o + d - 1))) {
- condlog(0, "internal error: feature \"%s\" has leading or trailing spaces", o);
+ len = strlen(old_feat);
+ if (isspace(*old_feat) || isspace(*(old_feat + len - 1))) {
+ condlog(0, "internal error: feature \"%s\" has leading or trailing spaces",
+ old_feat);
return 1;
}
/* Check if present and not part of a larger feature token*/
- p = *f + 1; /* the size must be at the start of the features string */
- while ((p = strstr(p, o)) != NULL) {
- if (isspace(*(p - 1)) &&
- (isspace(*(p + d)) || *(p + d) == '\0'))
+ ptr = *features_p + 1;
+ while ((ptr = strstr(ptr, old_feat)) != NULL) {
+ if (isspace(*(ptr - 1)) &&
+ (isspace(*(ptr + len)) || *(ptr + len) == '\0'))
break;
- p += d;
+ ptr += len;
}
- if (!p)
+ if (!ptr)
return 0;
/* Get feature count */
- c = strtoul(*f, &e, 10);
- if (*f == e || !isspace(*e)) {
- condlog(0, "parse error in feature string \"%s\"", *f);
+ count = strtoul(*features_p, &feats_start, 10);
+ if (*features_p == feats_start || !isspace(*feats_start)) {
+ condlog(0, "parse error in feature string \"%s\"", *features_p);
return 1;
}
/* Update feature count */
- c--;
- q = o;
- while (*q != '\0') {
- if (isspace(*q) && !isspace(*(q + 1)) && *(q + 1) != '\0')
- c--;
- q++;
+ count--;
+ while (*old_feat != '\0') {
+ if (isspace(*old_feat) && !isspace(*(old_feat + 1)) &&
+ *(old_feat + 1) != '\0')
+ count--;
+ old_feat++;
}
/* Quick exit if all features have been removed */
- if (c == 0) {
- n = malloc(2);
- if (!n)
+ if (count == 0) {
+ new = malloc(2);
+ if (!new)
return 1;
- strcpy(n, "0");
+ strcpy(new, "0");
goto out;
}
/* Update feature count space */
- n = malloc(strlen(*f) - d + 1);
- if (!n)
+ new = malloc(strlen(*features_p) - len + 1);
+ if (!new)
return 1;
/* Copy the feature count */
- sprintf(n, "%0d", c);
+ sprintf(new, "%0d", count);
/*
* Copy existing features up to the feature
* about to be removed
*/
- strncat(n, e, (size_t)(p - e));
+ strncat(new, feats_start, (size_t)(ptr - feats_start));
/* Skip feature to be removed */
- p += d;
+ ptr += len;
/* Copy remaining features */
- while (isspace(*p))
- p++;
- if (*p != '\0')
- strcat(n, p);
+ while (isspace(*ptr))
+ ptr++;
+ if (*ptr != '\0')
+ strcat(new, ptr);
else
- strchop(n);
+ strchop(new);
out:
- free(*f);
- *f = n;
+ free(*features_p);
+ *features_p = new;
return 0;
}

View File

@ -1,59 +1,37 @@
Name: device-mapper-multipath
Version: 0.9.3
Release: 2%{?dist}
Version: 0.9.4
Release: 1%{?dist}
Summary: Tools to manage multipath devices using device-mapper
License: GPLv2
URL: http://christophe.varoqui.free.fr/
# The source for this package was pulled from upstream's git repo. Use the
# following command to generate the tarball
# curl -L https://github.com/opensvc/multipath-tools/archive/0.9.3.tar.gz -o multipath-tools-0.9.3.tgz
Source0: multipath-tools-0.9.3.tgz
# curl -L https://github.com/opensvc/multipath-tools/archive/0.9.4.tar.gz -o multipath-tools-0.9.4.tgz
Source0: multipath-tools-0.9.4.tgz
Source1: multipath.conf
Patch0001: 0001-libmultipath-fix-show-paths-format-failure.patch
Patch0002: 0002-fixup-Makefile.inc-fix-man-and-include-paths.patch
Patch0003: 0003-multipath-tools-Makefile.inc-Fix-paths-for-systemd.patch
Patch0004: 0004-multipath-tools-Makefile.inc-don-t-take-values-from-.patch
Patch0005: 0005-multipath-tools-Makefile.inc-get-rid-of-RUN.patch
Patch0006: 0006-multipath-tools-Makefile.inc-more-compact-code-for-L.patch
Patch0007: 0007-multipath-tools-Makefiles-simplify-code-for-include-.patch
Patch0008: 0008-multipath-tools-Makefiles-use-mandir.patch
Patch0009: 0009-multipath-tools-Makefile.inc-simplify-expression-for.patch
Patch0010: 0010-multipath-tools-Makefile.inc-untangle-paths-and-sour.patch
Patch0011: 0011-multipath-tools-Makefiles-replace-libdir-by-plugindi.patch
Patch0012: 0012-multipath-tools-Makefile.inc-use-simple-make-variabl.patch
Patch0013: 0013-multipath-tools-Makefile.inc-fix-a-log-message.patch
Patch0014: 0014-multipath-tools-Makefile.inc-set-systemd-specific-fl.patch
Patch0015: 0015-multipathd-Makefile-fix-compilation-flags-for-libedi.patch
Patch0016: 0016-multipath-tools-Makefiles-clean-up-executable-Makefi.patch
Patch0017: 0017-multipath-tools-Makefiles-use-common-code-for-librar.patch
Patch0018: 0018-multipath-tools-Makefiles-move-common-code-to-rules..patch
Patch0019: 0019-multipath-tools-Makefiles-create-config.mk.patch
Patch0020: 0020-multipath-tools-Makefiles-enable-quiet-build.patch
Patch0021: 0021-multipath-tools-quiet-build-support-for-top-level-Ma.patch
Patch0022: 0022-GitHub-workflows-use-make-j8-Orecurse.patch
Patch0023: 0023-README.md-Move-section-about-libedit-and-libreadline.patch
Patch0024: 0024-README.md-Fix-indentation-in-paragraph-about-device-.patch
Patch0025: 0025-README.md-document-options-for-paths-and-optimizatio.patch
Patch0026: 0026-README.md-document-how-to-customize-build.patch
Patch0027: 0027-libmultipath-avoid-Warray-bounds-error-with-gcc-12-a.patch
Patch0028: 0028-multipath-avoid-NULL-string-in-released_to_systemd.patch
Patch0029: 0029-libmultipath-avoid-NULL-string-in-is_udev_ready.patch
Patch0030: 0030-libmultipath-impove-add_feature-variable-names.patch
Patch0031: 0031-multipathd-don-t-initialize-the-field-width-in-show_.patch
Patch0032: 0032-libmultipath-improve-remove_feature-variable-names.patch
Patch0033: 0033-RH-fixup-udev-rules-for-redhat.patch
Patch0034: 0034-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch0035: 0035-RH-don-t-start-without-a-config-file.patch
Patch0036: 0036-RH-Fix-nvme-function-missing-argument.patch
Patch0037: 0037-RH-use-rpm-optflags-if-present.patch
Patch0038: 0038-RH-add-mpathconf.patch
Patch0039: 0039-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0040: 0040-RH-reset-default-find_mutipaths-value-to-off.patch
Patch0041: 0041-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
Patch0042: 0042-RH-make-parse_vpd_pg83-match-scsi_id-output.patch
Patch0043: 0043-RH-add-scsi-device-handlers-to-modules-load.d.patch
Patch0044: 0044-RH-compile-with-libreadline-support.patch
Patch0001: 0001-multipathd-make-pr-registration-consistent.patch
Patch0002: 0002-libmultipath-make-prflag-an-enum.patch
Patch0003: 0003-multipathd-handle-no-active-paths-in-update_map_pr.patch
Patch0004: 0004-multipathd-add-missing-newline-to-cli_del_map-reply.patch
Patch0005: 0005-libmultipath-skip-extra-vector-work-in-remove_maps.patch
Patch0006: 0006-libmultipath-orphan-paths-if-coalesce_paths-frees-ne.patch
Patch0007: 0007-libmultipath-is_path_valid-check-if-device-is-in-use.patch
Patch0008: 0008-libmpathpersist-use-conf-timeout-for-updating-persis.patch
Patch0009: 0009-libmultipath-pathinfo-don-t-fail-for-devices-lacking.patch
Patch0010: 0010-libmultipath-bump-ABI-version-to-18.0.0.patch
Patch0011: 0011-RH-fixup-udev-rules-for-redhat.patch
Patch0012: 0012-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch0013: 0013-RH-don-t-start-without-a-config-file.patch
Patch0014: 0014-RH-Fix-nvme-function-missing-argument.patch
Patch0015: 0015-RH-use-rpm-optflags-if-present.patch
Patch0016: 0016-RH-add-mpathconf.patch
Patch0017: 0017-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Patch0018: 0018-RH-reset-default-find_mutipaths-value-to-off.patch
Patch0019: 0019-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
Patch0020: 0020-RH-make-parse_vpd_pg83-match-scsi_id-output.patch
Patch0021: 0021-RH-add-scsi-device-handlers-to-modules-load.d.patch
Patch0022: 0022-RH-compile-with-libreadline-support.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -61,6 +39,7 @@ Requires: kpartx = %{version}-%{release}
Requires: device-mapper >= 1.02.96
Requires: userspace-rcu
Requires: readline
Requires: libmount
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
@ -82,6 +61,7 @@ BuildRequires: readline-devel, ncurses-devel
BuildRequires: systemd-units, systemd-devel
BuildRequires: json-c-devel, perl-interpreter, pkgconfig, gcc
BuildRequires: userspace-rcu-devel
BuildRequires: libmount-devel
BuildRequires: make
%description
@ -138,7 +118,7 @@ This package contains the files needed to develop applications that use
device-mapper-multipath's libdmmp C API library
%prep
%autosetup -n multipath-tools-0.9.3 -p1
%autosetup -n multipath-tools-0.9.4 -p1
cp %{SOURCE1} .
%build
@ -260,6 +240,14 @@ fi
%{_pkgconfdir}/libdmmp.pc
%changelog
* Thu Jan 26 2023 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.4-1
- Update to the head of the upstream staging branch
* Previous patches 0001-0032 are intlcude in the source tarball
* Patches 0001-0010 are from the upstream staging branch
- Rename redhat patches
* Previous patches 0033-0044 are not patches 0011-0022
- Add dependency on libmount
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (multipath-tools-0.9.3.tgz) = 4faa2ee5a96a9d5d752219931ebc885cb70ed6b022d45ede985ad7919c043a3aee166e6f126d32dffd187c5c32d5cbce91747d87d0b55557e2f7f68b279583da
SHA512 (multipath-tools-0.9.4.tgz) = 5e0dcea610fc215e345444c04453a38f39c73e493c2bc53f6b3a90cd701266aabdf7c4693dfc321099af836d0019bf27355e265ad5db5deff48f8bb94ed4719d
SHA512 (multipath.conf) = 71953dce5a68adcf60a942305f5a66023e6f4c4baf53b1bfdb4edf65ed5b8e03db804363c36d1dcfd85591f4766f52b515269904c53b84d7b076da0b80b09942