From c20c7f097d99fe4a17114b8d39063df845c61115 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Mon, 20 Dec 2010 00:02:09 -0600 Subject: [PATCH] multipath: add allow users to set revision in multipath.conf Since multipath is able to select hardware entries based on the revision parameter, users should be allowed to set it in their devices configurations. Signed-off-by: Benjamin Marzinski --- libmultipath/dict.c | 28 ++++++++++++++++++++++++++++ multipath/multipath.conf.5 | 5 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index fdeaec2..b4d3103 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -725,6 +725,22 @@ product_handler(vector strvec) } static int +revision_handler(vector strvec) +{ + struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); + + if (!hwe) + return 1; + + hwe->revision = set_value(strvec); + + if (!hwe->revision) + return 1; + + return 0; +} + +static int bl_product_handler(vector strvec) { struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable); @@ -1663,6 +1679,17 @@ snprint_hw_product (char * buff, int len, void * data) } static int +snprint_hw_revision (char * buff, int len, void * data) +{ + struct hwentry * hwe = (struct hwentry *)data; + + if (!hwe->revision) + return 0; + + return snprintf(buff, len, "\"%s\"", hwe->revision); +} + +static int snprint_hw_bl_product (char * buff, int len, void * data) { struct hwentry * hwe = (struct hwentry *)data; @@ -2268,6 +2295,7 @@ init_keywords(void) install_sublevel(); install_keyword("vendor", &vendor_handler, &snprint_hw_vendor); install_keyword("product", &product_handler, &snprint_hw_product); + install_keyword("revision", &revision_handler, &snprint_hw_revision); install_keyword("product_blacklist", &bl_product_handler, &snprint_hw_bl_product); install_keyword("path_grouping_policy", &hw_pgpolicy_handler, &snprint_hw_path_grouping_policy); install_keyword("getuid_callout", &hw_getuid_callout_handler, &snprint_hw_getuid_callout); diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index f234d20..5056414 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -387,8 +387,11 @@ subsection recognizes the following attributes: .B product (Mandatory) Product identifier .TP +.B revision +(Optional) Revision identfier +.TP .B product_blacklist -Product strings to blacklist for this vendor +(Optional) Product strings to blacklist for this vendor .TP .B hardware_handler (Optional) The hardware handler to use for this device type. -- 2.7.4