summaryrefslogtreecommitdiffstats
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2013-01-21 12:11:43 +0100
committerKarel Zak2013-03-11 12:47:30 +0100
commit71ee484e0b9c74b9bb058de89f3ff61b02b8f6f4 (patch)
tree443ecb81adc469648779237410413a10ce35253e /fdisks/fdisk.c
parentfdisk: (dos) move fix order code to fdiskdoslabe.c (diff)
downloadkernel-qcow2-util-linux-71ee484e0b9c74b9bb058de89f3ff61b02b8f6f4.tar.gz
kernel-qcow2-util-linux-71ee484e0b9c74b9bb058de89f3ff61b02b8f6f4.tar.xz
kernel-qcow2-util-linux-71ee484e0b9c74b9bb058de89f3ff61b02b8f6f4.zip
fdisk: (dos) move 'move begin' code to fdiskdoslabe.c
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index cb655117b..9322dad53 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -1024,55 +1024,6 @@ static void print_raw(struct fdisk_context *cxt)
print_buffer(cxt, ptes[i].sectorbuffer);
}
-static void
-move_begin(struct fdisk_context *cxt, int i) {
- struct pte *pe = &ptes[i];
- struct partition *p = pe->part_table;
- unsigned int new, free_start, curr_start, last;
- int x;
-
- if (warn_geometry(cxt))
- return;
- if (!p->sys_ind || !get_nr_sects(p) || IS_EXTENDED (p->sys_ind)) {
- printf(_("Partition %d has no data area\n"), i + 1);
- return;
- }
-
- /* the default start is at the second sector of the disk or at the
- * second sector of the extended partition
- */
- free_start = pe->offset ? pe->offset + 1 : 1;
-
- curr_start = get_partition_start(pe);
-
- /* look for a free space before the current start of the partition */
- for (x = 0; x < partitions; x++) {
- unsigned int end;
- struct pte *prev_pe = &ptes[x];
- struct partition *prev_p = prev_pe->part_table;
-
- if (!prev_p)
- continue;
- end = get_partition_start(prev_pe) + get_nr_sects(prev_p);
-
- if (!is_cleared_partition(prev_p) &&
- end > free_start && end <= curr_start)
- free_start = end;
- }
-
- last = get_partition_start(pe) + get_nr_sects(p) - 1;
-
- new = read_int(cxt, free_start, curr_start, last, free_start,
- _("New beginning of data")) - pe->offset;
-
- if (new != get_nr_sects(p)) {
- unsigned int sects = get_nr_sects(p) + get_start_sect(p) - new;
- set_nr_sects(p, sects);
- set_start_sect(p, new);
- pe->changed = 1;
- }
-}
-
static void __attribute__ ((__noreturn__)) handle_quit(struct fdisk_context *cxt)
{
fdisk_free_context(cxt);
@@ -1095,7 +1046,7 @@ expert_command_prompt(struct fdisk_context *cxt)
break;
case 'b':
if (fdisk_is_disklabel(cxt, DOS))
- move_begin(cxt, get_partition(cxt, 0, partitions));
+ dos_move_begin(cxt, get_partition(cxt, 0, partitions));
break;
case 'c':
user_cylinders = read_int(cxt, 1, cxt->geom.cylinders, 1048576, 0,