diff options
author | Alasdair Kergon <agk@redhat.com> | 2010-11-11 17:29:05 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2010-11-11 17:29:05 +0000 |
commit | f8452d8cfd4711aa9a988254dcd9421d7538710b (patch) | |
tree | 74f7ccc3b9a37bf795370af3ce3b0e24a80f186d /tools/lvcreate.c | |
parent | 64dff85ce47bd431422022e9afe1a29ead2dc385 (diff) | |
download | lvm2-f8452d8cfd4711aa9a988254dcd9421d7538710b.tar.gz lvm2-f8452d8cfd4711aa9a988254dcd9421d7538710b.tar.xz lvm2-f8452d8cfd4711aa9a988254dcd9421d7538710b.zip |
Support repetition of --addtag and --deltag arguments.
Add infrastructure for specific cmdline arguments to be repeated in groups.
Split the_args cmdline arguments and values into arg_props and arg_values.
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index a9e3c2d8..c7cc2308 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -327,9 +327,12 @@ static int _lvcreate_params(struct lvcreate_params *lp, { int contiguous; unsigned pagesize; + struct arg_value_group_list *current_group; + const char *tag; memset(lp, 0, sizeof(*lp)); memset(lcp, 0, sizeof(*lcp)); + dm_list_init(&lp->tags); /* * Check selected options are compatible and determine segtype @@ -507,7 +510,20 @@ static int _lvcreate_params(struct lvcreate_params *lp, return 0; } - lp->tag = arg_str_value(cmd, addtag_ARG, NULL); + dm_list_iterate_items(current_group, &cmd->arg_value_groups) { + if (!grouped_arg_is_set(current_group->arg_values, addtag_ARG)) + continue; + + if (!(tag = grouped_arg_str_value(current_group->arg_values, addtag_ARG, NULL))) { + log_error("Failed to get tag"); + return 0; + } + + if (!str_list_add(cmd->mem, &lp->tags, tag)) { + log_error("Unable to allocate memory for tag %s", tag); + return 0; + } + } lcp->pv_count = argc; lcp->pvs = argv; |