From ec8a108435108236cf22f96934e10b2122f261f8 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 19 Oct 2001 11:25:33 +0000 Subject: (zero_MBR): defaults to GPT on ia64 (raw_add, can_raw_add, raw_removed): created, can now be overloaded in partition_table_*.pm's (get_geometry): keep the total_sectors as given by c::total_sectors, don't try to recompute it based on nb_cylinders (for hds where total_sectors is not a multiple of nb_cylinders) --- perl-install/partition_table_raw.pm | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/perl-install/partition_table_raw.pm b/perl-install/partition_table_raw.pm index a56ff7648..3e84d93f5 100644 --- a/perl-install/partition_table_raw.pm +++ b/perl-install/partition_table_raw.pm @@ -88,12 +88,15 @@ sub get_geometry($) { 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 (my $total = c::total_sectors(fileno F)) { + if ($total = c::total_sectors(fileno F)) { $geom{cylinders} = int $total / $geom{heads} / $geom{sectors}; + } else { + $total = $geom{heads} * $geom{sectors} * $geom{cylinders} } - { geom => \%geom, totalsectors => $geom{heads} * $geom{sectors} * $geom{cylinders} }; + { geom => \%geom, totalsectors => $total }; } sub openit($$;$) { sysopen $_[1], $_[0]{file}, $_[2] || 0; } @@ -110,10 +113,29 @@ sub kernel_read($) { common::sync(); sleep(1); } +sub raw_removed { + my ($hd, $raw) = @_; +} +sub can_raw_add { + my ($hd) = @_; + $_->{size} || $_->{type} or return 1 foreach @{$hd->{primary}{raw}}; + 0; +} +sub raw_add { + my ($hd, $raw, $part) = @_; + + foreach (@$raw) { + $_->{size} || $_->{type} and next; + $_ = $part; + return; + } + die "raw_add: partition table already full"; +} + sub zero_MBR { my ($hd) = @_; #- force the standard partition type for the architecture - my $type = arch() eq "alpha" ? "bsd" : arch() =~ /^sparc/ ? "sun" : arch() eq "ppc" ? "mac" : "dos"; + my $type = arch() =~ /ia64/ ? 'gpt' : arch() eq "alpha" ? "bsd" : arch() =~ /^sparc/ ? "sun" : arch() eq "ppc" ? "mac" : "dos"; #- override standard mac type on PPC for IBM machines to dos $type = "dos" if (arch() =~ /ppc/ && detect_devices::get_mac_model() =~ /^IBM/); require("partition_table_$type.pm"); -- cgit v1.2.1