Blame SOURCES/0099-RH-add-all-devs.patch

f20720
---
f20720
 libmultipath/config.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++++-
f20720
 libmultipath/config.h |    1 
f20720
 libmultipath/dict.c   |   38 +++++++++++++++++++++++++++++
f20720
 3 files changed, 102 insertions(+), 1 deletion(-)
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
@@ -113,6 +113,8 @@ find_hwe (vector hwtable, char * vendor,
f20720
 	 * continuing to the generic entries
f20720
 	 */
f20720
 	vector_foreach_slot_backwards (hwtable, tmp, i) {
f20720
+		if (tmp->all_devs == 1)
f20720
+			continue;
f20720
 		if (hwe_regmatch(tmp, &hwe))
f20720
 			continue;
f20720
 		ret = tmp;
f20720
@@ -348,6 +350,62 @@ merge_hwe (struct hwentry * dst, struct
f20720
 	return 0;
f20720
 }
f20720
 
f20720
+#define overwrite_str(s) \
f20720
+do { \
f20720
+	if (src->s) { \
f20720
+		if (dst->s) \
f20720
+			FREE(dst->s); \
f20720
+		if (!(dst->s = set_param_str(src->s))) \
f20720
+			return 1; \
f20720
+	} \
f20720
+} while(0)
f20720
+
f20720
+#define overwrite_num(s) \
f20720
+do { \
f20720
+	if (src->s) \
f20720
+		dst->s = src->s; \
f20720
+} while(0)
f20720
+
f20720
+static int
f20720
+overwrite_hwe (struct hwentry * dst, struct hwentry * src)
f20720
+{
f20720
+	overwrite_str(vendor);
f20720
+	overwrite_str(product);
f20720
+	overwrite_str(revision);
f20720
+	overwrite_str(uid_attribute);
f20720
+	overwrite_str(features);
f20720
+	overwrite_str(hwhandler);
f20720
+	overwrite_str(selector);
f20720
+	overwrite_str(checker_name);
f20720
+	overwrite_str(prio_name);
f20720
+	overwrite_str(prio_args);
f20720
+	overwrite_str(alias_prefix);
f20720
+	overwrite_str(bl_product);
f20720
+	overwrite_num(pgpolicy);
f20720
+	overwrite_num(pgfailback);
f20720
+	overwrite_num(rr_weight);
f20720
+	overwrite_num(no_path_retry);
f20720
+	overwrite_num(minio);
f20720
+	overwrite_num(minio_rq);
f20720
+	overwrite_num(pg_timeout);
f20720
+	overwrite_num(flush_on_last_del);
f20720
+	overwrite_num(fast_io_fail);
f20720
+	overwrite_num(dev_loss);
f20720
+	overwrite_num(user_friendly_names);
f20720
+	overwrite_num(retain_hwhandler);
f20720
+	overwrite_num(detect_prio);
f20720
+
f20720
+	/*
f20720
+	 * Make sure features is consistent with
f20720
+	 * no_path_retry
f20720
+	 */
f20720
+	if (dst->no_path_retry == NO_PATH_RETRY_FAIL)
f20720
+		remove_feature(&dst->features, "queue_if_no_path");
f20720
+	else if (dst->no_path_retry != NO_PATH_RETRY_UNDEF)
f20720
+		add_feature(&dst->features, "queue_if_no_path");
f20720
+	return 0;
f20720
+}
f20720
+
f20720
 int
f20720
 store_hwe (vector hwtable, struct hwentry * dhwe)
f20720
 {
f20720
@@ -431,7 +489,11 @@ restart:
f20720
 			break;
f20720
 		j = n;
f20720
 		vector_foreach_slot_after(hw, hwe2, j) {
f20720
-			if (conf->hw_strmatch) {
f20720
+			if (hwe2->all_devs == 1) {
f20720
+				overwrite_hwe(hwe1, hwe2);
f20720
+				continue;
f20720
+			}
f20720
+			else if (conf->hw_strmatch) {
f20720
 				if (hwe_strmatch(hwe2, hwe1))
f20720
 					continue;
f20720
 			}
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
@@ -47,6 +47,7 @@ struct hwentry {
f20720
 	char * prio_args;
f20720
 	char * alias_prefix;
f20720
 
f20720
+	int all_devs;
f20720
 	int pgpolicy;
f20720
 	int pgfailback;
f20720
 	int rr_weight;
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
@@ -918,6 +918,32 @@ device_handler(vector strvec)
f20720
 }
f20720
 
f20720
 static int
f20720
+all_devs_handler(vector strvec)
f20720
+{
f20720
+	char * buff;
f20720
+	struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
f20720
+
f20720
+	if (!hwe)
f20720
+		return 1;
f20720
+
f20720
+	buff = set_value(strvec);
f20720
+	if (!buff)
f20720
+		return 1;
f20720
+
f20720
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
f20720
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
f20720
+		hwe->all_devs = 0;
f20720
+	else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
f20720
+		 (strlen(buff) == 1 && !strcmp(buff, "1")))
f20720
+		hwe->all_devs = 1;
f20720
+	else
f20720
+		hwe->all_devs = 0;
f20720
+
f20720
+	FREE(buff);
f20720
+	return 0;
f20720
+}
f20720
+
f20720
+static int
f20720
 vendor_handler(vector strvec)
f20720
 {
f20720
 	struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
f20720
@@ -2182,6 +2208,17 @@ snprint_hw_dev_loss(char * buff, int len
f20720
 }
f20720
 
f20720
 static int
f20720
+snprint_hw_all_devs (char *buff, int len, void *data)
f20720
+{
f20720
+	struct hwentry * hwe = (struct hwentry *)data;
f20720
+
f20720
+	if (!hwe->all_devs)
f20720
+		return 0;
f20720
+
f20720
+	return snprintf(buff, len, "yes");
f20720
+}
f20720
+
f20720
+static int
f20720
 snprint_hw_vendor (char * buff, int len, void * data)
f20720
 {
f20720
 	struct hwentry * hwe = (struct hwentry *)data;
f20720
@@ -2968,6 +3005,7 @@ init_keywords(void)
f20720
 	install_keyword_root("devices", &devices_handler);
f20720
 	install_keyword_multi("device", &device_handler, NULL);
f20720
 	install_sublevel();
f20720
+	install_keyword("all_devs", &all_devs_handler, &snprint_hw_all_devs);
f20720
 	install_keyword("vendor", &vendor_handler, &snprint_hw_vendor);
f20720
 	install_keyword("product", &product_handler, &snprint_hw_product);
f20720
 	install_keyword("revision", &revision_handler, &snprint_hw_revision);