Blame SOURCES/0071-RHBZ-1031546-strip-dev.patch

e41771
---
e41771
 libmultipath/util.c       |   22 ++++++++++++++++++++++
e41771
 libmultipath/util.h       |    1 +
e41771
 multipath/main.c          |   23 +----------------------
e41771
 multipathd/cli_handlers.c |   18 ++++++++++++++++++
e41771
 4 files changed, 42 insertions(+), 22 deletions(-)
e41771
e41771
Index: multipath-tools-130222/libmultipath/util.c
e41771
===================================================================
e41771
--- multipath-tools-130222.orig/libmultipath/util.c
e41771
+++ multipath-tools-130222/libmultipath/util.c
e41771
@@ -236,6 +236,28 @@ skip_proc:
e41771
 	return 0;
e41771
 }
e41771
 
e41771
+/* This function returns a pointer inside of the supplied pathname string.
e41771
+ * If is_path_device is true, it may also modify the supplied string */
e41771
+char *convert_dev(char *name, int is_path_device)
e41771
+{
e41771
+	char *ptr;
e41771
+
e41771
+	if (!name)
e41771
+		return NULL;
e41771
+	if (is_path_device) {
e41771
+		ptr = strstr(name, "cciss/");
e41771
+		if (ptr) {
e41771
+			ptr += 5;
e41771
+			*ptr = '!';
e41771
+		}
e41771
+	}
e41771
+	if (!strncmp(name, "/dev/", 5) && strlen(name) > 5)
e41771
+		ptr = name + 5;
e41771
+	else
e41771
+		ptr = name;
e41771
+	return ptr;
e41771
+}
e41771
+
e41771
 dev_t parse_devt(const char *dev_t)
e41771
 {
e41771
 	int maj, min;
e41771
Index: multipath-tools-130222/libmultipath/util.h
e41771
===================================================================
e41771
--- multipath-tools-130222.orig/libmultipath/util.h
e41771
+++ multipath-tools-130222/libmultipath/util.h
e41771
@@ -10,6 +10,7 @@ size_t strlcat(char *dst, const char *sr
e41771
 void remove_trailing_chars(char *path, char c);
e41771
 int devt2devname (char *, int, char *);
e41771
 dev_t parse_devt(const char *dev_t);
e41771
+char *convert_dev(char *dev, int is_path_device);
e41771
 
e41771
 #define safe_sprintf(var, format, args...)	\
e41771
 	snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
e41771
Index: multipath-tools-130222/multipath/main.c
e41771
===================================================================
e41771
--- multipath-tools-130222.orig/multipath/main.c
e41771
+++ multipath-tools-130222/multipath/main.c
e41771
@@ -254,16 +254,7 @@ configure (void)
e41771
 	vecs.pathvec = pathvec;
e41771
 	vecs.mpvec = curmp;
e41771
 
e41771
-	/*
e41771
-	 * dev is "/dev/" . "sysfs block dev"
e41771
-	 */
e41771
-	if (conf->dev) {
e41771
-		if (!strncmp(conf->dev, "/dev/", 5) &&
e41771
-		    strlen(conf->dev) > 5)
e41771
-			dev = conf->dev + 5;
e41771
-		else
e41771
-			dev = conf->dev;
e41771
-	}
e41771
+	dev = convert_dev(conf->dev, (conf->dev_type == DEV_DEVNODE));
e41771
 
e41771
 	/*
e41771
 	 * if we have a blacklisted device parameter, exit early
e41771
@@ -427,16 +418,6 @@ get_dev_type(char *dev) {
e41771
 		return DEV_DEVMAP;
e41771
 }
e41771
 
e41771
-static void
e41771
-convert_dev(char *dev)
e41771
-{
e41771
-	char *ptr = strstr(dev, "cciss/");
e41771
-	if (ptr) {
e41771
-		ptr += 5;
e41771
-		*ptr = '!';
e41771
-	}
e41771
-}
e41771
-
e41771
 int
e41771
 main (int argc, char *argv[])
e41771
 {
e41771
@@ -577,8 +558,6 @@ main (int argc, char *argv[])
e41771
 
e41771
 		strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
e41771
 		conf->dev_type = get_dev_type(conf->dev);
e41771
-		if (conf->dev_type == DEV_DEVNODE)
e41771
-			convert_dev(conf->dev);
e41771
 	}
e41771
 	conf->daemon = 0;
e41771
 
e41771
Index: multipath-tools-130222/multipathd/cli_handlers.c
e41771
===================================================================
e41771
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
e41771
+++ multipath-tools-130222/multipathd/cli_handlers.c
e41771
@@ -235,6 +235,7 @@ cli_list_map_topology (void * v, char **
e41771
 	struct vectors * vecs = (struct vectors *)data;
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 	
e41771
+	param = convert_dev(param, 0);
e41771
 	get_path_layout(vecs->pathvec, 0);
e41771
 	mpp = find_mp_by_str(vecs->mpvec, param);
e41771
 
e41771
@@ -416,6 +417,7 @@ cli_add_path (void * v, char ** reply, i
e41771
 	struct path *pp;
e41771
 	int r;
e41771
 
e41771
+	param = convert_dev(param, 1);
e41771
 	condlog(2, "%s: add path (operator)", param);
e41771
 
e41771
 	if (filter_devnode(conf->blist_devnode, conf->elist_devnode,
e41771
@@ -459,6 +461,7 @@ cli_del_path (void * v, char ** reply, i
e41771
 	char * param = get_keyparam(v, PATH);
e41771
 	struct path *pp;
e41771
 
e41771
+	param = convert_dev(param, 1);
e41771
 	condlog(2, "%s: remove path (operator)", param);
e41771
 	pp = find_path_by_dev(vecs->pathvec, param);
e41771
 	if (!pp) {
e41771
@@ -478,6 +481,7 @@ cli_add_map (void * v, char ** reply, in
e41771
 	char *alias;
e41771
 	int rc;
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	condlog(2, "%s: add map (operator)", param);
e41771
 
e41771
 	if (filter_wwid(conf->blist_wwid, conf->elist_wwid, param) > 0) {
e41771
@@ -518,6 +522,7 @@ cli_del_map (void * v, char ** reply, in
e41771
 	char *alias;
e41771
 	int rc;
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	condlog(2, "%s: remove map (operator)", param);
e41771
 	minor = dm_get_minor(param);
e41771
 	if (minor < 0) {
e41771
@@ -549,6 +554,7 @@ cli_reload(void *v, char **reply, int *l
e41771
 	struct multipath *mpp;
e41771
 	int minor;
e41771
 
e41771
+	mapname = convert_dev(mapname, 0);
e41771
 	condlog(2, "%s: reload map (operator)", mapname);
e41771
 	if (sscanf(mapname, "dm-%d", &minor) == 1)
e41771
 		mpp = find_mp_by_minor(vecs->mpvec, minor);
e41771
@@ -591,6 +597,7 @@ cli_resize(void *v, char **reply, int *l
e41771
 	struct pathgroup *pgp;
e41771
 	struct path *pp;
e41771
 
e41771
+	mapname = convert_dev(mapname, 0);
e41771
 	condlog(2, "%s: resize map (operator)", mapname);
e41771
 	if (sscanf(mapname, "dm-%d", &minor) == 1)
e41771
 		mpp = find_mp_by_minor(vecs->mpvec, minor);
e41771
@@ -665,6 +672,7 @@ cli_restore_queueing(void *v, char **rep
e41771
 	struct multipath *mpp;
e41771
 	int minor;
e41771
 
e41771
+	mapname = convert_dev(mapname, 0);
e41771
 	condlog(2, "%s: restore map queueing (operator)", mapname);
e41771
 	if (sscanf(mapname, "dm-%d", &minor) == 1)
e41771
 		mpp = find_mp_by_minor(vecs->mpvec, minor);
e41771
@@ -716,6 +724,7 @@ cli_disable_queueing(void *v, char **rep
e41771
 	struct multipath *mpp;
e41771
 	int minor;
e41771
 
e41771
+	mapname = convert_dev(mapname, 0);
e41771
 	condlog(2, "%s: disable map queueing (operator)", mapname);
e41771
 	if (sscanf(mapname, "dm-%d", &minor) == 1)
e41771
 		mpp = find_mp_by_minor(vecs->mpvec, minor);
e41771
@@ -753,6 +762,7 @@ cli_switch_group(void * v, char ** reply
e41771
 	char * mapname = get_keyparam(v, MAP);
e41771
 	int groupnum = atoi(get_keyparam(v, GROUP));
e41771
 
e41771
+	mapname = convert_dev(mapname, 0);
e41771
 	condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum);
e41771
 
e41771
 	return dm_switchgroup(mapname, groupnum);
e41771
@@ -775,6 +785,7 @@ cli_suspend(void * v, char ** reply, int
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 	int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param);
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	condlog(2, "%s: suspend (operator)", param);
e41771
 
e41771
 	if (!r) /* error */
e41771
@@ -796,6 +807,7 @@ cli_resume(void * v, char ** reply, int
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 	int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param);
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	condlog(2, "%s: resume (operator)", param);
e41771
 
e41771
 	if (!r) /* error */
e41771
@@ -817,6 +829,7 @@ cli_reinstate(void * v, char ** reply, i
e41771
 	char * param = get_keyparam(v, PATH);
e41771
 	struct path * pp;
e41771
 
e41771
+	param = convert_dev(param, 1);
e41771
 	pp = find_path_by_dev(vecs->pathvec, param);
e41771
 
e41771
 	if (!pp)
e41771
@@ -837,6 +850,7 @@ cli_reassign (void * v, char ** reply, i
e41771
 {
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	condlog(3, "%s: reset devices (operator)", param);
e41771
 
e41771
 	dm_reassign(param);
e41771
@@ -851,6 +865,7 @@ cli_fail(void * v, char ** reply, int *
e41771
 	struct path * pp;
e41771
 	int r;
e41771
 
e41771
+	param = convert_dev(param, 1);
e41771
 	pp = find_path_by_dev(vecs->pathvec, param);
e41771
 
e41771
 	if (!pp)
e41771
@@ -962,6 +977,7 @@ cli_getprstatus (void * v, char ** reply
e41771
 	struct vectors * vecs = (struct vectors *)data;
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	get_path_layout(vecs->pathvec, 0);
e41771
 	mpp = find_mp_by_str(vecs->mpvec, param);
e41771
 
e41771
@@ -991,6 +1007,7 @@ cli_setprstatus(void * v, char ** reply,
e41771
 	struct vectors * vecs = (struct vectors *)data;
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	get_path_layout(vecs->pathvec, 0);
e41771
 	mpp = find_mp_by_str(vecs->mpvec, param);
e41771
 
e41771
@@ -1013,6 +1030,7 @@ cli_unsetprstatus(void * v, char ** repl
e41771
 	struct vectors * vecs = (struct vectors *)data;
e41771
 	char * param = get_keyparam(v, MAP);
e41771
 
e41771
+	param = convert_dev(param, 0);
e41771
 	get_path_layout(vecs->pathvec, 0);
e41771
 	mpp = find_mp_by_str(vecs->mpvec, param);
e41771