diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2012-08-06 18:01:01 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2012-08-06 18:01:01 +0200 |
commit | 6e55201144be3bcf82b6aafe7e9f7430318719d0 (patch) | |
tree | cca37992e2e0ebee0c006d7be0e62ee89a40b3d5 /tools/lvchange.c | |
parent | 3843f54974ea7c3bbe51fcd681a55fc23f4e7736 (diff) | |
download | lvm2-6e55201144be3bcf82b6aafe7e9f7430318719d0.tar.gz lvm2-6e55201144be3bcf82b6aafe7e9f7430318719d0.tar.xz lvm2-6e55201144be3bcf82b6aafe7e9f7430318719d0.zip |
args: increase major:minor limit to 4095:1048575
Remove the limit for major and minor number arguments used while specifying
persistent numbers via -My --major <major> --minor <minor> option which
was set to 255 before. Follow the kernel limit instead which is 12 bits
for major and 20 bits for minor number (kernel >= 2.6 and LVM formats
that does not have FMT_RESTRICTED_LVIDS - so still keep the old limit
of 255 for lvm1 format).
Diffstat (limited to 'tools/lvchange.c')
-rw-r--r-- | tools/lvchange.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/lvchange.c b/tools/lvchange.c index a24d26c2..c5cbe08e 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -516,6 +516,7 @@ static int lvchange_persistent(struct cmd_context *cmd, { struct lvinfo info; int active = 0; + int32_t major, minor; if (!strcmp(arg_str_value(cmd, persistent_ARG, "n"), "n")) { if (!(lv->status & FIXED_MINOR)) { @@ -547,6 +548,12 @@ static int lvchange_persistent(struct cmd_context *cmd, } if (lv_info(cmd, lv, 0, &info, 0, 0) && info.exists) active = 1; + + major = arg_int_value(cmd, major_ARG, lv->major); + minor = arg_int_value(cmd, minor_ARG, lv->minor); + if (!major_minor_valid(cmd, lv->vg->fid->fmt, major, minor)) + return 0; + if (active && !arg_count(cmd, force_ARG) && yes_no_prompt("Logical volume %s will be " "deactivated temporarily. " @@ -565,8 +572,8 @@ static int lvchange_persistent(struct cmd_context *cmd, return 0; } lv->status |= FIXED_MINOR; - lv->minor = arg_int_value(cmd, minor_ARG, lv->minor); - lv->major = arg_int_value(cmd, major_ARG, lv->major); + lv->minor = minor; + lv->major = major; log_verbose("Setting persistent device number to (%d, %d) " "for \"%s\"", lv->major, lv->minor, lv->name); |