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

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