summaryrefslogtreecommitdiff
path: root/fdisks/fdisk-menu.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2013-07-10 14:54:25 +0200
committerKarel Zak <kzak@redhat.com>2013-09-16 16:47:06 +0200
commitb529ea2abc1ef432a55e0af4560c4fb85e05c53d (patch)
treec18e174c726a475e165175885a90053a558df3ec /fdisks/fdisk-menu.c
parentd5b243144e527cf47150b7d1da580821421b90d4 (diff)
downloadutil-linux-b529ea2abc1ef432a55e0af4560c4fb85e05c53d.tar.gz
fdisk: (bsd) implement regular bsd menu callback
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk-menu.c')
-rw-r--r--fdisks/fdisk-menu.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/fdisks/fdisk-menu.c b/fdisks/fdisk-menu.c
index 7bbca6f4..7adf003b 100644
--- a/fdisks/fdisk-menu.c
+++ b/fdisks/fdisk-menu.c
@@ -53,6 +53,7 @@ DECLARE_MENU_CB(gpt_menu_cb);
DECLARE_MENU_CB(sun_menu_cb);
DECLARE_MENU_CB(geo_menu_cb);
DECLARE_MENU_CB(dos_menu_cb);
+DECLARE_MENU_CB(bsd_menu_cb);
/*
* Menu entry macros:
@@ -199,16 +200,14 @@ struct menu menu_dos = {
};
struct menu menu_bsd = {
-/* .callback = bsd_menu_cb,*/
+ .callback = bsd_menu_cb,
.label = FDISK_DISKLABEL_OSF,
.entries = {
MENU_SEP(N_("BSD")),
MENU_ENT('e', N_("edit drive data")),
MENU_ENT('i', N_("install bootstrap")),
MENU_ENT('s', N_("show complete disklabel")),
-#if !defined (__alpha__)
MENU_ENT('x', N_("link BSD partition to non-BSD partition")),
-#endif
{ 0, NULL }
}
};
@@ -550,6 +549,40 @@ static int sun_menu_cb(struct fdisk_context **cxt0,
return rc;
}
+/*
+ * This is fdisk frontend for BSD specific libfdisk functions that
+ * are not expported by generic libfdisk API.
+ */
+static int bsd_menu_cb(struct fdisk_context **cxt0,
+ const struct menu *menu __attribute__((__unused__)),
+ const struct menu_entry *ent)
+{
+ struct fdisk_context *cxt = *cxt0;
+ int rc = 0;
+
+ assert(cxt);
+ assert(ent);
+ assert(fdisk_is_disklabel(cxt, OSF));
+
+ DBG(FRONTEND, dbgprint("enter BSD menu"));
+
+ switch(ent->key) {
+ case 'e':
+ rc = fdisk_bsd_edit_disklabel(cxt);
+ break;
+ case 'i':
+ rc = fdisk_bsd_write_bootstrap(cxt);
+ break;
+ case 's':
+ xbsd_print_disklabel(cxt, 1);
+ break;
+ case 'x':
+ rc = fdisk_bsd_link_partition(cxt);
+ break;
+ }
+ return rc;
+}
+
/* C/H/S commands */
static int geo_menu_cb(struct fdisk_context **cxt0,
const struct menu *menu __attribute__((__unused__)),