diff options
author | Francois Pons <fpons@mandriva.com> | 2000-01-24 15:12:16 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2000-01-24 15:12:16 +0000 |
commit | a31aa764b35315eda2caf3bd269db45fc56a9d66 (patch) | |
tree | df5c8c426e21dddb236a4e600ab7162c1806c758 /perl-install/partition_table_raw.pm | |
parent | 7fa1fd93ecd790ae288102dcb4ec4cf3ca3bc760 (diff) | |
download | drakx-backup-do-not-use-a31aa764b35315eda2caf3bd269db45fc56a9d66.tar drakx-backup-do-not-use-a31aa764b35315eda2caf3bd269db45fc56a9d66.tar.gz drakx-backup-do-not-use-a31aa764b35315eda2caf3bd269db45fc56a9d66.tar.bz2 drakx-backup-do-not-use-a31aa764b35315eda2caf3bd269db45fc56a9d66.tar.xz drakx-backup-do-not-use-a31aa764b35315eda2caf3bd269db45fc56a9d66.zip |
*** empty log message ***
Diffstat (limited to 'perl-install/partition_table_raw.pm')
-rw-r--r-- | perl-install/partition_table_raw.pm | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index cafb439f9..668913d9c 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -31,6 +31,30 @@ sub typeOfMBR_($) { typeFromMagic($_[0], @MBR_signatures) } sub hasExtended { 0 } +sub cylinder_size($) { + my ($hd) = @_; + $hd->{geom}{sectors} * $hd->{geom}{heads}; +} + +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->{size} = $end - $part->{start}; +} +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) = @_; my $g = ""; @@ -40,9 +64,6 @@ sub get_geometry($) { my %geom; @geom{qw(heads sectors cylinders start)} = unpack "CCSL", $g; - #- handle this strange but necessary reduction of visible cylinders on sparc, assume 2 for instance. - $geom{total_cylinders} = $geom{cylinders}; $geom{cylinders} -= 2 if arch() =~ /^sparc/; - { geom => \%geom, totalsectors => $geom{heads} * $geom{sectors} * $geom{cylinders} }; } |