1dad67a5af
Update Source to upstream version 0.8.5 plus post tag commits * Patches 0001-0102 are from https://github.com/openSUSE/multipath-tools/tree/queue and are already queued for upstream. Rename files * Previous patches 0059-0068 are now patches 0103-0111
157 lines
4.3 KiB
Diff
157 lines
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martin Wilck <mwilck@suse.com>
|
|
Date: Wed, 16 Sep 2020 12:11:46 +0200
|
|
Subject: [PATCH] libmpathpersist: allow using libmultipath
|
|
{get,put}_multipath_config
|
|
|
|
Provide an alternative init function libmpathpersist_init() which
|
|
avoids allocating a new struct config, simply using libmultipath's
|
|
internal implementation. This causes a minor version bump for
|
|
libmpathpersist.
|
|
|
|
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmpathpersist/libmpathpersist.version | 6 ++++
|
|
libmpathpersist/mpath_persist.c | 42 +++++++++++++++++++++----
|
|
libmpathpersist/mpath_persist.h | 28 +++++++++++++++++
|
|
3 files changed, 70 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/libmpathpersist/libmpathpersist.version b/libmpathpersist/libmpathpersist.version
|
|
index dc648ce6..e0748138 100644
|
|
--- a/libmpathpersist/libmpathpersist.version
|
|
+++ b/libmpathpersist/libmpathpersist.version
|
|
@@ -30,3 +30,9 @@ global:
|
|
|
|
local: *;
|
|
};
|
|
+
|
|
+LIBMPATHPERSIST_1.1.0 {
|
|
+global:
|
|
+ libmpathpersist_init;
|
|
+ libmpathpersist_exit;
|
|
+} LIBMPATHPERSIST_1.0.0;
|
|
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
|
|
index cc4a088d..febf4758 100644
|
|
--- a/libmpathpersist/mpath_persist.c
|
|
+++ b/libmpathpersist/mpath_persist.c
|
|
@@ -37,6 +37,27 @@
|
|
|
|
extern struct udev *udev;
|
|
|
|
+static void adapt_config(struct config *conf)
|
|
+{
|
|
+ conf->force_sync = 1;
|
|
+ set_max_fds(conf->max_fds);
|
|
+}
|
|
+
|
|
+int libmpathpersist_init(void)
|
|
+{
|
|
+ struct config *conf;
|
|
+ int rc = 0;
|
|
+
|
|
+ if (init_config(DEFAULT_CONFIGFILE)) {
|
|
+ condlog(0, "Failed to initialize multipath config.");
|
|
+ return 1;
|
|
+ }
|
|
+ conf = libmp_get_multipath_config();
|
|
+ adapt_config(conf);
|
|
+ libmp_put_multipath_config(conf);
|
|
+ return rc;
|
|
+}
|
|
+
|
|
struct config *
|
|
mpath_lib_init (void)
|
|
{
|
|
@@ -47,20 +68,29 @@ mpath_lib_init (void)
|
|
condlog(0, "Failed to initialize multipath config.");
|
|
return NULL;
|
|
}
|
|
- conf->force_sync = 1;
|
|
- set_max_fds(conf->max_fds);
|
|
-
|
|
+ adapt_config(conf);
|
|
return conf;
|
|
}
|
|
|
|
-int
|
|
-mpath_lib_exit (struct config *conf)
|
|
+static void libmpathpersist_cleanup(void)
|
|
{
|
|
dm_lib_exit();
|
|
cleanup_prio();
|
|
cleanup_checkers();
|
|
+}
|
|
+
|
|
+int
|
|
+mpath_lib_exit (struct config *conf)
|
|
+{
|
|
+ libmpathpersist_cleanup();
|
|
free_config(conf);
|
|
- conf = NULL;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int libmpathpersist_exit(void)
|
|
+{
|
|
+ libmpathpersist_cleanup();
|
|
+ uninit_config();
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/libmpathpersist/mpath_persist.h b/libmpathpersist/mpath_persist.h
|
|
index 7cf4faf9..91606efc 100644
|
|
--- a/libmpathpersist/mpath_persist.h
|
|
+++ b/libmpathpersist/mpath_persist.h
|
|
@@ -175,6 +175,22 @@ struct prout_param_descriptor { /* PROUT parameter descriptor */
|
|
* DESCRIPTION :
|
|
* Initialize device mapper multipath configuration. This function must be invoked first
|
|
* before performing reservation management functions.
|
|
+ * Either this function or mpath_lib_init() may be used.
|
|
+ * Use this function to work with libmultipath's internal "struct config".
|
|
+ * Call libmpathpersist_exit() for cleanup.
|
|
+ * RESTRICTIONS:
|
|
+ *
|
|
+ * RETURNS: 0->Success, 1->Failed.
|
|
+ */
|
|
+extern int libmpathpersist_init (void);
|
|
+
|
|
+/*
|
|
+ * DESCRIPTION :
|
|
+ * Initialize device mapper multipath configuration. This function must be invoked first
|
|
+ * before performing reservation management functions.
|
|
+ * Either this function or libmpathpersist_init() may be used.
|
|
+ * Use this function to work with an application-specific "struct config".
|
|
+ * Call mpath_lib_exit() for cleanup.
|
|
* RESTRICTIONS:
|
|
*
|
|
* RETURNS: struct config ->Success, NULL->Failed.
|
|
@@ -186,12 +202,24 @@ extern struct config * mpath_lib_init (void);
|
|
* DESCRIPTION :
|
|
* Release device mapper multipath configuration. This function must be invoked after
|
|
* performing reservation management functions.
|
|
+ * Use this after initialization with mpath_lib_init().
|
|
* RESTRICTIONS:
|
|
*
|
|
* RETURNS: 0->Success, 1->Failed.
|
|
*/
|
|
extern int mpath_lib_exit (struct config *conf);
|
|
|
|
+/*
|
|
+ * DESCRIPTION :
|
|
+ * Release device mapper multipath configuration. This function must be invoked after
|
|
+ * performing reservation management functions.
|
|
+ * Use this after initialization with libmpathpersist_init().
|
|
+ * RESTRICTIONS:
|
|
+ *
|
|
+ * RETURNS: 0->Success, 1->Failed.
|
|
+ */
|
|
+extern int libmpathpersist_exit (void);
|
|
+
|
|
|
|
/*
|
|
* DESCRIPTION :
|
|
--
|
|
2.17.2
|
|
|