From: Karel Zak Date: Wed, 16 Oct 2013 13:30:43 +0000 (+0200) Subject: fdisk: (gpt) add A,B,R,S expert commands to modify attributes X-Git-Tag: v2.25-rc1~793 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f362d863c477c80c8c791c1f3547953344563c2f;p=thirdparty%2Futil-linux.git fdisk: (gpt) add A,B,R,S expert commands to modify attributes Signed-off-by: Karel Zak --- diff --git a/fdisks/fdisk-menu.c b/fdisks/fdisk-menu.c index daa47d1e34..ced819aaf7 100644 --- a/fdisks/fdisk-menu.c +++ b/fdisks/fdisk-menu.c @@ -159,6 +159,13 @@ struct menu menu_gpt = { MENU_XENT('n', N_("change partition name")), MENU_XENT('u', N_("change partition UUID")), MENU_XENT('M', N_("enter protective/hybrid MBR")), + + MENU_XSEP(""), + MENU_XENT('A', N_("toggle the legacy BIOS bootable flag")), + MENU_XENT('B', N_("toggle the no block IO protocol flag")), + MENU_XENT('R', N_("toggle the required partition flag")), + MENU_XENT('S', N_("toggle the GUID specific bits")), + { 0, NULL } } }; @@ -350,7 +357,9 @@ static int print_fdisk_menu(struct fdisk_context *cxt) while ((e = next_menu_entry(cxt, &mc))) { if (IS_MENU_HID(e)) continue; /* hidden entry */ - if (IS_MENU_SEP(e)) { + if (IS_MENU_SEP(e) && (!e->title || !*e->title)) + printf("\n"); + else if (IS_MENU_SEP(e)) { color_enable(UL_COLOR_BOLD); printf("\n %s\n", _(e->title)); color_disable(); @@ -571,6 +580,18 @@ static int gpt_menu_cb(struct fdisk_context **cxt0, case 'n': rc = fdisk_gpt_partition_set_name(cxt, n); break; + case 'A': + rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_LEGACYBOOT); + break; + case 'B': + rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_NOBLOCK); + break; + case 'R': + rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_REQUIRED); + break; + case 'S': + rc = fdisk_partition_toggle_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC); + break; } } return rc;