|
|
4ae388 |
---
|
|
|
4ae388 |
libmpathpersist/mpath_persist.c | 7 ++++---
|
|
|
4ae388 |
libmpathpersist/mpath_persist.h | 2 +-
|
|
|
4ae388 |
libmpathpersist/mpath_pr_ioctl.c | 5 +++--
|
|
|
4ae388 |
libmultipath/config.c | 9 +++------
|
|
|
4ae388 |
libmultipath/config.h | 2 +-
|
|
|
4ae388 |
mpathpersist/Makefile | 2 +-
|
|
|
4ae388 |
mpathpersist/main.c | 11 +++++++----
|
|
|
4ae388 |
multipath/Makefile | 2 +-
|
|
|
4ae388 |
multipath/main.c | 12 ++++++++----
|
|
|
4ae388 |
multipathd/main.c | 11 ++++++++---
|
|
|
4ae388 |
10 files changed, 37 insertions(+), 26 deletions(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
4ae388 |
@@ -1,4 +1,3 @@
|
|
|
4ae388 |
-#include "mpath_persist.h"
|
|
|
4ae388 |
#include <libdevmapper.h>
|
|
|
4ae388 |
#include <defaults.h>
|
|
|
4ae388 |
#include <sys/stat.h>
|
|
|
4ae388 |
@@ -8,6 +7,7 @@
|
|
|
4ae388 |
#include <checkers.h>
|
|
|
4ae388 |
#include <structs.h>
|
|
|
4ae388 |
#include <structs_vec.h>
|
|
|
4ae388 |
+#include <libudev.h>
|
|
|
4ae388 |
|
|
|
4ae388 |
#include <prio.h>
|
|
|
4ae388 |
#include <unistd.h>
|
|
|
4ae388 |
@@ -20,6 +20,7 @@
|
|
|
4ae388 |
#include <ctype.h>
|
|
|
4ae388 |
#include <propsel.h>
|
|
|
4ae388 |
|
|
|
4ae388 |
+#include "mpath_persist.h"
|
|
|
4ae388 |
#include "mpathpr.h"
|
|
|
4ae388 |
#include "mpath_pr_ioctl.h"
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -32,9 +33,9 @@
|
|
|
4ae388 |
|
|
|
4ae388 |
|
|
|
4ae388 |
int
|
|
|
4ae388 |
-mpath_lib_init (void)
|
|
|
4ae388 |
+mpath_lib_init (struct udev *udev)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
- if (load_config(DEFAULT_CONFIGFILE)){
|
|
|
4ae388 |
+ if (load_config(DEFAULT_CONFIGFILE, udev)){
|
|
|
4ae388 |
condlog(0, "Failed to initialize multipath config.");
|
|
|
4ae388 |
return 1;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.h
|
|
|
4ae388 |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.h
|
|
|
4ae388 |
@@ -174,7 +174,7 @@ struct prout_param_descriptor { /* PROU
|
|
|
4ae388 |
*
|
|
|
4ae388 |
* RETURNS: 0->Success, 1->Failed.
|
|
|
4ae388 |
*/
|
|
|
4ae388 |
-extern int mpath_lib_init (void );
|
|
|
4ae388 |
+extern int mpath_lib_init (struct udev *udev);
|
|
|
4ae388 |
|
|
|
4ae388 |
|
|
|
4ae388 |
/*
|
|
|
4ae388 |
Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_pr_ioctl.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c
|
|
|
4ae388 |
@@ -10,8 +10,9 @@
|
|
|
4ae388 |
#include <string.h>
|
|
|
4ae388 |
#include <sys/ioctl.h>
|
|
|
4ae388 |
#include <unistd.h>
|
|
|
4ae388 |
-#include "mpath_pr_ioctl.h"
|
|
|
4ae388 |
-#include <mpath_persist.h>
|
|
|
4ae388 |
+#include <libudev.h>
|
|
|
4ae388 |
+#include "mpath_pr_ioctl.h"
|
|
|
4ae388 |
+#include <mpath_persist.h>
|
|
|
4ae388 |
|
|
|
4ae388 |
#include <debug.h>
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
4ae388 |
@@ -467,9 +467,6 @@ free_config (struct config * conf)
|
|
|
4ae388 |
if (conf->dev)
|
|
|
4ae388 |
FREE(conf->dev);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (conf->udev)
|
|
|
4ae388 |
- udev_unref(conf->udev);
|
|
|
4ae388 |
-
|
|
|
4ae388 |
if (conf->multipath_dir)
|
|
|
4ae388 |
FREE(conf->multipath_dir);
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -519,12 +516,12 @@ free_config (struct config * conf)
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
int
|
|
|
4ae388 |
-load_config (char * file)
|
|
|
4ae388 |
+load_config (char * file, struct udev *udev)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
if (!conf)
|
|
|
4ae388 |
conf = alloc_config();
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (!conf)
|
|
|
4ae388 |
+ if (!conf || !udev)
|
|
|
4ae388 |
return 1;
|
|
|
4ae388 |
|
|
|
4ae388 |
/*
|
|
|
4ae388 |
@@ -533,7 +530,7 @@ load_config (char * file)
|
|
|
4ae388 |
if (!conf->verbosity)
|
|
|
4ae388 |
conf->verbosity = DEFAULT_VERBOSITY;
|
|
|
4ae388 |
|
|
|
4ae388 |
- conf->udev = udev_new();
|
|
|
4ae388 |
+ conf->udev = udev;
|
|
|
4ae388 |
dm_drv_version(conf->version, TGT_MPATH);
|
|
|
4ae388 |
conf->dev_type = DEV_NONE;
|
|
|
4ae388 |
conf->minio = DEFAULT_MINIO;
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
4ae388 |
@@ -159,7 +159,7 @@ void free_mptable (vector mptable);
|
|
|
4ae388 |
|
|
|
4ae388 |
int store_hwe (vector hwtable, struct hwentry *);
|
|
|
4ae388 |
|
|
|
4ae388 |
-int load_config (char * file);
|
|
|
4ae388 |
+int load_config (char * file, struct udev * udev);
|
|
|
4ae388 |
struct config * alloc_config (void);
|
|
|
4ae388 |
void free_config (struct config * conf);
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/mpathpersist/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/mpathpersist/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/mpathpersist/main.c
|
|
|
4ae388 |
@@ -7,6 +7,7 @@
|
|
|
4ae388 |
#include <vector.h>
|
|
|
4ae388 |
#include <structs.h>
|
|
|
4ae388 |
#include <getopt.h>
|
|
|
4ae388 |
+#include <libudev.h>
|
|
|
4ae388 |
#include <mpath_persist.h>
|
|
|
4ae388 |
#include "main.h"
|
|
|
4ae388 |
#include <pthread.h>
|
|
|
4ae388 |
@@ -68,7 +69,8 @@ int main (int argc, char * argv[])
|
|
|
4ae388 |
int noisy = 0;
|
|
|
4ae388 |
int num_transport =0;
|
|
|
4ae388 |
void *resp = NULL;
|
|
|
4ae388 |
- struct transportid * tmp;
|
|
|
4ae388 |
+ struct transportid * tmp;
|
|
|
4ae388 |
+ struct udev *udev = NULL;
|
|
|
4ae388 |
|
|
|
4ae388 |
if (optind == argc)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
@@ -84,8 +86,8 @@ int main (int argc, char * argv[])
|
|
|
4ae388 |
exit (1);
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
-
|
|
|
4ae388 |
- mpath_lib_init();
|
|
|
4ae388 |
+ udev = udev_new();
|
|
|
4ae388 |
+ mpath_lib_init(udev);
|
|
|
4ae388 |
memset(transportids,0,MPATH_MX_TIDS);
|
|
|
4ae388 |
|
|
|
4ae388 |
while (1)
|
|
|
4ae388 |
@@ -461,12 +463,13 @@ int main (int argc, char * argv[])
|
|
|
4ae388 |
if (res < 0)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
mpath_lib_exit();
|
|
|
4ae388 |
+ udev_unref(udev);
|
|
|
4ae388 |
return MPATH_PR_FILE_ERROR;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
out :
|
|
|
4ae388 |
mpath_lib_exit();
|
|
|
4ae388 |
-
|
|
|
4ae388 |
+ udev_unref(udev);
|
|
|
4ae388 |
return (ret >= 0) ? ret : MPATH_PR_OTHER;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
@@ -27,6 +27,7 @@
|
|
|
4ae388 |
#include <stdio.h>
|
|
|
4ae388 |
#include <unistd.h>
|
|
|
4ae388 |
#include <ctype.h>
|
|
|
4ae388 |
+#include <libudev.h>
|
|
|
4ae388 |
|
|
|
4ae388 |
#include <checkers.h>
|
|
|
4ae388 |
#include <prio.h>
|
|
|
4ae388 |
@@ -435,6 +436,7 @@ convert_dev(char *dev)
|
|
|
4ae388 |
int
|
|
|
4ae388 |
main (int argc, char *argv[])
|
|
|
4ae388 |
{
|
|
|
4ae388 |
+ struct udev *udev;
|
|
|
4ae388 |
int arg;
|
|
|
4ae388 |
extern char *optarg;
|
|
|
4ae388 |
extern int optind;
|
|
|
4ae388 |
@@ -445,7 +447,9 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (load_config(DEFAULT_CONFIGFILE))
|
|
|
4ae388 |
+ udev = udev_new();
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (load_config(DEFAULT_CONFIGFILE, udev))
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (dm_prereq())
|
|
|
4ae388 |
@@ -560,11 +564,11 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
|
|
|
4ae388 |
if (init_checkers()) {
|
|
|
4ae388 |
condlog(0, "failed to initialize checkers");
|
|
|
4ae388 |
- exit(1);
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
if (init_prio()) {
|
|
|
4ae388 |
condlog(0, "failed to initialize prioritizers");
|
|
|
4ae388 |
- exit(1);
|
|
|
4ae388 |
+ goto out;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
dm_init();
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -628,7 +632,7 @@ out:
|
|
|
4ae388 |
*/
|
|
|
4ae388 |
free_config(conf);
|
|
|
4ae388 |
conf = NULL;
|
|
|
4ae388 |
-
|
|
|
4ae388 |
+ udev_unref(udev);
|
|
|
4ae388 |
#ifdef _DEBUG_
|
|
|
4ae388 |
dbg_free_final(NULL);
|
|
|
4ae388 |
#endif
|
|
|
4ae388 |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
4ae388 |
@@ -93,6 +93,8 @@ static sem_t exit_sem;
|
|
|
4ae388 |
*/
|
|
|
4ae388 |
struct vectors * gvecs;
|
|
|
4ae388 |
|
|
|
4ae388 |
+struct udev * udev;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
static int
|
|
|
4ae388 |
need_switch_pathgroup (struct multipath * mpp, int refresh)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
@@ -1408,7 +1410,7 @@ reconfigure (struct vectors * vecs)
|
|
|
4ae388 |
vecs->pathvec = NULL;
|
|
|
4ae388 |
conf = NULL;
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (!load_config(DEFAULT_CONFIGFILE)) {
|
|
|
4ae388 |
+ if (!load_config(DEFAULT_CONFIGFILE, udev)) {
|
|
|
4ae388 |
conf->verbosity = old->verbosity;
|
|
|
4ae388 |
conf->daemon = 1;
|
|
|
4ae388 |
configure(vecs, 1);
|
|
|
4ae388 |
@@ -1601,6 +1603,8 @@ child (void * param)
|
|
|
4ae388 |
sem_init(&exit_sem, 0, 0);
|
|
|
4ae388 |
signal_init();
|
|
|
4ae388 |
|
|
|
4ae388 |
+ udev = udev_new();
|
|
|
4ae388 |
+
|
|
|
4ae388 |
setup_thread_attr(&misc_attr, 64 * 1024, 1);
|
|
|
4ae388 |
setup_thread_attr(&waiter_attr, 32 * 1024, 1);
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -1615,7 +1619,7 @@ child (void * param)
|
|
|
4ae388 |
condlog(2, "--------start up--------");
|
|
|
4ae388 |
condlog(2, "read " DEFAULT_CONFIGFILE);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (load_config(DEFAULT_CONFIGFILE))
|
|
|
4ae388 |
+ if (load_config(DEFAULT_CONFIGFILE, udev))
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (init_checkers()) {
|
|
|
4ae388 |
@@ -1765,7 +1769,8 @@ child (void * param)
|
|
|
4ae388 |
*/
|
|
|
4ae388 |
free_config(conf);
|
|
|
4ae388 |
conf = NULL;
|
|
|
4ae388 |
-
|
|
|
4ae388 |
+ udev_unref(udev);
|
|
|
4ae388 |
+ udev = NULL;
|
|
|
4ae388 |
#ifdef _DEBUG_
|
|
|
4ae388 |
dbg_free_final(NULL);
|
|
|
4ae388 |
#endif
|
|
|
4ae388 |
Index: multipath-tools-130222/mpathpersist/Makefile
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/mpathpersist/Makefile
|
|
|
4ae388 |
+++ multipath-tools-130222/mpathpersist/Makefile
|
|
|
4ae388 |
@@ -5,7 +5,7 @@ include ../Makefile.inc
|
|
|
4ae388 |
OBJS = main.o
|
|
|
4ae388 |
|
|
|
4ae388 |
CFLAGS += -I$(multipathdir) -I$(mpathpersistdir)
|
|
|
4ae388 |
-LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath
|
|
|
4ae388 |
+LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath -ludev
|
|
|
4ae388 |
|
|
|
4ae388 |
EXEC = mpathpersist
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/Makefile
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/Makefile
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/Makefile
|
|
|
4ae388 |
@@ -7,7 +7,7 @@ include ../Makefile.inc
|
|
|
4ae388 |
OBJS = main.o
|
|
|
4ae388 |
|
|
|
4ae388 |
CFLAGS += -fPIC -I$(multipathdir)
|
|
|
4ae388 |
-LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath
|
|
|
4ae388 |
+LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev
|
|
|
4ae388 |
|
|
|
4ae388 |
EXEC = multipath
|
|
|
4ae388 |
|