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