mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
o rfilter now checks all aliases for a match
This commit is contained in:
parent
c7f0b573ac
commit
5e610278ad
@ -111,6 +111,11 @@ static int _insert_dev(const char *path, dev_t d)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hash_insert(_cache.names, path, dev)) {
|
||||||
|
log_err("Couldn't add name to hash in dir cache.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "bitset.h"
|
#include "bitset.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
struct rfilter {
|
struct rfilter {
|
||||||
struct pool *mem;
|
struct pool *mem;
|
||||||
@ -148,17 +149,28 @@ static int _build_matcher(struct rfilter *rf, struct config_value *val)
|
|||||||
|
|
||||||
static int _accept_p(struct dev_filter *f, struct device *dev)
|
static int _accept_p(struct dev_filter *f, struct device *dev)
|
||||||
{
|
{
|
||||||
int m;
|
int m, nothing_matched = 1;
|
||||||
struct rfilter *rf = (struct rfilter *) f->private;
|
struct rfilter *rf = (struct rfilter *) f->private;
|
||||||
|
struct list_head *tmp;
|
||||||
|
struct str_list *sl;
|
||||||
|
|
||||||
m = matcher_run(rf->engine, dev_name(dev));
|
list_for_each(tmp, &dev->aliases) {
|
||||||
|
sl = list_entry(tmp, struct str_list, list);
|
||||||
|
m = matcher_run(rf->engine, sl->str);
|
||||||
|
|
||||||
|
if (m >= 0) {
|
||||||
|
nothing_matched = 0;
|
||||||
|
|
||||||
|
if (bit(rf->accept, m))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pass everything that doesn't match,
|
* pass everything that doesn't match
|
||||||
* otherwise look it up in the accepts
|
* anything.
|
||||||
* bitset.
|
|
||||||
*/
|
*/
|
||||||
return (m < 0) ? 1 : bit(rf->accept, m);
|
return nothing_matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _destroy(struct dev_filter *f)
|
static void _destroy(struct dev_filter *f)
|
||||||
|
Loading…
Reference in New Issue
Block a user