diff options
author | Francois Pons <fpons@mandriva.com> | 2000-02-09 16:08:57 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2000-02-09 16:08:57 +0000 |
commit | 0d2d453524cd5bdd97f0ecdc83955f7f2c26bc6e (patch) | |
tree | c36b487071d91939ef82fee1ece85e31636b141d | |
parent | 97acae38970adddb6f753cfce325532b94e2bd12 (diff) | |
download | drakx-backup-do-not-use-0d2d453524cd5bdd97f0ecdc83955f7f2c26bc6e.tar drakx-backup-do-not-use-0d2d453524cd5bdd97f0ecdc83955f7f2c26bc6e.tar.gz drakx-backup-do-not-use-0d2d453524cd5bdd97f0ecdc83955f7f2c26bc6e.tar.bz2 drakx-backup-do-not-use-0d2d453524cd5bdd97f0ecdc83955f7f2c26bc6e.tar.xz drakx-backup-do-not-use-0d2d453524cd5bdd97f0ecdc83955f7f2c26bc6e.zip |
*** empty log message ***
-rw-r--r-- | perl-install/partition_table_raw.pm | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index 2acd60004..a08cffecd 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -36,32 +36,44 @@ sub cylinder_size($) { $hd->{geom}{sectors} * $hd->{geom}{heads}; } +#- defaults methods for adjusting start and end for partitions, these +#- methods will shrink the partition inside current limits, but think +#- of this: hidden extended partitions that contains logical ones are +#- not specified, so end is always almost above a cylinders boundaries +#- by the start of a logical partitions (sectors, ie 63 generally) inside +#- its hidden extended containers. so for adjustEnd, it is very important +#- to round_down to cylinder boundarie else partitions will overlap. +#- furthermore on the interface, choosing 1Mb more is possible that +#- will go again beyond the normal cylinders boundaries, which may +#- cause overlaping partitions again :-( +#- until all the code in diskdrake is not cleaned up perfectly, rounding +#- down for the end is necessary. sub adjustStart($$) { my ($hd, $part) = @_; my $end = $part->{start} + $part->{size}; $part->{start} = round_up($part->{start}, - $part->{start} % cylinder_size($hd) < 2 * $hd->{geom}{sectors} ? - $hd->{geom}{sectors} : cylinder_size($hd)); + $part->{start} % cylinder_size($hd) < 2 * $hd->{geom}{sectors} ? + $hd->{geom}{sectors} : cylinder_size($hd)); $part->{size} = $end - $part->{start}; } sub adjustEnd($$) { my ($hd, $part) = @_; my $end = $part->{start} + $part->{size}; - my $end2 = round_up($end, cylinder_size($hd)); - $end2 = $hd->{geom}{cylinders} * cylinder_size($hd) if $end2 > $hd->{geom}{cylinders} * cylinder_size($hd); + my $end2 = round_down($end, cylinder_size($hd)); + unless ($part->{start} < $end2) { + $end2 = round_up($end, cylinder_size($hd)); + } $part->{size} = $end2 - $part->{start}; } -#- previous version of adjustEnd, should check for numbers about partition start/end. -#sub adjustEnd($$) { -# my ($hd, $part) = @_; -# my $end = $part->{start} + $part->{size}; -# my $end2 = round_down($end, cylinder_size($hd)); -# unless ($part->{start} < $end2) { -# $end2 = round_up($end, cylinder_size($hd)); -# } -# $part->{size} = $end2 - $part->{start}; -#} +#- this method could be used for when partitions informations will be accurate. +#- sub adjustEnd($$) { +#- my ($hd, $part) = @_; +#- my $end = $part->{start} + $part->{size} - $hd->{geom}{sectors} - 1; #- magically reduces the end, will be rounded up. +#- my $end2 = round_up($end, cylinder_size($hd)); +#- $end2 = $hd->{geom}{cylinders} * cylinder_size($hd) if $end2 > $hd->{geom}{cylinders} * cylinder_size($hd); +#- $part->{size} = $end2 - $part->{start}; +#-} sub get_geometry($) { my ($dev) = @_; @@ -85,8 +97,6 @@ sub kernel_read($) { local *F; openit($hd, *F) or return 0; sync(); sleep(1); $hd->{rebootNeeded} = !ioctl(F, c::BLKRRPART(), 0); - sync(); sleep(1); - $hd->{rebootNeeded} = !ioctl(F, c::BLKRRPART(), 0); sync(); close F; sync(); sleep(1); |