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

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