From 6e55201144be3bcf82b6aafe7e9f7430318719d0 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Mon, 6 Aug 2012 18:01:01 +0200 Subject: 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 --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). --- tools/lvchange.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools/lvchange.c') 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); -- cgit