From da93dce60a01e338efbea41e3e2134d9c1e03fe2 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 9 Feb 2000 18:43:02 +0000 Subject: *** empty log message *** --- perl-install/install_steps.pm | 2 +- perl-install/partition_table_raw.pm | 44 +++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 777b24205..15cc11b37 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -74,7 +74,7 @@ Continue at your own risk."), $@ ]) if $@; } } -sub errorInStep($$) { print "error :(\n"; exit 1 } +sub errorInStep($$) { print "error :(\n"; c::_exit(1) } sub kill_action {} sub set_help { 1 } diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index a08cffecd..d64223990 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -36,18 +36,8 @@ 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. +#- default method for starting a partition, only head size or twice it +#- is allowed for starting a partition after a cylinder boundarie. sub adjustStart($$) { my ($hd, $part) = @_; my $end = $part->{start} + $part->{size}; @@ -57,23 +47,29 @@ sub adjustStart($$) { $hd->{geom}{sectors} : cylinder_size($hd)); $part->{size} = $end - $part->{start}; } +#- this method could be used for when partitions informations will be accurate. +#- $end2 is updated to take into account logical partitions where two heads of +#- sectors (typically 63 each) exists before the real start of the partition (used +#- by hidden magic extended partition. +#- if size go above the first two heads of a cylinder, the whole cylinder is eaten +#- by the partition, so overlapping can occur in such case (but it is not allowed). 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)); - } + my $end2 = round_up($end - 2 * $hd->{geom}{sectors}, cylinder_size($hd)); + $end2 = $hd->{geom}{cylinders} * cylinder_size($hd) if $end2 > $hd->{geom}{cylinders} * 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}; -#-} +#- original method for adjustEnd, keep it while the above has not been tested completely. +#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}; +#} sub get_geometry($) { my ($dev) = @_; -- cgit v1.2.1