115 lines
2.6 KiB
Diff
115 lines
2.6 KiB
Diff
|
---
|
||
|
libmultipath/config.c | 50 +++++++++++++++++++++++---------------------------
|
||
|
1 file changed, 23 insertions(+), 27 deletions(-)
|
||
|
|
||
|
Index: multipath-tools/libmultipath/config.c
|
||
|
===================================================================
|
||
|
--- multipath-tools.orig/libmultipath/config.c
|
||
|
+++ multipath-tools/libmultipath/config.c
|
||
|
@@ -24,33 +24,30 @@
|
||
|
static int
|
||
|
hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
|
||
|
{
|
||
|
- if (hwe1->vendor && hwe2->vendor && strcmp(hwe1->vendor, hwe2->vendor))
|
||
|
+ if (hwe1->vendor) {
|
||
|
+ if (!hwe2->vendor || strcmp(hwe1->vendor, hwe2->vendor))
|
||
|
+ return 1;
|
||
|
+ }
|
||
|
+ else if (hwe2->vendor)
|
||
|
return 1;
|
||
|
|
||
|
- if (hwe1->product && hwe2->product && strcmp(hwe1->product, hwe2->product))
|
||
|
+ if (hwe1->product) {
|
||
|
+ if (!hwe2->product || strcmp(hwe1->product, hwe2->product))
|
||
|
+ return 1;
|
||
|
+ }
|
||
|
+ else if (hwe2->product)
|
||
|
return 1;
|
||
|
|
||
|
- if (hwe1->revision && hwe2->revision && strcmp(hwe1->revision, hwe2->revision))
|
||
|
+ if (hwe1->revision) {
|
||
|
+ if (!hwe2->revision || strcmp(hwe1->revision, hwe2->revision))
|
||
|
+ return 1;
|
||
|
+ }
|
||
|
+ else if (hwe2->revision)
|
||
|
return 1;
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-static struct hwentry *
|
||
|
-find_hwe_strmatch (vector hwtable, struct hwentry *hwe)
|
||
|
-{
|
||
|
- int i;
|
||
|
- struct hwentry *tmp, *ret = NULL;
|
||
|
-
|
||
|
- vector_foreach_slot (hwtable, tmp, i) {
|
||
|
- if (hwe_strmatch(tmp, hwe))
|
||
|
- continue;
|
||
|
- ret = tmp;
|
||
|
- break;
|
||
|
- }
|
||
|
- return ret;
|
||
|
-}
|
||
|
-
|
||
|
struct hwentry *
|
||
|
find_hwe (vector hwtable, char * vendor, char * product, char * revision)
|
||
|
{
|
||
|
@@ -264,15 +261,13 @@ set_param_str(char * str)
|
||
|
}
|
||
|
|
||
|
#define merge_str(s) \
|
||
|
- if (hwe2->s) { \
|
||
|
- if (hwe1->s) \
|
||
|
- FREE(hwe1->s); \
|
||
|
+ if (!hwe1->s && hwe2->s) { \
|
||
|
if (!(hwe1->s = set_param_str(hwe2->s))) \
|
||
|
return 1; \
|
||
|
}
|
||
|
|
||
|
#define merge_num(s) \
|
||
|
- if (hwe2->s) \
|
||
|
+ if (!hwe1->s && hwe2->s) \
|
||
|
hwe1->s = hwe2->s
|
||
|
|
||
|
|
||
|
@@ -295,6 +290,10 @@ merge_hwe (struct hwentry * hwe1, struct
|
||
|
merge_num(rr_weight);
|
||
|
merge_num(no_path_retry);
|
||
|
merge_num(minio);
|
||
|
+ merge_num(pg_timeout);
|
||
|
+ merge_num(flush_on_last_del);
|
||
|
+ merge_num(fast_io_fail);
|
||
|
+ merge_num(dev_loss);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
@@ -304,9 +303,6 @@ store_hwe (vector hwtable, struct hwentr
|
||
|
{
|
||
|
struct hwentry * hwe;
|
||
|
|
||
|
- if (find_hwe_strmatch(hwtable, dhwe))
|
||
|
- return 0;
|
||
|
-
|
||
|
if (!(hwe = alloc_hwe()))
|
||
|
return 1;
|
||
|
|
||
|
@@ -463,8 +459,6 @@ load_config (char * file)
|
||
|
if (!conf->hwtable)
|
||
|
goto out;
|
||
|
}
|
||
|
- if (setup_default_hwtable(conf->hwtable))
|
||
|
- goto out;
|
||
|
|
||
|
/*
|
||
|
* read the config file
|
||
|
@@ -494,6 +488,8 @@ load_config (char * file)
|
||
|
goto out;
|
||
|
}
|
||
|
}
|
||
|
+ if (setup_default_hwtable(conf->hwtable))
|
||
|
+ goto out;
|
||
|
/*
|
||
|
* remove duplica in hwtable. config file takes precedence
|
||
|
* over build-in hwtable
|