mirror of
git://sourceware.org/git/lvm2.git
synced 2025-10-03 01:44:19 +03:00
Compare commits
13 Commits
dev-dct-cm
...
dev-dct-cm
Author | SHA1 | Date | |
---|---|---|---|
|
51dd97da82 | ||
|
f610e60388 | ||
|
902f14c750 | ||
|
e511af33d1 | ||
|
5976c34c3b | ||
|
c86166dac7 | ||
|
69530a6827 | ||
|
b5ba546e3c | ||
|
75732b65a4 | ||
|
a4d1ceb6d4 | ||
|
b5e373866d | ||
|
d81e37acf5 | ||
|
516068b8cc |
@@ -264,7 +264,7 @@ RULE: --alloc --discards --zero --cachemode --cachepolicy --cachesettings not lv
|
||||
# like above, it was previouly allowed in combination.
|
||||
|
||||
lvchange --resync VG|LV_raid_mirror|Tag|Select ...
|
||||
OO: --activate Active, OO_LVCHANGE
|
||||
OO: --activate Activate, OO_LVCHANGE
|
||||
ID: lvchange_resync
|
||||
DESC: Resyncronize a mirror or raid LV.
|
||||
RULE: all not lv_is_pvmove lv_is_locked
|
||||
@@ -517,15 +517,6 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
---
|
||||
|
||||
lvconvert --mergethin LV_thin ...
|
||||
OO: OO_LVCONVERT
|
||||
ID: lvconvert_merge_thin
|
||||
DESC: Merge thin LV into its origin LV.
|
||||
RULE: all not lv_is_locked lv_is_pvmove lv_is_merging_origin lv_is_virtual_origin lv_is_external_origin lv_is_merging_cow
|
||||
RULE: all and lv_is_visible
|
||||
|
||||
---
|
||||
|
||||
# lvconvert snapshot-related utilities
|
||||
# Create a new command set for these and migrate them out of lvconvert?
|
||||
|
||||
@@ -641,7 +632,12 @@ OO_LVCREATE_CACHE: --cachemode CacheMode, --cachepolicy String, --cachesettings
|
||||
|
||||
OO_LVCREATE_POOL: --poolmetadatasize SizeMB, --poolmetadataspare Bool, --chunksize SizeKB
|
||||
|
||||
OO_LVCREATE_THIN: --discards Discards, --errorwhenfull Bool
|
||||
# FIXME: it's silly to include --mirrors 0 here. Fix the tests to not use
|
||||
# --mirrors 0 in commands that do not accept any non-zero --mirrors
|
||||
# option, and then remove this. Accepting an option, only so that the
|
||||
# option's value can invalidate the use of the option is not advisable.
|
||||
|
||||
OO_LVCREATE_THIN: --discards Discards, --errorwhenfull Bool, --mirrors 0
|
||||
|
||||
OO_LVCREATE_RAID: --mirrors SNumber, --stripes Number, --stripesize SizeKB,
|
||||
--regionsize SizeMB, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB
|
||||
@@ -664,10 +660,15 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
---
|
||||
|
||||
# FIXME: consider removing the --mirrors 0, --stripes 1 options
|
||||
# and just reporting an error (or ignoring) if mirrors or stripes
|
||||
# options are given. Same reasoning as above: it's confusing to
|
||||
# advertise an option when the only value accepted for the option
|
||||
# makes the option do nothing.
|
||||
|
||||
lvcreate --type linear --size SizeMB VG
|
||||
OO: OO_LVCREATE
|
||||
OO: --mirrors 0, --stripes 1, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0, --stripes 1
|
||||
ID: lvcreate_linear
|
||||
DESC: Create a linear LV.
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
@@ -677,9 +678,8 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# to people to not see the name parameter.
|
||||
|
||||
lvcreate --size SizeMB VG
|
||||
OO: --type linear, OO_LVCREATE
|
||||
OO: --type linear, --mirrors 0, --stripes 1, OO_LVCREATE
|
||||
OP: PV ...
|
||||
IO: --mirrors 0, --stripes 1
|
||||
ID: lvcreate_linear
|
||||
DESC: Create a linear LV (default --type linear).
|
||||
DESC: When --name is omitted, the name is generated.
|
||||
@@ -769,7 +769,6 @@ lvcreate --type thin-pool --size SizeMB VG
|
||||
OO: --thinpool LV_new, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thinpool
|
||||
DESC: Create a thin pool.
|
||||
|
||||
@@ -778,7 +777,6 @@ lvcreate --thin --size SizeMB VG
|
||||
OO: --type thin-pool, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thinpool
|
||||
DESC: Create a thin pool (variant, infers --type thin-pool).
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
@@ -788,7 +786,6 @@ lvcreate --size SizeMB --thinpool LV_new VG
|
||||
OO: --thin, --type thin-pool, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thinpool
|
||||
DESC: Create a thin pool named by the --thinpool arg
|
||||
DESC: (variant, infers --type thin-pool).
|
||||
@@ -820,14 +817,12 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
lvcreate --type thin --virtualsize SizeMB --thinpool LV_thinpool VG
|
||||
OO: --thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol
|
||||
DESC: Create a thin LV in a thin pool.
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --type thin --virtualsize SizeMB LV_thinpool
|
||||
OO: --thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol
|
||||
DESC: Create a thin LV in a thin pool named in the first arg
|
||||
DESC: (variant, also see --thinpool for naming pool).
|
||||
@@ -839,7 +834,6 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --virtualsize SizeMB --thinpool LV_thinpool VG
|
||||
OO: --type thin, --thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol
|
||||
DESC: Create a thin LV in a thin pool (variant, infers --type thin).
|
||||
FLAGS: SECONDARY_SYNTAX
|
||||
@@ -847,7 +841,6 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --virtualsize SizeMB LV_thinpool
|
||||
OO: --type thin, --thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol
|
||||
DESC: Create a thin LV in the thin pool named in the first arg
|
||||
DESC: (variant, infers --type thin, also see --thinpool for
|
||||
@@ -858,14 +851,12 @@ FLAGS: SECONDARY_SYNTAX
|
||||
|
||||
lvcreate --type thin LV_thin
|
||||
OO: --thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV.
|
||||
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --thin LV_thin
|
||||
OO: --type thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV
|
||||
DESC: (infers --type thin).
|
||||
@@ -874,27 +865,33 @@ FLAGS: SECONDARY_SYNTAX
|
||||
# alternate form of lvcreate --type thin
|
||||
lvcreate --snapshot LV_thin
|
||||
OO: --type thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot
|
||||
DESC: Create a thin LV that is a snapshot of an existing thin LV
|
||||
DESC: (infers --type thin).
|
||||
|
||||
lvcreate --type thin --thinpool LV_thinpool LV
|
||||
OO: --thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot_of_external
|
||||
DESC: Create a thin LV that is a snapshot of an external origin LV.
|
||||
|
||||
# alternate form of lvcreate --type thin --thinpool LV_thinpool LV
|
||||
lvcreate --snapshot --thinpool LV_thinpool LV
|
||||
OO: --type thin, OO_LVCREATE_THIN, OO_LVCREATE
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_snapshot_of_external
|
||||
DESC: Create a thin LV that is a snapshot of an external origin LV
|
||||
DESC: (infers --type thin).
|
||||
|
||||
---
|
||||
|
||||
lvconvert --mergethin LV_thin ...
|
||||
OO: OO_LVCONVERT
|
||||
ID: lvconvert_merge_thin
|
||||
DESC: Merge thin LV into its origin LV.
|
||||
RULE: all not lv_is_locked lv_is_pvmove lv_is_merging_origin lv_is_virtual_origin lv_is_external_origin lv_is_merging_cow
|
||||
RULE: all and lv_is_visible
|
||||
|
||||
---
|
||||
|
||||
# stripes option is not intuitive when creating a thin LV,
|
||||
# but here it applies to creating the new thin pool that
|
||||
# is used for the thin LV
|
||||
@@ -915,7 +912,6 @@ lvcreate --type thin --virtualsize SizeMB --size SizeMB --thinpool LV_new
|
||||
OO: --thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_and_thinpool
|
||||
DESC: Create a thin LV, first creating a thin pool for it,
|
||||
DESC: where the new thin pool is named by the --thinpool arg.
|
||||
@@ -925,7 +921,6 @@ lvcreate --thin --virtualsize SizeMB --size SizeMB --thinpool LV_new
|
||||
OO: --type thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_and_thinpool
|
||||
DESC: Create a thin LV, first creating a thin pool for it,
|
||||
DESC: where the new thin pool is named by the --thinpool arg
|
||||
@@ -937,7 +932,6 @@ lvcreate --type thin --virtualsize SizeMB --size SizeMB LV_new|VG
|
||||
OO: --thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_and_thinpool
|
||||
DESC: Create a thin LV, first creating a thin pool for it,
|
||||
DESC: where the new thin pool is named in the first arg,
|
||||
@@ -950,7 +944,6 @@ lvcreate --thin --virtualsize SizeMB --size SizeMB LV_new|VG
|
||||
OO: --type thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_and_thinpool
|
||||
DESC: Create a thin LV, first creating a thin pool for it,
|
||||
DESC: where the new thin pool is named in the first arg,
|
||||
@@ -964,7 +957,6 @@ lvcreate --size SizeMB --virtualsize SizeMB VG
|
||||
OO: --type thin, --type snapshot, --thin, --snapshot, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE,
|
||||
--stripes Number, --stripesize SizeKB
|
||||
OP: PV ...
|
||||
IO: --mirrors 0
|
||||
ID: lvcreate_thin_vol_with_thinpool_or_sparse_snapshot
|
||||
DESC: Create a thin LV, first creating a thin pool for it
|
||||
DESC: (infers --type thin).
|
||||
|
@@ -51,9 +51,8 @@ struct command_name {
|
||||
*/
|
||||
|
||||
/* arg_def flags */
|
||||
#define ARG_DEF_FLAG_NEW_VG 1 << 0
|
||||
#define ARG_DEF_FLAG_NEW_LV 1 << 1
|
||||
#define ARG_DEF_FLAG_MAY_REPEAT 1 << 2
|
||||
#define ARG_DEF_FLAG_NEW 1 << 0
|
||||
#define ARG_DEF_FLAG_MAY_REPEAT 1 << 1
|
||||
|
||||
static inline int val_bit_is_set(uint64_t val_bits, int val_enum)
|
||||
{
|
||||
@@ -145,7 +144,6 @@ struct cmd_rule {
|
||||
#define CMD_OO_ARGS 150 /* optional opt args */
|
||||
#define CMD_RP_ARGS 8 /* required positional args */
|
||||
#define CMD_OP_ARGS 8 /* optional positional args */
|
||||
#define CMD_IO_ARGS 8 /* ignore opt args */
|
||||
#define CMD_MAX_RULES 32 /* max number of rules per command def */
|
||||
|
||||
/*
|
||||
@@ -187,16 +185,12 @@ struct command {
|
||||
/* optional positional args */
|
||||
struct pos_arg optional_pos_args[CMD_OP_ARGS];
|
||||
|
||||
/* unused opt args, are ignored instead of causing an error */
|
||||
struct opt_arg ignore_opt_args[CMD_IO_ARGS];
|
||||
|
||||
struct cmd_rule rules[CMD_MAX_RULES];
|
||||
|
||||
int ro_count;
|
||||
int oo_count;
|
||||
int rp_count;
|
||||
int op_count;
|
||||
int io_count;
|
||||
|
||||
/* used for processing current position */
|
||||
int pos_count;
|
||||
|
@@ -182,9 +182,8 @@ static struct cmd_name cmd_names[MAX_CMD_NAMES] = {
|
||||
#define MAX_LINE 1024
|
||||
#define MAX_LINE_ARGC 256
|
||||
|
||||
#define REQUIRED 1 /* required option */
|
||||
#define OPTIONAL 0 /* optional option */
|
||||
#define IGNORE -1 /* ignore option */
|
||||
#define REQUIRED 1
|
||||
#define OPTIONAL 0
|
||||
|
||||
struct oo_line {
|
||||
char *name;
|
||||
@@ -544,13 +543,6 @@ static int is_oo_line(char *str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_io_line(char *str)
|
||||
{
|
||||
if (!strncmp(str, "IO:", 3))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_op_line(char *str)
|
||||
{
|
||||
if (!strncmp(str, "OP:", 3))
|
||||
@@ -616,12 +608,8 @@ static void set_pos_def(struct command *cmd, char *str, struct arg_def *def)
|
||||
if ((val_enum == lv_VAL) && strstr(name, "_"))
|
||||
def->lvt_bits = lv_to_bits(name);
|
||||
|
||||
if (strstr(name, "_new")) {
|
||||
if (val_enum == lv_VAL)
|
||||
def->flags |= ARG_DEF_FLAG_NEW_LV;
|
||||
else if (val_enum == vg_VAL)
|
||||
def->flags |= ARG_DEF_FLAG_NEW_VG;
|
||||
}
|
||||
if (strstr(name, "_new"))
|
||||
def->flags |= ARG_DEF_FLAG_NEW;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -673,12 +661,9 @@ static void set_opt_def(struct command *cmd, char *str, struct arg_def *def)
|
||||
def->lvt_bits = lv_to_bits(name);
|
||||
}
|
||||
|
||||
if (strstr(name, "_new")) {
|
||||
if (val_enum == lv_VAL)
|
||||
def->flags |= ARG_DEF_FLAG_NEW_LV;
|
||||
else if (val_enum == vg_VAL)
|
||||
def->flags |= ARG_DEF_FLAG_NEW_VG;
|
||||
|
||||
if ((val_enum == vg_VAL) || (val_enum == lv_VAL) || (val_enum == pv_VAL)) {
|
||||
if (strstr(name, "_new"))
|
||||
def->flags |= ARG_DEF_FLAG_NEW;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,14 +788,10 @@ static void add_opt_arg(struct command *cmd, char *str, int *takes_arg, int requ
|
||||
|
||||
opt = opt_str_to_num(str);
|
||||
skip:
|
||||
if (required > 0)
|
||||
if (required)
|
||||
cmd->required_opt_args[cmd->ro_count++].opt = opt;
|
||||
else if (!required)
|
||||
cmd->optional_opt_args[cmd->oo_count++].opt = opt;
|
||||
else if (required < 0)
|
||||
cmd->ignore_opt_args[cmd->io_count++].opt = opt;
|
||||
else
|
||||
exit(1);
|
||||
cmd->optional_opt_args[cmd->oo_count++].opt = opt;
|
||||
|
||||
*takes_arg = opt_names[opt].val_enum ? 1 : 0;
|
||||
}
|
||||
@@ -833,14 +814,10 @@ static void update_prev_opt_arg(struct command *cmd, char *str, int required)
|
||||
|
||||
set_opt_def(cmd, str, &def);
|
||||
|
||||
if (required > 0)
|
||||
if (required)
|
||||
cmd->required_opt_args[cmd->ro_count-1].def = def;
|
||||
else if (!required)
|
||||
cmd->optional_opt_args[cmd->oo_count-1].def = def;
|
||||
else if (required < 0)
|
||||
cmd->ignore_opt_args[cmd->io_count-1].def = def;
|
||||
else
|
||||
exit(1);
|
||||
cmd->optional_opt_args[cmd->oo_count-1].def = def;
|
||||
}
|
||||
|
||||
static void add_pos_arg(struct command *cmd, char *str, int required)
|
||||
@@ -905,24 +882,6 @@ static void add_optional_opt_line(struct command *cmd, int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
static void add_ignore_opt_line(struct command *cmd, int argc, char *argv[])
|
||||
{
|
||||
int takes_arg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (!i && !strncmp(argv[i], "IO:", 3))
|
||||
continue;
|
||||
if (is_opt_name(argv[i]))
|
||||
add_opt_arg(cmd, argv[i], &takes_arg, IGNORE);
|
||||
else if (takes_arg)
|
||||
update_prev_opt_arg(cmd, argv[i], IGNORE);
|
||||
else
|
||||
printf("Can't parse argc %d argv %s prev %s\n",
|
||||
i, argv[i], argv[i-1]);
|
||||
}
|
||||
}
|
||||
|
||||
/* process what follows OP:, which are optional pos args */
|
||||
|
||||
static void add_optional_pos_line(struct command *cmd, int argc, char *argv[])
|
||||
@@ -1048,10 +1007,10 @@ static void print_def(struct arg_def *def, int usage)
|
||||
}
|
||||
}
|
||||
|
||||
if ((val_enum == vg_VAL) && (def->flags & ARG_DEF_FLAG_NEW_VG))
|
||||
printf("_new");
|
||||
if ((val_enum == lv_VAL) && (def->flags & ARG_DEF_FLAG_NEW_LV))
|
||||
printf("_new");
|
||||
if ((val_enum == pv_VAL) || (val_enum == vg_VAL) || (val_enum == lv_VAL)) {
|
||||
if (def->flags & ARG_DEF_FLAG_NEW)
|
||||
printf("_new");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1188,15 +1147,10 @@ static char *flags_to_str(int flags)
|
||||
strcat(buf_flags, " | ");
|
||||
strcat(buf_flags, "ARG_DEF_FLAG_MAY_REPEAT");
|
||||
}
|
||||
if (flags & ARG_DEF_FLAG_NEW_VG) {
|
||||
if (flags & ARG_DEF_FLAG_NEW) {
|
||||
if (buf_flags[0])
|
||||
strcat(buf_flags, " | ");
|
||||
strcat(buf_flags, "ARG_DEF_FLAG_NEW_VG");
|
||||
}
|
||||
if (flags & ARG_DEF_FLAG_NEW_LV) {
|
||||
if (buf_flags[0])
|
||||
strcat(buf_flags, " | ");
|
||||
strcat(buf_flags, "ARG_DEF_FLAG_NEW_LV");
|
||||
strcat(buf_flags, "ARG_DEF_FLAG_NEW");
|
||||
}
|
||||
|
||||
return buf_flags;
|
||||
@@ -1718,15 +1672,12 @@ static void print_def_man(struct arg_def *def, int usage)
|
||||
printf("\\fP");
|
||||
}
|
||||
|
||||
if ((val_enum == vg_VAL) && (def->flags & ARG_DEF_FLAG_NEW_VG)) {
|
||||
printf("\\fI");
|
||||
printf("_new");
|
||||
printf("\\fP");
|
||||
}
|
||||
if ((val_enum == lv_VAL) && (def->flags & ARG_DEF_FLAG_NEW_LV)) {
|
||||
printf("\\fI");
|
||||
printf("_new");
|
||||
printf("\\fP");
|
||||
if ((val_enum == pv_VAL) || (val_enum == vg_VAL) || (val_enum == lv_VAL)) {
|
||||
if (def->flags & ARG_DEF_FLAG_NEW) {
|
||||
printf("\\fI");
|
||||
printf("_new");
|
||||
printf("\\fP");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2428,7 +2379,7 @@ void print_man_command(void)
|
||||
void print_command_struct(int only_usage)
|
||||
{
|
||||
struct command *cmd;
|
||||
int i, j, ro, rp, oo, op, ru, ruo, io;
|
||||
int i, j, ro, rp, oo, op, ru, ruo;
|
||||
|
||||
include_optional_opt_args(&lvm_all, "OO_USAGE_COMMON");
|
||||
|
||||
@@ -2454,7 +2405,6 @@ void print_command_struct(int only_usage)
|
||||
printf("commands[%d].rp_count = %d;\n", i, cmd->rp_count);
|
||||
printf("commands[%d].oo_count = %d;\n", i, cmd->oo_count);
|
||||
printf("commands[%d].op_count = %d;\n", i, cmd->op_count);
|
||||
printf("commands[%d].io_count = %d;\n", i, cmd->io_count);
|
||||
printf("commands[%d].rule_count = %d;\n", i, cmd->rule_count);
|
||||
|
||||
if (cmd->cmd_flags)
|
||||
@@ -2560,35 +2510,6 @@ void print_command_struct(int only_usage)
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd->io_count) {
|
||||
for (io = 0; io < cmd->io_count; io++) {
|
||||
printf("commands[%d].ignore_opt_args[%d].opt = %s;\n",
|
||||
i, io, opt_to_enum_str(cmd->ignore_opt_args[io].opt));
|
||||
|
||||
if (!cmd->ignore_opt_args[io].def.val_bits)
|
||||
continue;
|
||||
|
||||
printf("commands[%d].ignore_opt_args[%d].def.val_bits = %s;\n",
|
||||
i, io, val_bits_to_str(cmd->ignore_opt_args[io].def.val_bits));
|
||||
|
||||
if (cmd->ignore_opt_args[io].def.lvt_bits)
|
||||
printf("commands[%d].ignore_opt_args[%d].def.lvt_bits = %s;\n",
|
||||
i, io, lvt_bits_to_str(cmd->ignore_opt_args[io].def.lvt_bits));
|
||||
|
||||
if (cmd->ignore_opt_args[io].def.flags)
|
||||
printf("commands[%d].ignore_opt_args[%d].def.flags = %s;\n",
|
||||
i, io, flags_to_str(cmd->ignore_opt_args[io].def.flags));
|
||||
|
||||
if (val_bit_is_set(cmd->ignore_opt_args[io].def.val_bits, constnum_VAL))
|
||||
printf("commands[%d].ignore_opt_args[%d].def.num = %d;\n",
|
||||
i, io, cmd->ignore_opt_args[io].def.num);
|
||||
|
||||
if (val_bit_is_set(cmd->ignore_opt_args[io].def.val_bits, conststr_VAL))
|
||||
printf("commands[%d].ignore_opt_args[%d].def.str = \"%s\";\n",
|
||||
i, io, cmd->ignore_opt_args[io].def.str ?: "NULL");
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd->op_count) {
|
||||
for (op = 0; op < cmd->op_count; op++) {
|
||||
printf("commands[%d].optional_pos_args[%d].pos = %d;\n",
|
||||
@@ -2755,18 +2676,13 @@ void print_option_list(void)
|
||||
|
||||
static void print_help(int argc, char *argv[])
|
||||
{
|
||||
printf("%s [options] --output <format> <filename>\n", argv[0]);
|
||||
printf("%s --output struct|count|usage|expanded <filename>\n", argv[0]);
|
||||
printf("\n");
|
||||
printf("output formats:\n");
|
||||
printf("struct: print C structures for command-lines.h\n");
|
||||
printf("count: print defines and enums for command-lines-count.h\n");
|
||||
printf("ambiguous: print commands differing only by LV types\n");
|
||||
printf("usage: print usage format.\n");
|
||||
printf("expanded: print expanded input format.\n");
|
||||
printf("man: print man page format.\n");
|
||||
printf("\n");
|
||||
printf("options:\n");
|
||||
printf("-c|--man-command <commandname> man output for one command name\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -2936,14 +2852,6 @@ int main(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
/* IO: ... */
|
||||
if (is_io_line(line_argv[0])) {
|
||||
add_ignore_opt_line(cmd, line_argc, line_argv);
|
||||
prev_was_oo = 0;
|
||||
prev_was_op = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* handle OO_FOO:, OO:, OP: continuing on multiple lines */
|
||||
|
||||
if (prev_was_oo_def) {
|
||||
|
@@ -1022,12 +1022,6 @@ static int _lvchange_properties_check(struct cmd_context *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vg_is_clustered(lv->vg) && lv_is_cache_origin(lv) && lv_is_raid(lv)) {
|
||||
log_error("Unable to change internal LV %s directly in a cluster.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -1154,25 +1154,6 @@ static int _opt_synonym_is_set(struct cmd_context *cmd, int opt_std)
|
||||
return opt_syn && arg_is_set(cmd, opt_syn);
|
||||
}
|
||||
|
||||
static int _command_ignore_opt_matches(struct cmd_context *cmd, int ci, int io)
|
||||
{
|
||||
int opt_enum = commands[ci].ignore_opt_args[io].opt;
|
||||
|
||||
if (val_bit_is_set(commands[ci].ignore_opt_args[io].def.val_bits, conststr_VAL)) {
|
||||
if (!strcmp(commands[ci].ignore_opt_args[io].def.str, arg_str_value(cmd, opt_enum, "")))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (val_bit_is_set(commands[ci].ignore_opt_args[io].def.val_bits, constnum_VAL)) {
|
||||
if (commands[ci].ignore_opt_args[io].def.num == arg_int_value(cmd, opt_enum, 0))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _command_required_opt_matches(struct cmd_context *cmd, int ci, int ro)
|
||||
{
|
||||
int opt_enum = commands[ci].required_opt_args[ro].opt;
|
||||
@@ -1634,14 +1615,6 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < commands[i].io_count; j++) {
|
||||
if ((commands[i].ignore_opt_args[j].opt == opt_enum) &&
|
||||
_command_ignore_opt_matches(cmd, i, j)) {
|
||||
accepted = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!accepted) {
|
||||
match_unused++;
|
||||
if (temp_unused_count < MAX_UNUSED_COUNT)
|
||||
|
Reference in New Issue
Block a user