summaryrefslogtreecommitdiffstats
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2013-07-10 14:17:58 +0200
committerKarel Zak2013-09-16 16:47:06 +0200
commita47fec81b2a9eae2712da86c75db27cf76fae4b4 (patch)
tree8612cb31bd4891e8e49617d4014c698e66510958 /fdisks/fdisk.c
parentfdisk: (bsd) remove printf() from the driver code (diff)
downloadkernel-qcow2-util-linux-a47fec81b2a9eae2712da86c75db27cf76fae4b4.tar.gz
kernel-qcow2-util-linux-a47fec81b2a9eae2712da86c75db27cf76fae4b4.tar.xz
kernel-qcow2-util-linux-a47fec81b2a9eae2712da86c75db27cf76fae4b4.zip
fdisk: allow to exchange context pointer in menu callbacks
... to make it possible to switch to nested contexts (nested partition tables). Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index 0ca888943..f95266bd1 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -381,7 +381,7 @@ expert_command_prompt(struct fdisk_context *cxt)
while(1) {
assert(cxt->label);
- c = process_fdisk_menu(cxt);
+ c = process_fdisk_menu(&cxt);
if (c <= 0)
continue;
@@ -512,7 +512,7 @@ static void command_prompt(struct fdisk_context *cxt)
while (1) {
assert(cxt->label);
- c = process_fdisk_menu(cxt);
+ c = process_fdisk_menu(&cxt);
if (c <= 0)
continue;
@@ -588,6 +588,14 @@ static void command_prompt(struct fdisk_context *cxt)
case 'x':
expert_command_prompt(cxt);
break;
+ case 'r':
+ if (cxt->parent) {
+ struct fdisk_context *tmp = cxt->parent;
+
+ fdisk_free_context(cxt);
+ cxt = tmp;
+ }
+ break;
default:
unknown_command(c);
}