From 0306ad0100b9d40606d723706f909438a27dfac1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 27 Jul 2004 10:31:34 +0000 Subject: - add field {fs_type} partially replacing {pt_type} {pt_type} is always a number, {fs_type} is always a string - introduce set_isFormatted() (to ensure {notFormatted} but also {fs_type_from_magic} and {bad_fs_type_magic} are updated) - don't use 0x483 for ext3 anymore (same for reiserfs...), the type_name gives both a pt_type and a fs_type - many accessors from partition_table removed (type2fs(), fs2pt_type()) - remove isThisFs() (not useful anymore since we can use directly {fs_type}) - remove isFat() (inline the function) - other isXXX() from partition_table are moved to fs::type - part2name() is now fs::type::part2type_name - name2pt_type() is now fs::type::type_name2subpart() - partition_table::important_types() is now fs::type::type_names() - fsedit::typeOfPart() is now fs::type::fs_type_from_magic() - no need to truncate type_name since they are shorter --- perl-install/partition_table/mac.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'perl-install/partition_table/mac.pm') diff --git a/perl-install/partition_table/mac.pm b/perl-install/partition_table/mac.pm index 219b6434d..4b60710bb 100644 --- a/perl-install/partition_table/mac.pm +++ b/perl-install/partition_table/mac.pm @@ -7,6 +7,7 @@ use vars qw(@ISA $freepart $bootstrap_part $macos_part); @ISA = qw(partition_table::raw); use common; +use fs::type; use partition_table::raw; use partition_table; use c; @@ -139,7 +140,7 @@ sub read($$) { $h{start} = ($h{pPBlockStart} * $info{bzBlkSize}) / 512; if ($h{pType} =~ /^Apple_UNIX_SVR2/i) { - $h{pName} =~ /swap/i ? ($h{pt_type} = 0x82) : ($h{pt_type} = 0x83); + $h{fs_type} = $h{pName} =~ /swap/i ? 'swap' : 'ext2'; } elsif ($h{pType} =~ /^Apple_Free/i) { #- need to locate a 1MB partition to setup a bootstrap on if ($freepart && $freepart->{size} >= 1) { @@ -151,7 +152,7 @@ sub read($$) { $h{pt_type} = 0x0; $h{pName} = 'Extra'; } elsif ($h{pType} =~ /^Apple_HFS/i) { - $h{pt_type} = 0x402; + fs::type::set_pt_type(\%h, 0x402); if (defined $macos_part) { #- swag at identifying MacOS - 1st HFS partition } else { @@ -297,27 +298,27 @@ sub write($$$;$) { log::l("writing a bootstrap at /dev/$_->{device}"); $install_steps_interactive::new_bootstrap = 1 if !(defined $partition_table::mac::bootstrap_part); $bootstrap_part = "/dev/" . $_->{device}; - } elsif ($_->{pt_type} == 0x82) { + } elsif (isSwap($_)) { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "swap"; $_->{pFlags} = 0x33; - } elsif ($_->{pt_type} == 0x83) { + } elsif ($_->{fs_type} eq 'ext2') { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "Linux Native"; $_->{pFlags} = 0x33; - } elsif ($_->{pt_type} == 0x183) { + } elsif ($_->{fs_type} eq 'reiserfs') { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "Linux ReiserFS"; $_->{pFlags} = 0x33; - } elsif ($_->{pt_type} == 0x283) { + } elsif ($_->{fs_type} eq 'xfs') { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "Linux XFS"; $_->{pFlags} = 0x33; - } elsif ($_->{pt_type} == 0x383) { + } elsif ($_->{fs_type} eq 'jfs') { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "Linux JFS"; $_->{pFlags} = 0x33; - } elsif ($_->{pt_type} == 0x483) { + } elsif ($_->{fs_type} eq 'ext3') { $_->{pType} = "Apple_UNIX_SVR2"; $_->{pName} = "Linux ext3"; $_->{pFlags} = 0x33; -- cgit v1.2.1