summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-08-18 22:45:39 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-08-18 22:45:39 +0000
commit0daa4b4bf3073a6b8a470e0bf3be6744d71ae92e (patch)
tree414a00dea21af9fabc6c3849de49c463dfab4066
parentfff406c0d039bd5094996a3ff0fa9c44173280ba (diff)
downloaddrakx-0daa4b4bf3073a6b8a470e0bf3be6744d71ae92e.tar
drakx-0daa4b4bf3073a6b8a470e0bf3be6744d71ae92e.tar.gz
drakx-0daa4b4bf3073a6b8a470e0bf3be6744d71ae92e.tar.bz2
drakx-0daa4b4bf3073a6b8a470e0bf3be6744d71ae92e.tar.xz
drakx-0daa4b4bf3073a6b8a470e0bf3be6744d71ae92e.zip
fixes and function prototype removing
-rw-r--r--perl-install/any.pm2
-rw-r--r--perl-install/fs.pm36
-rw-r--r--perl-install/partition_table.pm47
3 files changed, 50 insertions, 35 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 86abdcb70..3b395e0f8 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -381,7 +381,7 @@ sub inspect {
$dir = '';
} else {
mkdir $dir, 0700;
- eval { fs::mount($part->{device}, $dir, type2fs($part->{type}), !$rw) };
+ eval { fs::mount($part->{device}, $dir, type2fs($part), !$rw) };
$@ and return;
}
my $h = before_leaving {
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 74c04a5f9..c6033dc15 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -79,7 +79,8 @@ sub mount_options {
}
sub mount_options_unpack {
- my ($packed_options, $part) = @_;
+ my ($part) = @_;
+ my ($type, $packed_options) = ($part->{type}, $part->{options});
my ($non_defaults, $user_implies) = mount_options();
@@ -94,12 +95,17 @@ sub mount_options_unpack {
$non_defaults->{$_} = 1 foreach @$l;
}
+ $non_defaults->{autofs} = 1; # autofs proposed for any types??
+ $non_defaults->{supermount} = 1 if member(type2fs($part), 'auto', @auto_fs);
+
my $defaults = { reverse %$non_defaults };
my %options = map { $_ => 0 } keys %$non_defaults;
my @unknown;
foreach (split(",", $packed_options)) {
if ($_ eq 'user') {
$options{$_} = 1 foreach ('user', @$user_implies);
+ } elsif (/fstype=(.*)/) {
+ $type = $1;
} elsif (exists $non_defaults->{$_}) {
$options{$_} = 1;
} elsif ($defaults->{$_}) {
@@ -108,15 +114,25 @@ sub mount_options_unpack {
push @unknown, $_;
}
}
+ $options{autofs} = 1 if $part->{type} eq 'autofs';
+ $options{supermount} = 1 if $part->{type} eq 'supermount';
+
my $unknown = join(",", @unknown);
- \%options, $unknown;
+ \%options, $unknown, $type;
}
sub mount_options_pack {
- my ($options, $unknown) = @_;
+ my ($part, $options, $unknown, $type) = @_;
my ($non_defaults, $user_implies) = mount_options();
my @l;
+
+ if ($options->{autofs} || $options->{supermount}) {
+ $options->{"fstype=$type"} = 1;
+ delete $options->{$_} and $part->{type} = $_ foreach 'autofs', 'supermount';
+ } else {
+ $part->{type} = $type;
+ }
if (delete $options->{user}) {
push @l, 'user';
foreach (@$user_implies) {
@@ -129,7 +145,7 @@ sub mount_options_pack {
push @l, grep { $options->{$_} } keys %$options;
push @l, $unknown;
- join(",", @l);
+ $part->{options} = join(",", grep { $_ } @l);
}
sub mount_options_help {
@@ -172,8 +188,8 @@ sub get_mntpoints_from_fstab {
foreach my $p (@$l) {
$p->{device} eq $_->{device} or next;
- $_->{type} ne 'auto' && $_->{type} ne type2fs($p->{type}) and
- log::l("err, fstab and partition table do not agree for $_->{device} type: " . (type2fs($p->{type}) || type2name($p->{type})) . " vs $_->{type}"), next;
+ $_->{type} ne 'auto' && $_->{type} ne type2fs($p) and
+ log::l("err, fstab and partition table do not agree for $_->{device} type: " . (type2fs($p) || type2name($p->{type})) . " vs $_->{type}"), next;
delete $p->{unsafeMntpoint} || !$p->{mntpoint} or next;
$p->{type} ||= $_->{type};
$p->{mntpoint} = $_->{mntpoint};
@@ -392,7 +408,7 @@ sub mount_part {
} elsif (loopback::carryRootLoopback($part)) {
$mntpoint = "/initrd/loopfs";
}
- mount(devices::make($dev), $mntpoint, type2fs($part->{type}), $rdonly);
+ mount(devices::make($dev), $mntpoint, type2fs($part), $rdonly);
rmdir "$mntpoint/lost+found";
}
}
@@ -451,7 +467,7 @@ sub df {
return; #- won't even try!
} else {
mkdir $dir;
- eval { mount($part->{device}, $dir, type2fs($part->{type}), 'readonly') };
+ eval { mount($part->{device}, $dir, type2fs($part), 'readonly') };
if ($@) {
$part->{notFormatted} = 1;
$part->{isFormatted} = 0;
@@ -541,9 +557,9 @@ sub write_fstab($;$$@) {
eval { devices::make("$prefix/$dev") } if $dir && !isLoopback($_);
mkdir "$prefix/$_->{mntpoint}", 0755 if $_->{mntpoint} && !isSwap($_);
- [ $dev, $_->{mntpoint}, type2fs($_->{type}), $options, $freq, $passno ];
+ [ $dev, $_->{mntpoint}, type2fs($_), $options, $freq, $passno ];
- } grep { $_->{mntpoint} && type2fs($_->{type}) } @$fstab;
+ } grep { $_->{mntpoint} && type2fs($_) } @$fstab;
push @to_add, map { [ split ] } cat_("$prefix/etc/fstab");
diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm
index 6793b33a6..2e7388b9a 100644
--- a/perl-install/partition_table.pm
+++ b/perl-install/partition_table.pm
@@ -195,7 +195,6 @@ arch() !~ /sparc/ ? (
0x483=> 'ext3',
0x401 => 'apple',
0x402 => 'hfs',
- nfs => 'nfs', #- hack
);
my %types_rev = reverse %types;
@@ -209,35 +208,35 @@ sub important_types {
difference2(\@l, \@bad_types);
}
-sub type2name($) { $types{$_[0]} || $_[0] }
-sub type2fs($) { $type2fs{$_[0]} }
-sub fs2type($) { $fs2type{$_[0]} }
-sub name2type($) {
+sub type2fs { $type2fs{$_[0]{type}} || $_[0]{type} }
+sub fs2type { $fs2type{$_[0]} || $_[0] }
+sub type2name { $types{$_[0]} || $_[0] }
+sub name2type {
local ($_) = @_;
/0x(.*)/ ? hex $1 : $types_rev{$_} || $_;
}
-sub isWholedisk($) { arch() =~ /^sparc/ && $_[0]{type} == 5 }
-sub isExtended($) { arch() !~ /^sparc/ && ($_[0]{type} == 5 || $_[0]{type} == 0xf || $_[0]{type} == 0x85) }
-sub isRawLVM($) { $_[0]{type} == 0x8e }
-sub isRawRAID($) { $_[0]{type} == 0xfd }
-sub isSwap($) { $type2fs{$_[0]{type}} eq 'swap' }
-sub isExt2($) { $type2fs{$_[0]{type}} eq 'ext2' }
-sub isDos($) { arch() !~ /^sparc/ && $ {{ 1=>1, 4=>1, 6=>1 }}{$_[0]{type}} }
-sub isWin($) { $ {{ 0xb=>1, 0xc=>1, 0xe=>1, 0x1b=>1, 0x1c=>1, 0x1e=>1 }}{$_[0]{type}} }
-sub isFat($) { isDos($_[0]) || isWin($_[0]) }
-sub isSunOS($) { arch() =~ /sparc/ && $ {{ 0x1=>1, 0x2=>1, 0x4=>1, 0x6=>1, 0x7=>1, 0x8=>1 }}{$_[0]{type}} }
-sub isNfs($) { $_[0]{type} eq 'nfs' } #- small hack
-sub isNT($) { arch() !~ /^sparc/ && $_[0]{type} == 0x7 }
-sub isSupermount($) { $_[0]{type} eq 'supermount' }
-sub isApple($) { $type2fs{$_[0]{type}} eq 'apple' && defined $_[0]{isDriver} }
-sub isAppleBootstrap($) { $type2fs{$_[0]{type}} eq 'apple' && defined $_[0]{isBoot} }
+sub isWholedisk { arch() =~ /^sparc/ && $_[0]{type} == 5 }
+sub isExtended { arch() !~ /^sparc/ && ($_[0]{type} == 5 || $_[0]{type} == 0xf || $_[0]{type} == 0x85) }
+sub isRawLVM { $_[0]{type} == 0x8e }
+sub isRawRAID { $_[0]{type} == 0xfd }
+sub isSwap { type2fs($_[0]) eq 'swap' }
+sub isExt2 { type2fs($_[0]) eq 'ext2' }
+sub isDos { arch() !~ /^sparc/ && $ {{ 1=>1, 4=>1, 6=>1 }}{$_[0]{type}} }
+sub isWin { $ {{ 0xb=>1, 0xc=>1, 0xe=>1, 0x1b=>1, 0x1c=>1, 0x1e=>1 }}{$_[0]{type}} }
+sub isFat { isDos($_[0]) || isWin($_[0]) }
+sub isSunOS { arch() =~ /sparc/ && $ {{ 0x1=>1, 0x2=>1, 0x4=>1, 0x6=>1, 0x7=>1, 0x8=>1 }}{$_[0]{type}} }
+sub isNfs { $_[0]{type} eq 'nfs' } #- small hack
+sub isNT { arch() !~ /^sparc/ && $_[0]{type} == 0x7 }
+sub isSupermount { $_[0]{type} eq 'supermount' }
+sub isApple { type2fs($_[0]) eq 'apple' && defined $_[0]{isDriver} }
+sub isAppleBootstrap { type2fs($_[0]) eq 'apple' && defined $_[0]{isBoot} }
sub isHiddenMacPart { defined $_[0]{isMap} }
-sub isThisFs { $type2fs{$_[1]{type}} eq $_[0] }
-sub isTrueFS { member($type2fs{$_[0]{type}}, qw(ext2 reiserfs xfs jfs ext3)) }
+sub isThisFs { type2fs($_[1]) eq $_[0] }
+sub isTrueFS { member(type2fs($_[0]), qw(ext2 reiserfs xfs jfs ext3)) }
-sub isOtherAvailableFS($) { isFat($_[0]) || isSunOS($_[0]) || isThisFs('hfs', $_[0]) } #- other OS that linux can access its filesystem
+sub isOtherAvailableFS { isFat($_[0]) || isSunOS($_[0]) || isThisFs('hfs', $_[0]) } #- other OS that linux can access its filesystem
sub isMountableRW { isTrueFS($_[0]) || isOtherAvailableFS($_[0]) }
sub isNonMountable { isRawRAID($_[0]) || isRawLVM($_[0]) }
@@ -512,7 +511,7 @@ sub read_extended {
}
# write the partition table
-sub write($) {
+sub write {
my ($hd) = @_;
$hd->{isDirty} or return;