summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table_raw.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table_raw.pm')
-rw-r--r--perl-install/partition_table_raw.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm
index 41a49d552..d1399f230 100644
--- a/perl-install/partition_table_raw.pm
+++ b/perl-install/partition_table_raw.pm
@@ -73,11 +73,13 @@ sub get_geometry($) {
local *F; sysopen 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};
- { geom => \%geom, totalsectors => $geom{heads} * $geom{sectors} * $geom{cylinders} };
+ #- $geom{cylinders} is no good (only a ushort, that means less than 2^16 => at best 512MB)
+ my $total = c::total_sectors(fileno F);
+ $geom{totalcylinders} = $total / $geom{heads} * $geom{sectors};
+
+ { geom => \%geom, totalsectors => $total };
}
sub openit($$;$) { sysopen $_[1], $_[0]{file}, $_[2] || 0; }