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

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