]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (dos) move 'toggle active' code to fdiskdoslabe.c
authorKarel Zak <kzak@redhat.com>
Mon, 21 Jan 2013 11:32:33 +0000 (12:32 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 11:47:31 +0000 (12:47 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.c
fdisks/fdiskdoslabel.c
fdisks/fdiskdoslabel.h

index 18990f72ad8012d61fa92e82cf97d9ccf3f9e185..a73cf312bda25f130c65cf638b8448946d16af4f 100644 (file)
@@ -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);
index 55b28c2036477eda092ee8aafcc56043155aa8cd..6655f3a07b6507043700c7818d74c5ba4dbba86d 100644 (file)
@@ -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,
index 8fe7f21c5e2213df9da03e93981c69d0399002c7..80f5dbba6aab89f8f0e4c825042d94c8d2f6d76c 100644 (file)
@@ -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);