From 5c1c594ee5a9c443d42f835337bbaf162671b258 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 30 Sep 2019 13:11:17 +0200 Subject: [PATCH] fdisk: use 'r' to return from MBR to GPT The current code uses 'M' to switch between MBR and GPT, but it's not intuitive to "go back" by 'M'. It seems more user-friendly to use 'r' as in another places (for example when go from expert menu or from BRD menu). The 'M' to return to GPT is still supported for backward compatibility. Addresses: https://github.com/karelzak/util-linux/pull/849 Signed-off-by: Karel Zak --- disk-utils/fdisk-menu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/disk-utils/fdisk-menu.c b/disk-utils/fdisk-menu.c index 7198530f26..3aba661fbe 100644 --- a/disk-utils/fdisk-menu.c +++ b/disk-utils/fdisk-menu.c @@ -87,8 +87,7 @@ DECLARE_MENU_CB(generic_menu_cb); #define MENU_BENT_E(k, t, l) { .title = t, .key = k, .expert = 1, .normal = 1, .exclude = l } #define MENU_ENT_NEST(k, t, l, p) { .title = t, .key = k, .normal = 1, .label = l, .parent = p } -#define MENU_XENT_NEST(k, t, l, p) { .title = t, .key = k, .expert = 1, .label = l, .parent = p } -#define MENU_BENT_NEST(k, t, l, p) { .title = t, .key = k, .expert = 1, .normal = 1, .label = l, .parent = p } +#define MENU_BENT_NEST_H(k, t, l, p) { .title = t, .key = k, .expert = 1, .normal = 1, .label = l, .parent = p, .hidden = 1 } /* Generic menu */ static const struct menu menu_generic = { @@ -125,6 +124,8 @@ static const struct menu menu_generic = { MENU_ENT_NEST('r', N_("return from BSD to DOS"), FDISK_DISKLABEL_BSD, FDISK_DISKLABEL_DOS), + MENU_ENT_NEST('r', N_("return from protective/hybrid MBR to GPT"), FDISK_DISKLABEL_DOS, FDISK_DISKLABEL_GPT), + { 0, NULL } } }; @@ -222,8 +223,8 @@ static const struct menu menu_dos = { MENU_XENT('b', N_("move beginning of data in a partition")), MENU_XENT('i', N_("change the disk identifier")), - MENU_BENT_NEST('M', N_("return from protective/hybrid MBR to GPT"), - FDISK_DISKLABEL_DOS, FDISK_DISKLABEL_GPT), + MENU_BENT_NEST_H('M', N_("return from protective/hybrid MBR to GPT"), FDISK_DISKLABEL_DOS, FDISK_DISKLABEL_GPT), + { 0, NULL } } }; @@ -692,7 +693,7 @@ static int generic_menu_cb(struct fdisk_context **cxt0, fdisk_enable_details(cxt, 1); break; case 'r': - /* return from nested BSD to DOS */ + /* return from nested BSD to DOS or MBR to GPT */ if (fdisk_get_parent(cxt)) { *cxt0 = fdisk_get_parent(cxt); @@ -863,7 +864,7 @@ static int dos_menu_cb(struct fdisk_context **cxt0, rc = fdisk_set_disklabel_id(cxt); break; case 'M': - /* return from nested MBR to GPT */ + /* return from nested MBR to GPT (backward compatibility only) */ if (fdisk_get_parent(cxt)) { *cxt0 = fdisk_get_parent(cxt); -- 2.39.2