mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
filters: allow filter wipe for one device
as passes_filter already does
This commit is contained in:
parent
83d0818523
commit
c601ec0d6e
@ -28,7 +28,7 @@ struct cmd_context;
|
||||
struct dev_filter {
|
||||
int (*passes_filter) (struct cmd_context *cmd, struct dev_filter *f, struct device *dev, const char *use_filter_name);
|
||||
void (*destroy) (struct dev_filter *f);
|
||||
void (*wipe) (struct dev_filter *f);
|
||||
void (*wipe) (struct cmd_context *cmd, struct dev_filter *f, struct device *dev, const char *use_filter_name);
|
||||
void *private;
|
||||
unsigned use_count;
|
||||
const char *name;
|
||||
|
@ -60,13 +60,16 @@ static void _composite_destroy(struct dev_filter *f)
|
||||
free(f);
|
||||
}
|
||||
|
||||
static void _wipe(struct dev_filter *f)
|
||||
static void _wipe(struct cmd_context *cmd, struct dev_filter *f, struct device *dev, const char *use_filter_name)
|
||||
{
|
||||
struct dev_filter **filters;
|
||||
|
||||
for (filters = (struct dev_filter **) f->private; *filters; ++filters)
|
||||
for (filters = (struct dev_filter **) f->private; *filters; ++filters) {
|
||||
if (use_filter_name && strcmp((*filters)->name, use_filter_name))
|
||||
continue;
|
||||
if ((*filters)->wipe)
|
||||
(*filters)->wipe(*filters);
|
||||
(*filters)->wipe(cmd, *filters, dev, use_filter_name);
|
||||
}
|
||||
}
|
||||
|
||||
struct dev_filter *composite_filter_create(int n, int use_dev_ext_info, struct dev_filter **filters)
|
||||
|
@ -64,11 +64,17 @@ static int _init_hash(struct pfilter *pf)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _persistent_filter_wipe(struct dev_filter *f)
|
||||
static void _persistent_filter_wipe(struct cmd_context *cmd, struct dev_filter *f, struct device *dev, const char *use_filter_name)
|
||||
{
|
||||
struct pfilter *pf = (struct pfilter *) f->private;
|
||||
struct dm_str_list *sl;
|
||||
|
||||
if (!dev) {
|
||||
dm_hash_wipe(pf->devices);
|
||||
} else {
|
||||
dm_list_iterate_items(sl, &dev->aliases)
|
||||
dm_hash_remove(pf->devices, sl->str);
|
||||
}
|
||||
}
|
||||
|
||||
static int _lookup_p(struct cmd_context *cmd, struct dev_filter *f, struct device *dev, const char *use_filter_name)
|
||||
|
Loading…
Reference in New Issue
Block a user