summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/raw.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-06-20 06:02:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-06-20 06:02:14 +0000
commita00c3995a27103b97534c3957dff9441874fd9ce (patch)
treea25f5f623f6802d3e4a5174bd115fba78bcbe7fe /perl-install/partition_table/raw.pm
parentbeff4cd64f0d64a11dd4d44bef7b2567d3a57516 (diff)
downloaddrakx-a00c3995a27103b97534c3957dff9441874fd9ce.tar
drakx-a00c3995a27103b97534c3957dff9441874fd9ce.tar.gz
drakx-a00c3995a27103b97534c3957dff9441874fd9ce.tar.bz2
drakx-a00c3995a27103b97534c3957dff9441874fd9ce.tar.xz
drakx-a00c3995a27103b97534c3957dff9441874fd9ce.zip
ignore HDIO_GETGEO fail (useful for dmraid)
Diffstat (limited to 'perl-install/partition_table/raw.pm')
-rw-r--r--perl-install/partition_table/raw.pm29
1 files changed, 16 insertions, 13 deletions
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index c290258f5..0887915c7 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -149,22 +149,25 @@ sub get_geometries {
sub get_geometry {
my ($dev) = @_;
- my $g = "";
-
sysopen(my $F, $dev, 0) or return;
- ioctl($F, c::HDIO_GETGEO(), $g) or return;
- my %geom; @geom{qw(heads sectors cylinders start)} = unpack "CCSL", $g;
- $geom{totalcylinders} = $geom{cylinders};
-
- my $total;
- #- $geom{cylinders} is no good (only a ushort, that means less than 2^16 => at best 512MB)
- if ($total = c::total_sectors(fileno $F)) {
- compute_nb_cylinders(\%geom, $total);
- } else {
- $total = $geom{heads} * $geom{sectors} * $geom{cylinders};
+
+ my $total = c::total_sectors(fileno $F);
+
+ my $g = "";
+ my %geom;
+ if (ioctl($F, c::HDIO_GETGEO(), $g)) {
+ @geom{qw(heads sectors cylinders start)} = unpack "CCSL", $g;
+ $geom{totalcylinders} = $geom{cylinders};
+
+ #- $geom{cylinders} is no good (only a ushort, that means less than 2^16 => at best 512MB)
+ if ($total) {
+ compute_nb_cylinders(\%geom, $total);
+ } else {
+ $total = $geom{heads} * $geom{sectors} * $geom{cylinders};
+ }
}
- { geom => \%geom, totalsectors => $total };
+ { totalsectors => $total, if_($geom{heads}, geom => \%geom) };
}
sub openit {