mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-24 17:57:48 +03:00
cleanup: simplier _lv_passes_volumes_filter
Don't recreate string and just check components directly.
This commit is contained in:
parent
a121340139
commit
bc0a3e2355
@ -114,7 +114,7 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic
|
|||||||
const struct dm_config_value *cv;
|
const struct dm_config_value *cv;
|
||||||
const char *str;
|
const char *str;
|
||||||
static char config_path[PATH_MAX];
|
static char config_path[PATH_MAX];
|
||||||
static char path[PATH_MAX];
|
size_t len = strlen(lv->vg->name);
|
||||||
|
|
||||||
config_def_get_path(config_path, sizeof(config_path), cfg_id);
|
config_def_get_path(config_path, sizeof(config_path), cfg_id);
|
||||||
log_verbose("%s configuration setting defined: "
|
log_verbose("%s configuration setting defined: "
|
||||||
@ -161,21 +161,12 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic
|
|||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strchr(str, '/')) {
|
|
||||||
/* vgname supplied */
|
/* If supplied name is vgname[/lvname] */
|
||||||
if (!strcmp(str, lv->vg->name))
|
if ((strncmp(str, lv->vg->name, len) == 0) &&
|
||||||
return 1;
|
(!str[len] ||
|
||||||
else
|
((str[len] == '/') &&
|
||||||
continue;
|
!strcmp(str + len + 1, lv->name))))
|
||||||
}
|
|
||||||
/* vgname/lvname */
|
|
||||||
if (dm_snprintf(path, sizeof(path), "%s/%s", lv->vg->name,
|
|
||||||
lv->name) < 0) {
|
|
||||||
log_error("dm_snprintf error from %s/%s", lv->vg->name,
|
|
||||||
lv->name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strcmp(path, str))
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user