From 473b5b8333cb42627bc83af4782f72be81d971cf Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 18 Sep 2007 12:30:17 +0000 Subject: rename partition_table::raw::clear() into partition_table::initialize() --- perl-install/fs/partitioning_wizard.pm | 2 +- perl-install/partition_table.pm | 23 +++++++++++++++++++++++ perl-install/partition_table/empty.pm | 2 +- perl-install/partition_table/raw.pm | 19 ++----------------- 4 files changed, 27 insertions(+), 19 deletions(-) (limited to 'perl-install') diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm index eb9266f7c..cac0b06df 100644 --- a/perl-install/fs/partitioning_wizard.pm +++ b/perl-install/fs/partitioning_wizard.pm @@ -211,7 +211,7 @@ filesystem checks will be run on your next boot into Microsoft Windows®")) if $ title => N("Partitioning"), icon => 'banner-part', interactive_help_id => 'takeOverHdConfirm' }) or return; - partition_table::raw::clear($hd); + partition_table::initialize($hd); fsedit::auto_allocate($all_hds, $partitions); 1; } ]; diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 9a66afc50..e249e2a83 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -223,6 +223,29 @@ sub get_normal_parts_and_holes { grep { !isEmpty($_) || $_->{size} >= $hd->cylinder_size } @l; } +sub _default_type { + 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/; + $type; +} + +sub initialize { + my ($hd, $o_type) = @_; + + my $type = $o_type || _default_type(); + + require "partition_table/$type.pm"; + "partition_table::$type"->initialize($hd); + + delete $hd->{extended}; + if (detect_devices::is_xbox()) { + my $part = { start => 1, size => 15632048, pt_type => 0x0bf, isFormatted => 1 }; + partition_table::dos::compute_CHS($hd, $part); + $hd->{primary}{raw}[0] = $part; + } +} + sub read_primary { my ($hd) = @_; diff --git a/perl-install/partition_table/empty.pm b/perl-install/partition_table/empty.pm index fb2d8ada3..fe4550f47 100644 --- a/perl-install/partition_table/empty.pm +++ b/perl-install/partition_table/empty.pm @@ -28,7 +28,7 @@ sub read_one { sysread $F, $tmp, 1024 or die "error reading magic number on disk $hd->{device}"; $tmp eq substr($tmp, 0, 1) x 1024 or die "bad magic number on disk $hd->{device}"; - partition_table::raw::clear($hd); + partition_table::initialize($hd); $hd->{primary}{raw}, $hd->{primary}{info}; } diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm index 95317cf72..096e36ccd 100644 --- a/perl-install/partition_table/raw.pm +++ b/perl-install/partition_table/raw.pm @@ -215,22 +215,7 @@ sub default_type { $type; } -sub zero_MBR { &clear } #- deprecated -sub clear { - my ($hd, $o_type) = @_; - - my $type = $o_type || default_type(); - - require "partition_table/$type.pm"; - "partition_table::$type"->initialize($hd); - - delete $hd->{extended}; - if (detect_devices::is_xbox()) { - my $part = { start => 1, size => 15632048, pt_type => 0x0bf, isFormatted => 1 }; - partition_table::dos::compute_CHS($hd, $part); - $hd->{primary}{raw}[0] = $part; - } -} +sub zero_MBR { &partition_table::initialize } #- deprecated sub clear_existing { my ($hd) = @_; @@ -242,7 +227,7 @@ sub zero_MBR_and_dirty { &clear_and_dirty } #- deprecated sub clear_and_dirty { my ($hd) = @_; $hd->clear_existing; - clear($hd); + partition_table::initialize($hd); } sub read_primary { -- cgit v1.2.1