From 77594868b1cb9b5c6cf7656cdcd5da08a5b2d457 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 25 Nov 2004 13:13:34 +0000 Subject: moving partitions never really worked and is disabled since years --- perl-install/diskdrake/interactive.pm | 12 -------- perl-install/fsedit.pm | 56 ----------------------------------- 2 files changed, 68 deletions(-) diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 9b28808e8..20ed88f87 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -426,7 +426,6 @@ sub part_possible_actions { N_("Type") => '!isBusy && $::expert && (!readonly || $part->{pt_type} == 0x83)', N_("Options") => '$::expert', N_("Resize") => '!isBusy && !readonly && !isSpecial || isLVM($hd) && isMounted && $part->{fs_type} eq "xfs"', - N_("Move") => '!isBusy && !readonly && !isSpecial && $::expert && 0', # disable for the moment N_("Format") => '!isBusy && !readonly && ($::expert || $::isStandalone)', N_("Mount") => '!isBusy && (hasMntpoint || isSwap) && maybeFormatted && ($::expert || $::isStandalone)', N_("Add to RAID") => '!isBusy && isRawRAID && (!isSpecial || isRAID)', @@ -787,17 +786,6 @@ filesystem checks will be run on your next boot into Windows(TM)")); $adjust->(0) if $size < $oldsize; } -sub Move { - my ($in, $hd, $part, $all_hds) = @_; - my $hd2 = $in->ask_from_listf(N("Move"), - N("Which disk do you want to move it to?"), \&partition_table::description, @{$all_hds->{hds}}) or return; - my $start2 = $in->ask_from_entry(N("Sector"), - N("Which sector do you want to move it to?")); - defined $start2 or return; - - my $_w = $in->wait_message(N("Moving"), N("Moving partition...")); - fsedit::move($hd, $part, $hd2, $start2); -} sub Format { my ($in, $hd, $part, $all_hds) = @_; format_($in, $hd, $part, $all_hds); diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index b790de23d..bd93e49b0 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -560,62 +560,6 @@ sub undo { } -sub move { - my ($hd, $part, $hd2, $sector2) = @_; - - die 'TODO'; # doesn't work for the moment - my $part1 = { %$part }; - my $part2 = { %$part }; - $part2->{start} = $sector2; - $part2->{size} += $hd2->cylinder_size - 1; - partition_table::remove($hd, $part); - { - local ($part2->{notFormatted}, $part2->{isFormatted}); #- do not allow partition::add to change this - partition_table::add($hd2, $part2); - } - - return if $part2->{notFormatted} && !$part2->{isFormatted} || $::testing; - - local (*F, *G); - sysopen F, $hd->{file}, 0 or die ''; - sysopen G, $hd2->{file}, 2 or die N("Error opening %s for writing: %s", $hd2->{file}, $!); - - my $base = $part1->{start}; - my $base2 = $part2->{start}; - my $step = 10; - if ($hd eq $hd2) { - $base == $base2 and return; - $step = min($step, abs($base2 - $base)); - - if ($base < $base2) { - $base += $part1->{size} - $step; - $base2 += $part1->{size} - $step; - $step = -$step; - } - } - - my $f = sub { - $base < 0 and $base2 += -$base, $base = 0; - $base2 < 0 and $base += -$base2, $base2 = 0; - c::lseek_sector(fileno(F), $base, 0) or die "seeking to sector $base failed on drive $hd->{device}"; - c::lseek_sector(fileno(G), $base2, 0) or die "seeking to sector $base2 failed on drive $hd2->{device}"; - - my $buf; - sysread F, $buf, $SECTORSIZE * abs($_[0]) or die ''; - syswrite G, $buf; - }; - - for (my $i = 0; $i < $part1->{size} / abs($step); $i++, $base += $step, $base2 += $step) { - print "$base $base2\n"; - &$f($step); - } - if (my $v = ($part1->{size} % abs($step)) * sign($step)) { - $base += $v; - $base2 += $v; - &$f($v); - } -} - sub change_type { my ($type, $hd, $part) = @_; $type->{pt_type} != $part->{pt_type} || $type->{fs_type} ne $part->{fs_type} or return; -- cgit v1.2.1