Skip to contentSkip to conversation

multipath-tools: minor fixes and build improvements

PATCH New [email protected] 1 participant 2 messages Sep 1, 2022 Device mapper

lore
Share & tools
lore
#0 lore raw

v2 cover multipath-tools: minor fixes and build improvements

From: Martin Wilck <[email protected]>

Hi Ben, hi Christophe,

here's a set of minor fixes for multipath-tools.

Regards
Martin

Changes v1->v2:
16/16 caused compilation to fail. Fixed. Only resending this patch,

Martin Wilck (16):
multipath-tools: Makefile: remove useless .PHONY targets
multipath-tools: Makefile: fix install->all dependency
multipath-tools: Makefile: remove dependency test -> test-progs
multipath-tools: Makefile: run abidiff with --redundant flag
libdmmp: Makefile: create man3dir
tests/Makefile: use $(multipathdir)
tests/Makefile: add library dependencies tests/Makefile: use symbolic links under tests/lib tests/Makefile: redirect program output into output file GitHub workflows: package shared objects in artifact
libmultipath: replace close_fd() with cleanup_fd_ptr()
libmultipath: cleanup_free_ptr(): avoid double free
multipath: find_multipaths_check_timeout(): no need for pthread
cleanup
multipathd: fix segfault in cli_list_map_fmt()
multipathd: fix broken pthread cleanup in
fpin_fabric_notification_receiver()
multipathd: Fix command completion in interactive mode

 .github/workflows/foreign.yaml    |  2 +
 Makefile                          |  8 ++--
 libdmmp/Makefile                  |  1 +
 libmpathutil/libmpathutil.version |  6 ++-
 libmpathutil/util.c               | 19 ++++++---
 libmpathutil/util.h               |  2 +-
 libmultipath/alias.c              |  4 +-
 libmultipath/foreign/nvme.c       |  4 +-
 libmultipath/sysfs.c              | 12 +++---
 libmultipath/wwids.c              |  8 ++--
 multipath/main.c                  |  8 ++--
 multipathd/callbacks.c            | 60 +++++++++++++++++++++++++++++
 multipathd/cli.c                  |  2 +
 multipathd/cli_handlers.c         | 64 ++-----------------------------
 multipathd/fpin_handlers.c        |  9 +++--
 multipathd/main.c                 |  1 -
 multipathd/multipathc.c           |  3 ++
 tests/Makefile                    | 26 ++++++-------
 18 files changed, 129 insertions(+), 110 deletions(-)
 create mode 100644 multipathd/callbacks.c
Signature · 6 lines
2.37.1

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

PATCH v2 16/16 multipathd: Fix command completion in interactive mode

From: Martin Wilck <[email protected]>

The command completion never worked, because the handlers array wasn't initialized in client mode.

The handlers array is now also required in multipathc, but it doesn't need the actual handler functions. To keep multipathc as small as possible, we just add a handler table with NULL handler functions.

---
 multipathd/callbacks.c    | 60 +++++++++++++++++++++++++++++++++++++
 multipathd/cli.c          |  2 ++
 multipathd/cli_handlers.c | 62 ++-------------------------------------
 multipathd/main.c         |  1 -
 multipathd/multipathc.c   |  3 ++
 5 files changed, 67 insertions(+), 61 deletions(-)
 create mode 100644 multipathd/callbacks.c
multipathd/callbacks.c new file +60 -0
new file mode 100644
index 0000000..0bd76b7
@@ -0,0 +1,60 @@
+void init_handler_callbacks(void)
+{
+	set_handler_callback(LIST+PATHS, HANDLER(cli_list_paths));
+	set_handler_callback(LIST+PATHS+FMT, HANDLER(cli_list_paths_fmt));
+	set_handler_callback(LIST+PATHS+RAW+FMT, HANDLER(cli_list_paths_raw));
+	set_handler_callback(LIST+PATH, HANDLER(cli_list_path));
+	set_handler_callback(LIST+MAPS, HANDLER(cli_list_maps));
+	set_handler_callback(LIST+STATUS, HANDLER(cli_list_status));
+	set_unlocked_handler_callback(LIST+DAEMON, HANDLER(cli_list_daemon));
+	set_handler_callback(LIST+MAPS+STATUS, HANDLER(cli_list_maps_status));
+	set_handler_callback(LIST+MAPS+STATS, HANDLER(cli_list_maps_stats));
+	set_handler_callback(LIST+MAPS+FMT, HANDLER(cli_list_maps_fmt));
+	set_handler_callback(LIST+MAPS+RAW+FMT, HANDLER(cli_list_maps_raw));
+	set_handler_callback(LIST+MAPS+TOPOLOGY, HANDLER(cli_list_maps_topology));
+	set_handler_callback(LIST+TOPOLOGY, HANDLER(cli_list_maps_topology));
+	set_handler_callback(LIST+MAPS+JSON, HANDLER(cli_list_maps_json));
+	set_handler_callback(LIST+MAP+TOPOLOGY, HANDLER(cli_list_map_topology));
+	set_handler_callback(LIST+MAP+FMT, HANDLER(cli_list_map_fmt));
+	set_handler_callback(LIST+MAP+RAW+FMT, HANDLER(cli_list_map_fmt));
+	set_handler_callback(LIST+MAP+JSON, HANDLER(cli_list_map_json));
+	set_handler_callback(LIST+CONFIG+LOCAL, HANDLER(cli_list_config_local));
+	set_handler_callback(LIST+CONFIG, HANDLER(cli_list_config));
+	set_handler_callback(LIST+BLACKLIST, HANDLER(cli_list_blacklist));
+	set_handler_callback(LIST+DEVICES, HANDLER(cli_list_devices));
+	set_handler_callback(LIST+WILDCARDS, HANDLER(cli_list_wildcards));
+	set_handler_callback(RESET+MAPS+STATS, HANDLER(cli_reset_maps_stats));
+	set_handler_callback(RESET+MAP+STATS, HANDLER(cli_reset_map_stats));
+	set_handler_callback(ADD+PATH, HANDLER(cli_add_path));
+	set_handler_callback(DEL+PATH, HANDLER(cli_del_path));
+	set_handler_callback(ADD+MAP, HANDLER(cli_add_map));
+	set_handler_callback(DEL+MAP, HANDLER(cli_del_map));
+	set_handler_callback(DEL+MAPS, HANDLER(cli_del_maps));
+	set_handler_callback(SWITCH+MAP+GROUP, HANDLER(cli_switch_group));
+	set_unlocked_handler_callback(RECONFIGURE, HANDLER(cli_reconfigure));
+	set_unlocked_handler_callback(RECONFIGURE+ALL, HANDLER(cli_reconfigure_all));
+	set_handler_callback(SUSPEND+MAP, HANDLER(cli_suspend));
+	set_handler_callback(RESUME+MAP, HANDLER(cli_resume));
+	set_handler_callback(RESIZE+MAP, HANDLER(cli_resize));
+	set_handler_callback(RELOAD+MAP, HANDLER(cli_reload));
+	set_handler_callback(RESET+MAP, HANDLER(cli_reassign));
+	set_handler_callback(REINSTATE+PATH, HANDLER(cli_reinstate));
+	set_handler_callback(FAIL+PATH, HANDLER(cli_fail));
+	set_handler_callback(DISABLEQ+MAP, HANDLER(cli_disable_queueing));
+	set_handler_callback(RESTOREQ+MAP, HANDLER(cli_restore_queueing));
+	set_handler_callback(DISABLEQ+MAPS, HANDLER(cli_disable_all_queueing));
+	set_handler_callback(RESTOREQ+MAPS, HANDLER(cli_restore_all_queueing));
+	set_unlocked_handler_callback(QUIT, HANDLER(cli_quit));
+	set_unlocked_handler_callback(SHUTDOWN, HANDLER(cli_shutdown));
+	set_handler_callback(GETPRSTATUS+MAP, HANDLER(cli_getprstatus));
+	set_handler_callback(SETPRSTATUS+MAP, HANDLER(cli_setprstatus));
+	set_handler_callback(UNSETPRSTATUS+MAP, HANDLER(cli_unsetprstatus));
+	set_handler_callback(FORCEQ+DAEMON, HANDLER(cli_force_no_daemon_q));
+	set_handler_callback(RESTOREQ+DAEMON, HANDLER(cli_restore_no_daemon_q));
+	set_handler_callback(GETPRKEY+MAP, HANDLER(cli_getprkey));
+	set_handler_callback(SETPRKEY+MAP+KEY, HANDLER(cli_setprkey));
+	set_handler_callback(UNSETPRKEY+MAP, HANDLER(cli_unsetprkey));
+	set_handler_callback(SETMARGINAL+PATH, HANDLER(cli_set_marginal));
+	set_handler_callback(UNSETMARGINAL+PATH, HANDLER(cli_unset_marginal));
+	set_handler_callback(UNSETMARGINAL+MAP, HANDLER(cli_unset_all_marginal));
+}
multipathd/cli.c +2 -0
index d1bfeee..5d25ddb 100644
@@ -14,6 +14,7 @@
 
 #include "mpath_cmd.h"
 #include "cli.h"
+#include "cli_handlers.h"
 #include "debug.h"
 #include "strbuf.h"
 
@@ -451,6 +452,7 @@ cli_init (void) {
 	if (alloc_handlers())
 		return 1;
 
+	init_handler_callbacks();
 	return 0;
 }
 
multipathd/cli_handlers.c +2 -60

65 lines not on this page · raw message

multipathd/main.c +0 -1
index 4a65359..ba52d39 100644
@@ -1797,7 +1797,6 @@ uxlsnrloop (void * ap)
 	/* Tell main thread that thread has started */
 	post_config_state(DAEMON_CONFIGURE);
 
-	init_handler_callbacks();
 	umask(077);
 
 	/*
multipathd/multipathc.c +3 -0
index 9d49655..b3f7db0 100644
@@ -274,3 +274,6 @@ int main (int argc, const char * const argv[])
 	mpath_disconnect(fd);
 	return 0;
 }
+
+#define HANDLER(x) NULL
+#include "callbacks.c"
Signature · 6 lines
2.37.1

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