summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/dos.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table/dos.pm')
-rw-r--r--perl-install/partition_table/dos.pm26
1 files changed, 23 insertions, 3 deletions
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 38cdf60ed..23164a286 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -124,6 +124,22 @@ sub guess_geometry_from_partition_table {
$geom;
}
+sub geometry_from_edd {
+ my ($hd, $edd_dir) = @_;
+
+ my $sectors = cat_("$edd_dir/legacy_sectors_per_track") or return;
+ my $heads = cat_("$edd_dir/legacy_max_head") or return;
+
+ my $geom = { sectors => 0 + $sectors, heads => 1 + $heads, from_edd => 1 };
+ is_geometry_valid_for_the_partition_table($hd, $geom, 0) or return;
+ partition_table::raw::compute_nb_cylinders($geom, $hd->{totalsectors});
+
+ log::l("geometry_from_edd $hd->{device} $hd->{volume_id}: " . geometry_to_string($geom));
+
+ $geom;
+}
+
+
sub try_every_geometry {
my ($hd) = @_;
@@ -148,7 +164,7 @@ sub set_best_geometry_for_the_partition_table {
my $guessed_geom = guess_geometry_from_partition_table($hd);
if ($guessed_geom->{empty}) {
- log::l("$hd->{device}: would need looking at BIOS info to find out geometry");
+ log::l("$hd->{device}: would need looking at BIOS info to find out geometry") if !$hd->{geom}{from_edd};
return;
}
my $default_ok = is_geometry_valid_for_the_partition_table($hd, $hd->{geom}, 0);
@@ -185,7 +201,9 @@ sub read {
my @pt = map {
sysread $F, $tmp, psizeof($format) or die "error while reading partition table in sector $sector";
- my %h; @h{@fields} = unpack $format, $tmp;
+ my %h;
+ @h{@fields} = unpack $format, $tmp;
+ fs::type::set_pt_type(\%h, $h{pt_type});
\%h;
} (1..$nb_primary);
@@ -198,9 +216,11 @@ sub read {
# write the partition table (and extended ones)
# for each entry, it uses fields: start, size, pt_type, active
-sub write($$$;$) {
+sub write {
my ($hd, $sector, $pt) = @_;
+ log::l("partition::dos::write $hd->{device}");
+
#- handle testing for writing partition table on file only!
my $F;
if ($::testing) {