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

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