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

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