diff options
author | Karel Zak | 2013-06-25 15:31:21 +0200 |
---|---|---|
committer | Karel Zak | 2013-09-16 16:47:03 +0200 |
commit | 35b1f0a4c4fc151723e2b2880ffb0203b1bdfd84 (patch) | |
tree | 31984bfaf0f2d6bf0b2c4ccc477dba6e9e5ca66b /fdisks | |
parent | libfdisk: add generic function to get disklabel ID (diff) | |
download | kernel-qcow2-util-linux-35b1f0a4c4fc151723e2b2880ffb0203b1bdfd84.tar.gz kernel-qcow2-util-linux-35b1f0a4c4fc151723e2b2880ffb0203b1bdfd84.tar.xz kernel-qcow2-util-linux-35b1f0a4c4fc151723e2b2880ffb0203b1bdfd84.zip |
libfdisk: add generic function to set disklabel ID
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks')
-rw-r--r-- | fdisks/fdisk-menu.c | 7 | ||||
-rw-r--r-- | fdisks/fdisk.c | 3 | ||||
-rw-r--r-- | fdisks/fdiskdoslabel.c | 10 | ||||
-rw-r--r-- | fdisks/fdiskdoslabel.h | 3 |
4 files changed, 15 insertions, 8 deletions
diff --git a/fdisks/fdisk-menu.c b/fdisks/fdisk-menu.c index fe65d4622..e854f0bc7 100644 --- a/fdisks/fdisk-menu.c +++ b/fdisks/fdisk-menu.c @@ -134,8 +134,10 @@ struct menu menu_gpt = { .label = FDISK_DISKLABEL_GPT, .entries = { MENU_XSEP(N_("GPT")), - MENU_XENT('u', N_("change partition UUID")), + MENU_XENT('i', N_("change disk GUID")), MENU_XENT('n', N_("change partition name")), + MENU_XENT('u', N_("change partition UUID")), + { 0, NULL } } }; @@ -389,6 +391,9 @@ static int gpt_menu_cb(struct fdisk_context *cxt, DBG(FRONTEND, dbgprint("enter GPT menu")); + if (ent->key == 'i') + return fdisk_set_disklabel_id(cxt); + rc = fdisk_ask_partnum(cxt, &n, FALSE); if (rc) return rc; diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 803eeeed9..ff581ce74 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -425,8 +425,7 @@ expert_command_prompt(struct fdisk_context *cxt) fdisk_create_disklabel(cxt, "sgi"); break; case 'i': - if (fdisk_is_disklabel(cxt, DOS)) - dos_set_mbr_id(cxt); + fdisk_set_disklabel_id(cxt); break; case 'p': list_table(cxt, 1); diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c index 023fbbdb1..84c4a3431 100644 --- a/fdisks/fdiskdoslabel.c +++ b/fdisks/fdiskdoslabel.c @@ -480,13 +480,18 @@ static int dos_create_disklabel(struct fdisk_context *cxt) return 0; } -int dos_set_mbr_id(struct fdisk_context *cxt) +static int dos_set_disklabel_id(struct fdisk_context *cxt) { char *end = NULL, *str = NULL; unsigned int id, old; - struct fdisk_dos_label *l = self_label(cxt); + struct fdisk_dos_label *l; int rc; + assert(cxt); + assert(cxt->label); + assert(fdisk_is_disklabel(cxt, DOS)); + + l = self_label(cxt); old = mbr_get_id(cxt->firstsector); rc = fdisk_ask_string(cxt, _("Enter of the new disk identifier"), &str); @@ -1808,6 +1813,7 @@ static const struct fdisk_label_operations dos_operations = .create = dos_create_disklabel, .list = dos_list_disklabel, .get_id = dos_get_disklabel_id, + .set_id = dos_set_disklabel_id, .part_add = dos_add_partition, .part_delete = dos_delete_partition, diff --git a/fdisks/fdiskdoslabel.h b/fdisks/fdiskdoslabel.h index 3ba71453d..a0878b225 100644 --- a/fdisks/fdiskdoslabel.h +++ b/fdisks/fdiskdoslabel.h @@ -7,9 +7,6 @@ extern struct dos_partition *fdisk_dos_get_partition( struct fdisk_context *cxt, size_t i); -extern void dos_print_mbr_id(struct fdisk_context *cxt); -extern int dos_set_mbr_id(struct fdisk_context *cxt); - extern void dos_fix_partition_table_order(struct fdisk_context *cxt); extern void dos_move_begin(struct fdisk_context *cxt, int i); extern void dos_toggle_active(struct fdisk_context *cxt, int i); |