]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (gpt) add A,B,R,S expert commands to modify attributes
authorKarel Zak <kzak@redhat.com>
Wed, 16 Oct 2013 13:30:43 +0000 (15:30 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Oct 2013 08:46:10 +0000 (10:46 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk-menu.c

index daa47d1e345bfafc680e9cd1a035cc729475809e..ced819aaf716febb194829b1c59a0bcbc6dac8c0 100644 (file)
@@ -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;