summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table_raw.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-10-19 11:25:33 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-10-19 11:25:33 +0000
commitec8a108435108236cf22f96934e10b2122f261f8 (patch)
tree02ff81c6cb0295c89fefce4d2cf50261c7794862 /perl-install/partition_table_raw.pm
parent071da3cb69853ddae845b603d373c84600dbbfef (diff)
downloaddrakx-backup-do-not-use-ec8a108435108236cf22f96934e10b2122f261f8.tar
drakx-backup-do-not-use-ec8a108435108236cf22f96934e10b2122f261f8.tar.gz
drakx-backup-do-not-use-ec8a108435108236cf22f96934e10b2122f261f8.tar.bz2
drakx-backup-do-not-use-ec8a108435108236cf22f96934e10b2122f261f8.tar.xz
drakx-backup-do-not-use-ec8a108435108236cf22f96934e10b2122f261f8.zip
(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)
Diffstat (limited to 'perl-install/partition_table_raw.pm')
-rw-r--r--perl-install/partition_table_raw.pm28
1 files 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");