Skip to contentSkip to conversation

multipath-tools libmultipath/config.c libmulti ...

PATCH [email protected] 1 participant 1 message Dec 15, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: [email protected] 2007-12-15 00:27:40

Modified files:
libmultipath : config.c config.h dict.c
multipathd : Makefile main.c
Added files:
multipathd : clone_platform.h copy.c copy.h

Log message:
Add private namespace and callout cache support back to multipath. This seems less invasive than the libprio work in upstream, which will go into the next major release. Fixes bz #355961

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.19.2.3&r2=1.19.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/config.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.18.2.1&r2=1.18.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/dict.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.2&r2=1.17.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/clone_platform.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/copy.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/copy.h.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=NONE&r2=1.4.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.14&r2=1.14.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.2&r2=1.69.2.3

libmultipath/config.c +60 -3
@@ -20,6 +20,57 @@
 #include "blacklist.h"
 #include "defaults.h"
 
+/*
+ * helper function to draw a list of callout binaries found in the config file
+ */
+extern int
+push_callout(char * callout)
+{
+#if DAEMON
+	int i;
+	char *bin;
+	char *p;
+
+	/*
+	 * purge command line arguments
+	 */
+	p = callout;
+
+	while (*p != ' ' && *p != '\0')
+		p++;
+
+	if (!conf->binvec)
+		conf->binvec = vector_alloc();
+
+
+	if (!conf->binvec)
+		return 1;
+
+	/*
+	 * if this callout is already stored in binvec, don't store it twice
+	 */
+	vector_foreach_slot (conf->binvec, bin, i)
+		if (memcmp(bin, callout, p - callout) == 0)
+			return 0;
+
+	/*
+	 * else, store it
+	 */
+	bin = MALLOC((p - callout) + 1);
+
+	if (!bin)
+		return 1;
+
+	strncpy(bin, callout, p - callout);
+
+	if (!vector_alloc_slot(conf->binvec))
+		return 1;
+
+	vector_set_slot(conf->binvec, bin);
+#endif
+	return 0;
+}
+
 static struct hwentry *
 find_hwe_strmatch (vector hwtable, char * vendor, char * product)
 {
@@ -255,10 +306,12 @@
 	if (!dhwe->product || !(hwe->product = set_param_str(dhwe->product)))
 		goto out;
 	
-	if (dhwe->getuid && !(hwe->getuid = set_param_str(dhwe->getuid)))
+	if (dhwe->getuid && (!(hwe->getuid = set_param_str(dhwe->getuid)) ||
+	                     push_callout(dhwe->getuid)))
 		goto out;
 
-	if (dhwe->getprio && !(hwe->getprio = set_param_str(dhwe->getprio)))
+	if (dhwe->getprio && (!(hwe->getprio = set_param_str(dhwe->getprio)) ||
+	                      push_callout(dhwe->getprio)))
 		goto out;
 				
 	if (dhwe->features && !(hwe->features = set_param_str(dhwe->features)))
@@ -337,6 +390,7 @@
 	free_mptable(conf->mptable);
 	free_hwtable(conf->hwtable);
 	free_keywords(conf->keywords);
+	free_strvec(conf->binvec);
 	FREE(conf);
 }
 
@@ -435,8 +489,11 @@
 	if (conf->udev_dir == NULL)
 		conf->udev_dir = set_default(DEFAULT_UDEVDIR);
 
-	if (conf->getuid == NULL)
+	if (conf->getuid == NULL){
 		conf->getuid = set_default(DEFAULT_GETUID);
+		if (push_callout(conf->getuid))
+			goto out;
+	}
 
 	if (conf->features == NULL)
 		conf->features = set_default(DEFAULT_FEATURES);
libmultipath/config.h +3 -0
@@ -76,6 +76,7 @@
 	vector keywords;
 	vector mptable;
 	vector hwtable;
+	vector binvec;
 
 	vector blist_devnode;
 	vector blist_wwid;
@@ -87,6 +88,8 @@
 
 struct config * conf;
 
+extern int push_callout(char * callout);
+
 struct hwentry * find_hwe (vector hwtable, char * vendor, char * product);
 struct mpentry * find_mpe (char * wwid);
 char * get_mpe_wwid (char * alias);
libmultipath/dict.c +6 -4
@@ -78,7 +78,7 @@
 	if (!conf->getuid)
 		return 1;
 	
-	return 0;
+	return push_callout(conf->getuid);
 }
 
 static int
@@ -93,9 +93,10 @@
 	    !strcmp(conf->getprio, "none")) {
 		FREE(conf->getprio);
 		conf->getprio = NULL;
+		return 0;
 	}
 		
-	return 0;
+	return push_callout(conf->getprio);
 }
 
 static int
@@ -510,7 +511,7 @@
 	if (!hwe->getuid)
 		return 1;
 
-	return 0;
+	return push_callout(hwe->getuid);
 }
 
 static int
@@ -597,9 +598,10 @@
 	if (strlen(hwe->getprio) == 4 && !strcmp(hwe->getprio, "none")) {
 		FREE(hwe->getprio);
 		hwe->getprio = NULL;
+		return 0;
 	}
 
-	return 0;
+	return push_callout(hwe->getprio);
 }
 
 static int
multipathd/Makefile +1 -1
@@ -19,7 +19,7 @@
 #
 # object files
 #
-OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o \
+OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o copy.o cli_handlers.o \
        $(MULTIPATHLIB)-glibc.a $(CHECKERSLIB)-glibc.a \
 
 
multipathd/main.c +185 -37

293 lines not on this page · raw message