From 34ee9d7a4528ac87efc76fea4d1879d5ce2bb16d Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Mon, 14 Feb 2011 12:53:06 +0000 Subject: backport partition_table from 2010.1 --- perl-install/partition_table/raw.pm | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'perl-install/partition_table/raw.pm') diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm index a43cdc2ee..a4ad09046 100644 --- a/perl-install/partition_table/raw.pm +++ b/perl-install/partition_table/raw.pm @@ -1,4 +1,4 @@ -package partition_table::raw; # $Id: raw.pm 244309 2008-08-21 14:36:52Z pixel $ +package partition_table::raw; # $Id: raw.pm 266069 2010-02-09 19:47:35Z pterjan $ use diagnostics; use strict; @@ -79,11 +79,13 @@ 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}; - $part->{size} > 0 or die "adjustStart get a too small partition to handle correctly"; + if (cylinder_size($hd)) { + $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}; + $part->{size} > 0 or die "adjustStart get a too small partition to handle correctly"; + } } #- 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 @@ -122,7 +124,19 @@ sub get_geometries { my (@hds) = @_; @hds = grep { - if (my $h = get_geometry($_->{file})) { + if ($_->{bus} =~ /dmraid/) { + sysopen(my $F, $_->{file}, 0); + my $total = c::total_sectors(fileno $F); + my %geom; + $geom{heads} = 255; + $geom{sectors} = 63; + $geom{start} = 1; + compute_nb_cylinders(\%geom, $total); + $geom{totalcylinders} = $geom{cylinders}; + log::l("Fake geometry on ".$_->{file}.": heads=$geom{heads} sectors=$geom{sectors} cylinders=$geom{cylinders} start=$geom{start}"); + add2hash_($_, { totalsectors => $total, geom => \%geom }); + 1; + } elsif (my $h = get_geometry($_->{file})) { add2hash_($_, $h); 1; } else { -- cgit v1.2.1