mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-09 01:18:39 +03:00
Fix a regression in handling --major/--minor arguments to lvcreate & lvchange,
by allowing arg_int_value to be used with groupable options.
This commit is contained in:
parent
f19be6776b
commit
c3b58ec989
19
test/shell/activate-minor.sh
Normal file
19
test/shell/activate-minor.sh
Normal file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use,
|
||||
# modify, copy, or redistribute it subject to the terms and conditions
|
||||
# of the GNU General Public License v.2.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
. lib/test
|
||||
|
||||
aux prepare_vg 2
|
||||
lvcreate -a n --zero n -l 1 -n foo $vg
|
||||
lvchange $vg/foo -My --major=255 --minor=123
|
||||
lvchange $vg/foo -a y
|
||||
dmsetup info $vg-foo | tee info
|
||||
grep "254, 123" info
|
@ -94,9 +94,24 @@ int32_t grouped_arg_int_value(const struct arg_values *av, int a, const int32_t
|
||||
return grouped_arg_count(av, a) ? av[a].i_value : def;
|
||||
}
|
||||
|
||||
int32_t first_grouped_arg_int_value(struct cmd_context *cmd, int a, const int32_t def)
|
||||
{
|
||||
struct arg_value_group_list *current_group;
|
||||
struct arg_values *av;
|
||||
|
||||
dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
|
||||
av = current_group->arg_values;
|
||||
if (grouped_arg_count(av, a))
|
||||
return grouped_arg_int_value(av, a, def);
|
||||
}
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def)
|
||||
{
|
||||
return arg_count(cmd, a) ? cmd->arg_values[a].i_value : def;
|
||||
return (_cmdline.arg_props[a].flags & ARG_GROUPABLE) ?
|
||||
first_grouped_arg_int_value(cmd, a, def) : (arg_count(cmd, a) ? cmd->arg_values[a].i_value : def);
|
||||
}
|
||||
|
||||
uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def)
|
||||
|
@ -162,6 +162,7 @@ unsigned arg_is_set(const struct cmd_context *cmd, int a);
|
||||
const char *arg_value(struct cmd_context *cmd, int a);
|
||||
const char *arg_str_value(struct cmd_context *cmd, int a, const char *def);
|
||||
int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def);
|
||||
int32_t first_grouped_arg_int_value(struct cmd_context *cmd, int a, const int32_t def);
|
||||
uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def);
|
||||
int64_t arg_int64_value(struct cmd_context *cmd, int a, const int64_t def);
|
||||
uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def);
|
||||
|
Loading…
Reference in New Issue
Block a user