From: Karel Zak Date: Mon, 21 Jan 2013 11:32:33 +0000 (+0100) Subject: fdisk: (dos) move 'toggle active' code to fdiskdoslabe.c X-Git-Tag: v2.23-rc1~136 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e76d577627acec228e76c22f6e914b8d86d69c9b;p=thirdparty%2Futil-linux.git fdisk: (dos) move 'toggle active' code to fdiskdoslabe.c Signed-off-by: Karel Zak --- diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 18990f72ad..a73cf312bd 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -601,20 +601,6 @@ str_units(int n) return P_("sector", "sectors", n); } -static void -toggle_active(struct fdisk_context *cxt, int i) { - struct pte *pe = &ptes[i]; - struct partition *p = pe->part_table; - - if (IS_EXTENDED (p->sys_ind) && !p->boot_ind) - fprintf(stderr, - _("WARNING: Partition %d is an extended partition\n"), - i + 1); - p->boot_ind = (p->boot_ind ? 0 : ACTIVE_FLAG); - pe->changed = 1; - fdisk_label_set_changed(cxt->label, 1); -} - static void toggle_dos_compatibility_flag(struct fdisk_context *cxt) { struct fdisk_label *lb = fdisk_context_get_label(cxt, "dos"); @@ -1084,7 +1070,7 @@ static void command_prompt(struct fdisk_context *cxt) switch (c) { case 'a': if (fdisk_is_disklabel(cxt, DOS)) - toggle_active(cxt, get_partition(cxt, 1, partitions)); + dos_toggle_active(cxt, get_partition(cxt, 1, partitions)); else if (fdisk_is_disklabel(cxt, SUN)) toggle_sunflags(cxt, get_partition(cxt, 1, partitions), SUN_FLAG_UNMNT); diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c index 55b28c2036..6655f3a07b 100644 --- a/fdisks/fdiskdoslabel.c +++ b/fdisks/fdiskdoslabel.c @@ -1382,6 +1382,20 @@ void dos_move_begin(struct fdisk_context *cxt, int i) } } +void dos_toggle_active(struct fdisk_context *cxt, int i) +{ + struct pte *pe = &ptes[i]; + struct partition *p = pe->part_table; + + if (IS_EXTENDED (p->sys_ind) && !p->boot_ind) + fprintf(stderr, + _("WARNING: Partition %d is an extended partition\n"), + i + 1); + p->boot_ind = (p->boot_ind ? 0 : ACTIVE_FLAG); + pe->changed = 1; + fdisk_label_set_changed(cxt->label, 1); +} + static const struct fdisk_label_operations dos_operations = { .probe = dos_probe_label, diff --git a/fdisks/fdiskdoslabel.h b/fdisks/fdiskdoslabel.h index 8fe7f21c5e..80f5dbba6a 100644 --- a/fdisks/fdiskdoslabel.h +++ b/fdisks/fdiskdoslabel.h @@ -45,6 +45,7 @@ extern void dos_list_table_expert(struct fdisk_context *cxt, int extend); extern void dos_fix_partition_table_order(void); extern void dos_move_begin(struct fdisk_context *cxt, int i); +extern void dos_toggle_active(struct fdisk_context *cxt, int i); extern int mbr_is_valid_magic(unsigned char *b);