summaryrefslogtreecommitdiff
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2012-12-11 18:30:03 +0100
committerKarel Zak <kzak@redhat.com>2013-03-11 12:47:29 +0100
commit53b422ab169dc3be8e8eee4ccb5f8e67bff1a122 (patch)
tree09dbb4e6826cb2b8470fc9165fd5373f242885fd /fdisks/fdisk.c
parent8a95621d30c4e4c3e279246f80ef4aeed4f5d71c (diff)
downloadutil-linux-53b422ab169dc3be8e8eee4ccb5f8e67bff1a122.tar.gz
libfdisk: move label identifier to label struct
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index b22f6858..2f502964 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -208,11 +208,14 @@ is_garbage_table(void) {
void print_menu(struct fdisk_context *cxt, enum menutype menu)
{
size_t i;
+ int id;
puts(_("Command action"));
+ id = cxt && cxt->label ? cxt->label->id : FDISK_DISKLABEL_ANY;
+
for (i = 0; i < ARRAY_SIZE(menulist); i++)
- if (menulist[i].label[menu] & cxt->disklabel)
+ if (menulist[i].label[menu] & id)
printf(" %c %s\n", menulist[i].command, menulist[i].description);
}
@@ -1483,8 +1486,9 @@ static void command_prompt(struct fdisk_context *cxt)
"disklabel mode.\n"),
cxt->dev_path);
bsd_command_prompt(cxt);
+
/* If we return we may want to make an empty DOS label? */
- cxt->disklabel = FDISK_DISKLABEL_DOS;
+ fdisk_context_switch_label(cxt, "dos");
}
while (1) {
@@ -1504,12 +1508,15 @@ static void command_prompt(struct fdisk_context *cxt)
unknown_command(c);
break;
case 'b':
+ /*
+ * TODO: create child context for nexted partition tables
+ */
if (fdisk_is_disklabel(cxt, SGI))
sgi_set_bootfile(cxt);
else if (fdisk_is_disklabel(cxt, DOS)) {
- cxt->disklabel = FDISK_DISKLABEL_OSF;
+ fdisk_context_switch_label(cxt, "bsd");
bsd_command_prompt(cxt);
- cxt->disklabel = FDISK_DISKLABEL_DOS;
+ fdisk_context_switch_label(cxt, "dos");
} else
unknown_command(c);
break;