From 8974a1c84810d773e015ec6ad7e92e975c579733 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 14 Feb 2020 15:29:30 +0100 Subject: partially podify fs::* --- perl-install/fs/type.pm | 58 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 4 deletions(-) (limited to 'perl-install/fs/type.pm') diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm index 697b8c9d9..f4820e90b 100644 --- a/perl-install/fs/type.pm +++ b/perl-install/fs/type.pm @@ -6,6 +6,15 @@ use strict; use common; use devices; +=head1 SYNOPSYS + +B enables to perform various tests on filesystem types. + +=head1 Functions + +=over + +=cut our @ISA = qw(Exporter); our @EXPORT = qw( @@ -289,6 +298,7 @@ sub type_subpart_from_magic { $p; } +# helpers sub defaultFS() { 'ext4' } sub true_local_fs_types() { qw(btrfs ext3 ext2 ext4 reiserfs xfs jfs) } @@ -320,16 +330,42 @@ sub isRecovery { ); } +=item isTrueLocalFS($part) + +Like isTrueFS(), to make a distinction between ext3/reiserfs/... and NFS + => allow /home on NFS + +=cut + sub isTrueFS { isTrueLocalFS($_[0]) || $_[0]{fs_type} eq 'nfs' } + +=item isTrueFS($part) + +Is is a general purpose file system with the right Unix properties + +=cut + sub isTrueLocalFS { member($_[0]{fs_type}, true_local_fs_types()) } -sub isOtherAvailableFS { isESP($_[0]) || isFat_or_NTFS($_[0]) || member($_[0]{fs_type}, 'ufs', 'hfs', 'iso9660') } #- other OS that linux can access its filesystem +=item isOtherAvailableFS($part) + +Is it another OS that linux can access its filesystem + +=cut + +sub isOtherAvailableFS { isESP($_[0]) || isFat_or_NTFS($_[0]) || member($_[0]{fs_type}, 'ufs', 'hfs', 'iso9660') } sub isMountableRW { (isTrueFS($_[0]) || isOtherAvailableFS($_[0])) && $_[0]{fs_type} ne 'ntfs' } sub cannotBeMountable { my ($part) = @_; isRawRAID($part) || isRawLUKS($part) || isRawLVM($part) || isBIOS_GRUB($part); } -# is not a special sg that cannot be mounted/formatted (parts of RAID/LVM, BIOS_GRUB): + +=item isFormatable($part) + +Is not a special sg that cannot be mounted/formatted (parts of RAID/LVM, BIOS_GRUB). Basically the reverse of cannotBeMountable(). + +=cut + sub isFormatable { my ($part) = @_; !cannotBeMountable($part); @@ -352,7 +388,12 @@ sub isMounted { $_[0]{isMounted} } sub isBusy { isMounted($_[0]) || isPartOfRAID($_[0]) || isPartOfLVM($_[0]) || $_[0]{dm_active} || isPartOfLoopback($_[0]) } sub isSpecial { isRAID($_[0]) || isLVM($_[0]) || isLoopback($_[0]) || isUBD($_[0]) } -#- not for partitions, but for hds: +=item is_dmraid($hd) + +Check that a disk (not a partition) is in a fake/soft RAID + +=cut + sub is_dmraid { $_[0]{bus} =~ /^dmraid_/ } sub can_be_this_fs_type { @@ -377,7 +418,12 @@ sub set_isFormatted { delete $part->{fs_type_from_magic}; } -#- do this before modifying $part->{fs_type} +=item check($fs_type, $_hd, $part) + +Called before before modifying $part->{fs_type} + +=cut + sub check { my ($fs_type, $_hd, $part) = @_; $fs_type eq "jfs" && $part->{size} < MB(16) and die N("You cannot use JFS for partitions smaller than 16MB"); @@ -401,4 +447,8 @@ sub carry_root_loopback { any { $_->{mntpoint} eq '/' } @{$part->{loopback} || []}; } +=back + +=cut + 1; -- cgit v1.2.1