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

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