1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix --[vg]metadatacopies arg processing

This commit is contained in:
Alasdair Kergon 2010-06-30 20:21:03 +00:00
parent 12eadbabdd
commit 77d308ef77
3 changed files with 15 additions and 23 deletions

View File

@ -23,8 +23,8 @@ arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
arg(nolocking_ARG, '\0', "nolocking", NULL, 0)
arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0)
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", vgmetadatacopies_arg, 0)
arg(metadatacopies_ARG, '\0', "metadatacopies", int_arg, 0)
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0)
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0)
arg(restorefile_ARG, '\0', "restorefile", string_arg, 0)

View File

@ -476,29 +476,22 @@ int readahead_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
/*
* Non-zero, positive integer, "all", or "unmanaged"
*/
int vgmetadatacopies_arg(struct cmd_context *cmd __attribute((unused)),
int metadatacopies_arg(struct cmd_context *cmd __attribute((unused)),
struct arg *a)
{
if (!strcasecmp(a->value, "all")) {
a->ui_value = VGMETADATACOPIES_ALL;
return 1;
if (!strncmp(cmd->command->name, "vg", 2)) {
if (!strcasecmp(a->value, "all")) {
a->ui_value = VGMETADATACOPIES_ALL;
return 1;
}
if (!strcasecmp(a->value, "unmanaged")) {
a->ui_value = VGMETADATACOPIES_UNMANAGED;
return 1;
}
}
if (!strcasecmp(a->value, "unmanaged")) {
a->ui_value = VGMETADATACOPIES_UNMANAGED;
return 1;
}
if (!_size_arg(cmd, a, 1))
return 0;
if (a->sign == SIGN_MINUS)
return 0;
if (!a->ui_value)
return 0;
return 1;
return int_arg(cmd, a);
}
static void __alloc(int size)

View File

@ -152,8 +152,7 @@ int units_arg(struct cmd_context *cmd, struct arg *a);
int segtype_arg(struct cmd_context *cmd, struct arg *a);
int alloc_arg(struct cmd_context *cmd, struct arg *a);
int readahead_arg(struct cmd_context *cmd, struct arg *a);
int vgmetadatacopies_arg(struct cmd_context *cmd __attribute((unused)),
struct arg *a);
int metadatacopies_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a);
/* we use the enums to access the switches */
unsigned arg_count(const struct cmd_context *cmd, int a);