1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-10-12 07:33:16 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
David Teigland
442e43b120 commands: new method for defining commands
The new file command-lines.in defines a prototype for every
unique lvm command.  A unique lvm command is a unique
combination of: command name + required option args +
required positional args.  Each of these prototypes also
includes the optional option args and optional positional
args that the command will accept, a description, and a
unique string ID for the definition.  Any valid command
will match one of the prototypes.

Here's an example of the lvresize command definitions from
command-lines.in, there are three unique lvresize commands:

lvresize --size SizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
--stripes Number, --stripesize SizeKB, --test, --poolmetadatasize SizeMB
OP: PV ...
ID: lvresize_by_size
DESC: Resize an LV by a specified size.

lvresize LV PV ...
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB,
--test
ID: lvresize_by_pv
DESC: Resize an LV by a specified PV.

lvresize --poolmetadatasize SizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --stripes Number, --stripesize SizeKB,
--test
OP: PV ...
ID: lvresize_pool_metadata_by_size
DESC: Resize the metadata SubLV of a pool LV.

The three commands have separate definitions because they have
different required parameters.  Required parameters are specified
on the first line of the definition.  Optional options are
listed after OO, and optional positional args are listed after OP.

This data is used to generate corresponding command definition
structures for lvm in command-lines.h.  "usage" text is also
generated, so it is always in sync with the definitions.

Example of the corresponding generated structure in
command-lines.h for the first lvresize prototype
(these structures are never edited directly):

commands[78].name = "lvresize";
commands[78].command_line_id = "lvresize_by_size";
commands[78].command_line_enum = lvresize_by_size_CMD;
commands[78].fn = lvresize;
commands[78].ro_count = 1;
commands[78].rp_count = 1;
commands[78].oo_count = 22;
commands[78].op_count = 1;
commands[78].desc = "DESC: Resize an LV by a specified size.";
commands[78].usage = "lvresize --size Number[m|unit] LV"
" [ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit,
   --autobackup y|n, --nofsck, --nosync, --reportformat String,
   --resizefs, --stripes Number, --stripesize Number[k|unit],
   --poolmetadatasize Number[m|unit] ]"
" [ PV ... ]";
commands[78].usage_common =
" [ --commandprofile String, --config String, --debug,
    --driverloaded y|n, --help, --profile String, --quiet,
    --verbose, --version, --yes, --force, --test, --noudevsync ]";
commands[78].required_opt_args[0].opt = size_ARG;
commands[78].required_opt_args[0].def.val_bits = val_enum_to_bit(sizemb_VAL);
commands[78].required_pos_args[0].pos = 1;
commands[78].required_pos_args[0].def.val_bits = val_enum_to_bit(lv_VAL);
commands[78].optional_opt_args[0].opt = commandprofile_ARG;
commands[78].optional_opt_args[0].def.val_bits = val_enum_to_bit(string_VAL);
commands[78].optional_opt_args[1].opt = config_ARG;
commands[78].optional_opt_args[1].def.val_bits = val_enum_to_bit(string_VAL);
commands[78].optional_opt_args[2].opt = debug_ARG;
commands[78].optional_opt_args[3].opt = driverloaded_ARG;
commands[78].optional_opt_args[3].def.val_bits = val_enum_to_bit(bool_VAL);
commands[78].optional_opt_args[4].opt = help_ARG;
commands[78].optional_opt_args[5].opt = profile_ARG;
commands[78].optional_opt_args[5].def.val_bits = val_enum_to_bit(string_VAL);
commands[78].optional_opt_args[6].opt = quiet_ARG;
commands[78].optional_opt_args[7].opt = verbose_ARG;
commands[78].optional_opt_args[8].opt = version_ARG;
commands[78].optional_opt_args[9].opt = yes_ARG;
commands[78].optional_opt_args[10].opt = alloc_ARG;
commands[78].optional_opt_args[10].def.val_bits = val_enum_to_bit(alloc_VAL);
commands[78].optional_opt_args[11].opt = autobackup_ARG;
commands[78].optional_opt_args[11].def.val_bits = val_enum_to_bit(bool_VAL);
commands[78].optional_opt_args[12].opt = force_ARG;
commands[78].optional_opt_args[13].opt = nofsck_ARG;
commands[78].optional_opt_args[14].opt = nosync_ARG;
commands[78].optional_opt_args[15].opt = noudevsync_ARG;
commands[78].optional_opt_args[16].opt = reportformat_ARG;
commands[78].optional_opt_args[16].def.val_bits = val_enum_to_bit(string_VAL);
commands[78].optional_opt_args[17].opt = resizefs_ARG;
commands[78].optional_opt_args[18].opt = stripes_ARG;
commands[78].optional_opt_args[18].def.val_bits = val_enum_to_bit(number_VAL);
commands[78].optional_opt_args[19].opt = stripesize_ARG;
commands[78].optional_opt_args[19].def.val_bits = val_enum_to_bit(sizekb_VAL);
commands[78].optional_opt_args[20].opt = test_ARG;
commands[78].optional_opt_args[21].opt = poolmetadatasize_ARG;
commands[78].optional_opt_args[21].def.val_bits = val_enum_to_bit(sizemb_VAL);
commands[78].optional_pos_args[0].pos = 2;
commands[78].optional_pos_args[0].def.val_bits = val_enum_to_bit(pv_VAL);
commands[78].optional_pos_args[0].def.flags = ARG_DEF_FLAG_MAY_REPEAT;

Every user-entered command is compared against the set of
command structures, and matched with one.  An error is
reported if an entered command does not have the required
parameters for any definition.  The closest match is printed
as a suggestion, and running lvresize --help will display
the usage for each possible lvresize command, e.g.:

$ lvresize --help
  lvresize - Resize a logical volume

  Resize an LV by a specified size.
  lvresize --size Number[m|unit] LV
  	[ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit,
	  --autobackup y|n,
	  --nofsck,
	  --nosync,
	  --reportformat String,
	  --resizefs,
	  --stripes Number,
	  --stripesize Number[k|unit],
	  --poolmetadatasize Number[m|unit] ]
  	[ PV ... ]

  Resize an LV by a specified PV.
  lvresize LV PV ...
  	[ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit,
	  --autobackup y|n,
	  --nofsck,
	  --nosync,
	  --reportformat String,
	  --resizefs,
	  --stripes Number,
	  --stripesize Number[k|unit] ]

  Resize the metadata SubLV of a pool LV.
  lvresize --poolmetadatasize Number[m|unit] LV_thinpool
  	[ --alloc contiguous|cling|cling_by_tags|normal|anywhere|inherit,
	  --autobackup y|n,
	  --nofsck,
	  --nosync,
	  --reportformat String,
	  --stripes Number,
	  --stripesize Number[k|unit] ]
  	[ PV ... ]

  Common options:
  	[ --commandprofile String,
	  --config String,
	  --debug,
	  --driverloaded y|n,
	  --help,
	  --profile String,
	  --quiet,
	  --verbose,
	  --version,
	  --yes,
	  --force,
	  --test,
	  --noudevsync ]

  (Use --help --help for usage notes.)

$ lvresize --poolmetadatasize 4
  Failed to find a matching command definition.
  Closest command usage is:
  lvresize --poolmetadatasize Number[m|unit] LV_thinpool

Very early in command execution, a matching command is
found, and lvm knows the specific operation being done,
and that the command conforms to the prototype.
This will allow a lot of ad hoc checking/validation to
be removed throughout the code.

Each command definition can also be routed to a specific
function to implement it.  The function is associated with
an enum value for the command definition (generated from
the ID string.)

In the absence of a command-definintion-specific function,
the existing command-name function is used.  Using
specific functions for each definition allows a lot of
code to be removed which tries to figure out what the
command is meant to be doing based on various option
combinations.  What the command is doing is already known
because the command is associated with a definition.

So, this first phase just validates every user-entered
command against the set of command prototypes, then calls
the existing implementation.  The second phase can
associate an implementation function with each definition,
and take further advantage of the known operation to
avoid the complicated option analysis that is currently
used to figure out what the command is supposed to do.

(Man page prototype sections can also be generated, but
this is not yet being used.)
2016-10-12 17:32:11 -05:00
6 changed files with 5761 additions and 4667 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -548,6 +548,13 @@ static int is_desc_line(char *str)
return 0;
}
static int is_id_line(char *str)
{
if (!strncmp(str, "ID:", 3))
return 1;
return 0;
}
/*
* parse str for anything that can appear in a position,
* like VG, VG|LV, VG|LV_linear|LV_striped, etc
@@ -1054,6 +1061,52 @@ void print_expanded(void)
}
}
static int opt_arg_matches(struct opt_arg *oa1, struct opt_arg *oa2)
{
if (oa1->opt != oa2->opt)
return 0;
/* FIXME: some cases may need more specific val_bits checks */
if (oa1->def.val_bits != oa2->def.val_bits)
return 0;
if (oa1->def.str && oa2->def.str && strcmp(oa1->def.str, oa2->def.str))
return 0;
if (oa1->def.num != oa2->def.num)
return 0;
/*
* Do NOT compare lv_types because we are checking if two
* command lines are ambiguous before the LV type is known.
*/
return 1;
}
static int pos_arg_matches(struct pos_arg *pa1, struct pos_arg *pa2)
{
if (pa1->pos != pa2->pos)
return 0;
/* FIXME: some cases may need more specific val_bits checks */
if (pa1->def.val_bits != pa2->def.val_bits)
return 0;
if (pa1->def.str && pa2->def.str && strcmp(pa1->def.str, pa2->def.str))
return 0;
if (pa1->def.num != pa2->def.num)
return 0;
/*
* Do NOT compare lv_types because we are checking if two
* command lines are ambiguous before the LV type is known.
*/
return 1;
}
static const char *opt_to_enum_str(int opt)
{
return opt_names[opt].name;
@@ -1073,11 +1126,35 @@ static char *flags_to_str(int flags)
return buf_flags;
}
void print_define_command_count(void)
void print_command_count(void)
{
struct command *cmd;
int i, j;
printf("/* Do not edit. This file is generated by scripts/create-commands */\n");
printf("/* using command definitions from scripts/command-lines.in */\n");
printf("#define COMMAND_COUNT %d\n", cmd_count);
printf("enum {\n");
for (i = 0; i < cmd_count; i++) {
cmd = &cmd_array[i];
if (!cmd->command_line_id) {
printf("Missing ID: at %d\n", i);
exit(1);
}
for (j = 0; j < i; j++) {
if (!strcmp(cmd->command_line_id, cmd_array[j].command_line_id))
goto next;
}
printf("\t%s_CMD,\n", cmd->command_line_id);
next:
;
}
printf("\tCOMMAND_ID_COUNT,\n");
printf("};\n");
}
static int is_common_opt(int opt)
@@ -1203,6 +1280,7 @@ void print_command_struct(int only_usage)
printf("/* Do not edit. This file is generated by scripts/create-commands */\n");
printf("/* using command definitions from scripts/command-lines.in */\n");
printf("\n");
for (i = 0; i < cmd_count; i++) {
cmd = &cmd_array[i];
@@ -1215,6 +1293,8 @@ void print_command_struct(int only_usage)
}
printf("commands[%d].name = \"%s\";\n", i, cmd->name);
printf("commands[%d].command_line_id = \"%s\";\n", i, cmd->command_line_id);
printf("commands[%d].command_line_enum = %s_CMD;\n", i, cmd->command_line_id);
printf("commands[%d].fn = %s;\n", i, cmd->name);
printf("commands[%d].ro_count = %d;\n", i, cmd->ro_count);
printf("commands[%d].rp_count = %d;\n", i, cmd->rp_count);
@@ -1355,6 +1435,67 @@ void print_command_struct(int only_usage)
}
}
struct cmd_pair {
int i, j;
};
static void print_ambiguous(void)
{
struct command *cmd, *dup;
struct cmd_pair dups[64] = { 0 };
int found = 0;
int i, j, f, ro, rp;
for (i = 0; i < cmd_count; i++) {
cmd = &cmd_array[i];
for (j = 0; j < cmd_count; j++) {
dup = &cmd_array[j];
if (i == j)
continue;
if (strcmp(cmd->name, dup->name))
continue;
if (cmd->ro_count != dup->ro_count)
continue;
if (cmd->oo_count != dup->oo_count)
continue;
if (cmd->rp_count != dup->rp_count)
continue;
if (cmd->op_count != dup->op_count)
continue;
for (ro = 0; ro < cmd->ro_count; ro++) {
if (!opt_arg_matches(&cmd->required_opt_args[ro],
&dup->required_opt_args[ro]))
goto next;
}
for (rp = 0; rp < cmd->rp_count; rp++) {
if (!pos_arg_matches(&cmd->required_pos_args[rp],
&dup->required_pos_args[rp]))
goto next;
}
for (f = 0; f < found; f++) {
if ((dups[f].i == j) && (dups[f].j == i))
goto next;
}
printf("Ambiguous commands %d and %d:\n", i, j);
print_usage(cmd, 0);
print_usage(dup, 0);
printf("\n");
dups[found].i = i;
dups[found].j = j;
found++;
next:
;
}
}
}
void print_command_list(void)
{
int i;
@@ -1383,10 +1524,11 @@ static void print_help(int argc, char *argv[])
{
printf("%s --output struct|count|usage|expanded <filename>\n", argv[0]);
printf("\n");
printf("struct: print C structures.\n");
printf("usage: print usage format.\n");
printf("expanded: print expanded input format.\n");
printf("count: print #define COMMAND_COUNT <Number>\n");
printf("struct: print C structures.\n");
printf("usage: print usage format.\n");
printf("expanded: print expanded input format.\n");
printf("count: print #define COMMAND_COUNT <Number>\n");
printf("ambiguous: print commands differing only by LV types\n");
}
int main(int argc, char *argv[])
@@ -1460,6 +1602,8 @@ int main(int argc, char *argv[])
continue;
if (line[0] == '\n')
continue;
if (line[0] == '-' && line[1] == '-' && line[2] == '-')
continue;
if ((n = strchr(line, '\n')))
*n = '\0';
@@ -1498,6 +1642,11 @@ int main(int argc, char *argv[])
continue;
}
if (is_id_line(line_argv[0])) {
cmd->command_line_id = strdup(line_argv[1]);
continue;
}
/* OO_FOO: ... */
if (is_oo_definition(line_argv[0])) {
add_oo_definition_line(line_argv[0], line_orig);
@@ -1550,11 +1699,13 @@ int main(int argc, char *argv[])
else if (!strcmp(outputformat, "struct"))
print_command_struct(0);
else if (!strcmp(outputformat, "count"))
print_define_command_count();
print_command_count();
else if (!strcmp(outputformat, "usage"))
print_command_struct(1);
else if (!strcmp(outputformat, "expanded"))
print_expanded();
else if (!strcmp(outputformat, "ambiguous"))
print_ambiguous();
else
print_help(argc, argv);
}

View File

@@ -1,3 +1,132 @@
/* Do not edit. This file is generated by scripts/create-commands */
/* using command definitions from scripts/command-lines.in */
#define COMMAND_COUNT 144
#define COMMAND_COUNT 146
enum {
lvchange_properties_CMD,
lvchange_resync_CMD,
lvchange_syncaction_CMD,
lvchange_rebuild_CMD,
lvchange_activate_CMD,
lvchange_refresh_CMD,
lvchange_monitor_CMD,
lvchange_poll_CMD,
lvchange_persistent_CMD,
lvconvert_merge_CMD,
lvconvert_combine_split_snapshot_CMD,
lvconvert_to_thin_with_external_CMD,
lvconvert_to_cache_vol_CMD,
lvconvert_to_thinpool_CMD,
lvconvert_to_cachepool_CMD,
lvconvert_to_mirror_CMD,
lvconvert_to_mirror_or_raid1_CMD,
lvconvert_raid1_to_mirror_CMD,
lvconvert_mirror_to_raid1_CMD,
lvconvert_general_to_raid_CMD,
lvconvert_change_mirror_images_CMD,
lvconvert_raid_to_striped_CMD,
lvconvert_raid_or_mirror_to_linear_CMD,
lvconvert_split_mirror_images_to_new_CMD,
lvconvert_split_mirror_images_and_track_CMD,
lvconvert_repair_pvs_or_thinpool_CMD,
lvconvert_replace_pv_CMD,
lvconvert_change_mirrorlog_CMD,
lvconvert_split_and_keep_cachepool_CMD,
lvconvert_split_and_delete_cachepool_CMD,
lvconvert_split_cow_snapshot_CMD,
lvconvert_poll_mirror_CMD,
lvconvert_swap_pool_metadata_CMD,
lvcreate_error_vol_CMD,
lvcreate_zero_vol_CMD,
lvcreate_linear_CMD,
lvcreate_striped_CMD,
lvcreate_mirror_CMD,
lvcreate_raid_any_CMD,
lvcreate_cow_snapshot_CMD,
lvcreate_cow_snapshot_with_virtual_origin_CMD,
lvcreate_thinpool_CMD,
lvcreate_cachepool_CMD,
lvcreate_thin_vol_CMD,
lvcreate_thin_snapshot_CMD,
lvcreate_thin_snapshot_of_external_CMD,
lvcreate_thin_vol_with_thinpool_CMD,
lvcreate_thin_vol_with_thinpool_or_sparse_snapshot_CMD,
lvcreate_convert_to_cache_vol_with_cachepool_CMD,
lvcreate_cache_vol_with_new_origin_CMD,
lvdisplay_general_CMD,
lvextend_by_size_CMD,
lvextend_by_pv_CMD,
lvextend_pool_metadata_by_size_CMD,
lvextend_by_policy_CMD,
lvmconfig_general_CMD,
lvreduce_general_CMD,
lvremove_general_CMD,
lvrename_vg_lv_lv_CMD,
lvrename_lv_lv_CMD,
lvresize_by_size_CMD,
lvresize_by_pv_CMD,
lvresize_pool_metadata_by_size_CMD,
lvs_general_CMD,
lvscan_general_CMD,
pvchange_properties_all_CMD,
pvchange_properties_some_CMD,
pvresize_general_CMD,
pvck_general_CMD,
pvcreate_general_CMD,
pvdisplay_general_CMD,
pvmove_one_CMD,
pvmove_any_CMD,
pvremove_general_CMD,
pvs_general_CMD,
pvscan_show_CMD,
pvscan_cache_CMD,
vgcfgbackup_general_CMD,
vgcfgrestore_by_vg_CMD,
vgcfgrestore_by_file_CMD,
vgchange_properties_CMD,
vgchange_monitor_CMD,
vgchange_poll_CMD,
vgchange_activate_CMD,
vgchange_refresh_CMD,
vgchange_lockstart_CMD,
vgchange_lockstop_CMD,
vgck_general_CMD,
vgconvert_general_CMD,
vgcreate_general_CMD,
vgdisplay_general_CMD,
vgexport_some_CMD,
vgexport_all_CMD,
vgextend_general_CMD,
vgimport_some_CMD,
vgimport_all_CMD,
vgimportclone_general_CMD,
vgmerge_general_CMD,
vgmknodes_general_CMD,
vgreduce_by_pv_CMD,
vgreduce_all_CMD,
vgreduce_missing_CMD,
vgremove_general_CMD,
vgrename_by_name_CMD,
vgrename_by_uuid_CMD,
vgs_general_CMD,
vgscan_general_CMD,
vgsplit_by_pv_to_existing_CMD,
vgsplit_by_lv_to_existing_CMD,
vgsplit_by_pv_to_new_CMD,
vgsplit_by_lv_to_new_CMD,
devtypes_general_CMD,
fullreport_general_CMD,
lastlog_general_CMD,
lvpoll_general_CMD,
formats_general_CMD,
help_general_CMD,
version_general_CMD,
pvdata_general_CMD,
segtypes_general_CMD,
systemid_general_CMD,
tags_general_CMD,
lvmchange_general_CMD,
lvmdiskscan_general_CMD,
lvmsadc_general_CMD,
lvmsar_general_CMD,
COMMAND_ID_COUNT,
};

File diff suppressed because it is too large Load Diff

View File

@@ -18,8 +18,26 @@
struct cmd_context;
/* command functions */
typedef int (*command_fn) (struct cmd_context * cmd, int argc, char **argv);
/* old per-command-name function */
typedef int (*command_fn) (struct cmd_context *cmd, int argc, char **argv);
/* new per-command-line-id functions */
typedef int (*command_line_fn) (struct cmd_context *cmd, int argc, char **argv);
struct command_function {
int command_line_enum;
command_line_fn fn;
};
struct command_name {
const char *name;
const char *desc; /* general command description from commands.h */
unsigned int flags;
/* union of {required,optional}_opt_args for all commands with this name */
int valid_args[ARG_COUNT];
int num_args;
};
/*
* Command defintion
@@ -113,9 +131,13 @@ struct command {
const char *desc; /* specific command description from command-lines.h */
const char *usage; /* excludes common options like --help, --debug */
const char *usage_common; /* includes commmon options like --help, --debug */
const char *command_line_id;
int command_line_enum; /* <command_line_id>_CMD */
struct command_name *cname;
command_fn fn;
command_fn fn; /* old style */
struct command_function *functions; /* new style */
unsigned int flags; /* copied from command_name.flags from commands.h */
@@ -144,14 +166,4 @@ struct command {
int pos_count;
};
struct command_name {
const char *name;
const char *desc; /* general command description from commands.h */
unsigned int flags;
/* union of {required,optional}_opt_args for all commands with this name */
int valid_args[ARG_COUNT];
int num_args;
};
#endif

View File

@@ -49,7 +49,7 @@ extern char *optarg;
# define OPTIND_INIT 1
#endif
#include "command-lines-count.h" /* #define COMMAND_COUNT, generated from command-lines.in */
#include "command-lines-count.h"
/*
* Table of valid --option values.
@@ -85,6 +85,22 @@ struct command_name command_names[MAX_COMMAND_NAMES] = {
static struct command commands[COMMAND_COUNT];
static struct cmdline_context _cmdline;
/*
* Table of command line functions
*
* This table could be auto-generated once all commands have been converted
* to use these functions instead of the old per-command-name function.
* For now, any command id not included here uses the old command fn.
*/
struct command_function command_functions[COMMAND_ID_COUNT] = {
{ lvmconfig_general_CMD, lvmconfig },
};
#if 0
{ lvchange_properties_CMD, lvchange_properties_cmd },
{ lvchange_activate_CMD, lvchange_activate_cmd },
{ lvchange_refresh_CMD, lvchange_refresh_cmd },
#endif
/* Command line args */
unsigned arg_count(const struct cmd_context *cmd, int a)
{
@@ -787,6 +803,17 @@ static struct command_name *_find_command_name(const char *name)
return NULL;
}
static struct command_function *_find_command_function(int command_line_enum)
{
int i;
for (i = 0; i < COMMAND_ID_COUNT; i++) {
if (command_functions[i].command_line_enum == command_line_enum)
return &command_functions[i];
}
return NULL;
}
static void _define_commands(void)
{
/* command-lines.h defines command[] structs, generated from command-lines.in */
@@ -810,6 +837,7 @@ void lvm_register_commands(void)
log_error(INTERNAL_ERROR "Failed to find command name %s.", commands[i].name);
commands[i].cname = cname;
commands[i].flags = cname->flags;
commands[i].functions = _find_command_function(commands[i].command_line_enum);
}
_cmdline.command_names = command_names;
@@ -1345,7 +1373,7 @@ static struct command *_find_command(struct cmd_context *cmd, const char *path,
}
}
out:
log_debug("Command definition (%d): %s", best_i, commands[best_i].usage);
log_debug("command line id: %s (%d)", commands[best_i].command_line_id, best_i);
return &commands[best_i];
}
@@ -1399,6 +1427,8 @@ static int _usage(const char *name, int help_count)
log_print(". Select indicates that a required positional parameter can");
log_print(" be omitted if the --select option is used.");
log_print(". --size Number can be replaced with --extents NumberExtents.");
log_print(". --name is usually specified for lvcreate, but is not among");
log_print(" the required parameters because names can be generated.");
log_print(". For required options listed in parentheses, e.g. (--A, --B),");
log_print(" any one is required, after which the others are optional.");
log_print(". The _new suffix indicates the VG or LV must not yet exist.");
@@ -2388,10 +2418,12 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
}
}
/*
* FIXME Break up into multiple functions.
*/
ret = cmd->command->fn(cmd, argc, argv);
if (cmd->command->functions)
/* A command-line--specific function is used */
ret = cmd->command->functions->fn(cmd, argc, argv);
else
/* The old style command-name function is used */
ret = cmd->command->fn(cmd, argc, argv);
lvmlockd_disconnect();
fin_locking();