From 520904359f3b4f2a56b43a9f0f6f63cae42f5ae9 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Fri, 11 Feb 2000 14:52:48 +0000 Subject: *** empty log message *** --- perl-install/ChangeLog | 6 ++++++ perl-install/install2.pm | 2 +- perl-install/partition_table_raw.pm | 36 ++++++++++++++++-------------------- 3 files changed, 23 insertions(+), 21 deletions(-) (limited to 'perl-install') diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 295eefe73..fd22c895f 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,8 @@ +2000-02-11 François Pons + + * fixed diskdrake to handle limit case when creating and resizing + partition table, address size limit and start sector limit. + 2000-02-11 Pixel * install2.pm (main): add a callback on SEGV @@ -25,6 +30,7 @@ (that way no pci probe the second time) 2000-02-10 François Pons + * heavy modification of build_archive and extract_archive to manage a TOC directly in archive file, handle bzip2 or gzip compression, extract_archive can extract multiple files a time, with minimal diff --git a/perl-install/install2.pm b/perl-install/install2.pm index b1120e8d9..f02f65996 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -78,7 +78,7 @@ arch() =~ /alpha/ ? ( $installSteps{first} = $installSteps[0]; } #-##################################################################################### -#-INTERN CONSTANT +#-INTERNAL CONSTANT #-##################################################################################### #- these strings are used in quite a lot of places and must not be changed!!!!! diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index d64223990..41a49d552 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -36,7 +36,7 @@ sub cylinder_size($) { $hd->{geom}{sectors} * $hd->{geom}{heads}; } -#- default method for starting a partition, only head size or twice it +#- default method for starting a partition, only head size or twice #- is allowed for starting a partition after a cylinder boundarie. sub adjustStart($$) { my ($hd, $part) = @_; @@ -46,30 +46,26 @@ sub adjustStart($$) { $part->{start} % cylinder_size($hd) < 2 * $hd->{geom}{sectors} ? $hd->{geom}{sectors} : cylinder_size($hd)); $part->{size} = $end - $part->{start}; + $part->{size} > 0 or die "adjustStart get a too small partition to handle correctly"; } -#- 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). +#- adjusting end to match a cylinder boundary, two methods are used and must +#- match at the end, else something is wrong and nothing will be done on +#- partition table. +#- $end2 is computed by removing 2 (or only 1 if only 2 heads on drive) groups +#- of sectors, this is necessary to handle extended partition where logical +#- partition start after 1 (or 2 accepted) groups of sectors (typically 63). +#- $end is floating (is not on cylinder boudary) so we have to choice a good +#- candidate, $end1 or $end2 should always be good except $end1 for small +#- partition size. sub adjustEnd($$) { my ($hd, $part) = @_; my $end = $part->{start} + $part->{size}; - 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}; + my $end1 = round_down($end, cylinder_size($hd)); + my $end2 = round_up($end - ($hd->{geom}{heads} > 2 ? 2 : 1) * $hd->{geom}{sectors}, cylinder_size($hd)); + $end2 <= $hd->{geom}{cylinders} * cylinder_size($hd) or die "adjustEnd go beyond end of device geometry"; + $part->{size} = ($end1 - $part->{start} > cylinder_size($hd) ? $end1 : $end2) - $part->{start}; + $part->{size} > 0 or die "adjustEnd get a too small partition to handle correctly"; } -#- 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