Blame SOURCES/0076-RHBZ-1056686-add-hw_str_match.patch

f20720
---
f20720
 libmultipath/config.c      |   10 ++++++++--
f20720
 libmultipath/config.h      |    1 +
f20720
 libmultipath/dict.c        |   28 ++++++++++++++++++++++++++++
f20720
 multipath/multipath.conf.5 |   11 +++++++++++
f20720
 4 files changed, 48 insertions(+), 2 deletions(-)
f20720
f20720
Index: multipath-tools-130222/libmultipath/config.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/config.c
f20720
+++ multipath-tools-130222/libmultipath/config.c
f20720
@@ -431,11 +431,16 @@ restart:
f20720
 			break;
f20720
 		j = n;
f20720
 		vector_foreach_slot_after(hw, hwe2, j) {
f20720
-			if (hwe_regmatch(hwe1, hwe2))
f20720
+			if (conf->hw_strmatch) {
f20720
+				if (hwe_strmatch(hwe2, hwe1))
f20720
+					continue;
f20720
+			}
f20720
+			else if (hwe_regmatch(hwe1, hwe2))
f20720
 				continue;
f20720
 			/* dup */
f20720
 			merge_hwe(hwe2, hwe1);
f20720
-			if (hwe_strmatch(hwe2, hwe1) == 0) {
f20720
+			if (conf->hw_strmatch ||
f20720
+			    hwe_strmatch(hwe2, hwe1) == 0) {
f20720
 				vector_del_slot(hw, i);
f20720
 				free_hwe(hwe1);
f20720
 				n -= 1;
f20720
@@ -550,6 +555,7 @@ load_config (char * file, struct udev *u
f20720
 	conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
f20720
 	conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
f20720
 	conf->detect_prio = DEFAULT_DETECT_PRIO;
f20720
+	conf->hw_strmatch = 0;
f20720
 
f20720
 	/*
f20720
 	 * preload default hwtable
f20720
Index: multipath-tools-130222/libmultipath/config.h
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/config.h
f20720
+++ multipath-tools-130222/libmultipath/config.h
f20720
@@ -107,6 +107,7 @@ struct config {
f20720
 	int log_checker_err;
f20720
 	int allow_queueing;
f20720
 	int find_multipaths;
f20720
+	int hw_strmatch;
f20720
 	uid_t uid;
f20720
 	gid_t gid;
f20720
 	mode_t mode;
f20720
Index: multipath-tools-130222/libmultipath/dict.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/dict.c
f20720
+++ multipath-tools-130222/libmultipath/dict.c
f20720
@@ -693,6 +693,25 @@ def_detect_prio_handler(vector strvec)
f20720
 	return 0;
f20720
 }
f20720
 
f20720
+static int
f20720
+def_hw_strmatch_handler(vector strvec)
f20720
+{
f20720
+	char *buff;
f20720
+
f20720
+	buff = set_value(strvec);
f20720
+	if (!buff)
f20720
+		return 1;
f20720
+
f20720
+	if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
f20720
+	    !strncmp(buff, "1", 1))
f20720
+		conf->hw_strmatch = 1;
f20720
+	else
f20720
+		conf->hw_strmatch = 0;
f20720
+
f20720
+	FREE(buff);
f20720
+	return 0;
f20720
+}
f20720
+
f20720
 /*
f20720
  * blacklist block handlers
f20720
  */
f20720
@@ -2795,6 +2814,14 @@ snprint_def_detect_prio(char * buff, int
f20720
 }
f20720
 
f20720
 static int
f20720
+snprint_def_hw_strmatch(char * buff, int len, void * data)
f20720
+{
f20720
+	if (conf->hw_strmatch)
f20720
+		return snprintf(buff, len, "yes");
f20720
+	return snprintf(buff, len, "no");
f20720
+}
f20720
+
f20720
+static int
f20720
 snprint_ble_simple (char * buff, int len, void * data)
f20720
 {
f20720
 	struct blentry * ble = (struct blentry *)data;
f20720
@@ -2861,6 +2888,7 @@ init_keywords(void)
f20720
 	install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
f20720
 	install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler);
f20720
 	install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
f20720
+	install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch);
f20720
 	__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
f20720
 	__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
f20720
 	__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
f20720
Index: multipath-tools-130222/multipath/multipath.conf.5
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipath/multipath.conf.5
f20720
+++ multipath-tools-130222/multipath/multipath.conf.5
f20720
@@ -400,6 +400,17 @@ will automatically use the
f20720
 .I alua
f20720
 prioritizer. If not, the prioritizer will be selected as usual. Default is
f20720
 .I no
f20720
+.TP
f20720
+.B hw_str_match
f20720
+If set to
f20720
+.I yes
f20720
+, the vendor, product, and revision parameters of user device configs will be
f20720
+string matched against the built-in device configs to determine if they should
f20720
+modify an existing config, or create a new one. If set to
f20720
+.I no
f20720
+, the user device configs will be regular expression matched against the
f20720
+built-in configs instead. Default is
f20720
+.I no
f20720
 .
f20720
 .SH "blacklist section"
f20720
 The