mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
o It's a bit of a hack, but the regex filter now makes sure a device path
that passed the filter is at the front of the aliases list.
This commit is contained in:
parent
5e610278ad
commit
c3ceee769f
@ -93,8 +93,10 @@ int persistent_filter_load(struct dev_filter *f)
|
||||
goto out;
|
||||
}
|
||||
|
||||
_read_array(pf, cf, "persistent_filter_cache/valid_devices", PF_GOOD_DEVICE);
|
||||
_read_array(pf, cf, "persistent_filter_cache/invalid_devices", PF_BAD_DEVICE);
|
||||
_read_array(pf, cf, "persistent_filter_cache/valid_devices",
|
||||
PF_GOOD_DEVICE);
|
||||
_read_array(pf, cf, "persistent_filter_cache/invalid_devices",
|
||||
PF_BAD_DEVICE);
|
||||
|
||||
if (hash_get_num_entries(pf->devices))
|
||||
r = 1;
|
||||
@ -111,7 +113,7 @@ static void _write_array(struct pfilter *pf, FILE *fp, const char *path,
|
||||
int first = 1;
|
||||
struct hash_node *n;
|
||||
|
||||
for (n = hash_get_first(pf->devices); n;
|
||||
for (n = hash_get_first(pf->devices); n;
|
||||
n = hash_get_next(pf->devices, n)) {
|
||||
d = hash_get_data(pf->devices, n);
|
||||
|
||||
|
@ -149,7 +149,7 @@ static int _build_matcher(struct rfilter *rf, struct config_value *val)
|
||||
|
||||
static int _accept_p(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
int m, nothing_matched = 1;
|
||||
int m, nothing_matched = 1, first = 1;
|
||||
struct rfilter *rf = (struct rfilter *) f->private;
|
||||
struct list_head *tmp;
|
||||
struct str_list *sl;
|
||||
@ -161,9 +161,18 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
|
||||
if (m >= 0) {
|
||||
nothing_matched = 0;
|
||||
|
||||
if (bit(rf->accept, m))
|
||||
if (bit(rf->accept, m)) {
|
||||
|
||||
if (!first) {
|
||||
list_del(&sl->list);
|
||||
list_add(&sl->list, &dev->aliases);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
first = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user