| 1 | package Sys::Export::VFAT::Geometry; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Calculate addresses and sizes of structures within a FAT filesystem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | our $VERSION = '0.006'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use v5.28; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use experimental qw( signatures ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use Sys::Export qw( isa_hash isa_int isa_pow2 round_up_to_pow2 round_up_to_multiple ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use Scalar::Util qw( dualvar ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use POSIX 'ceil'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | our @CARP_NOT= qw( Sys::Export::VFAT ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | FAT12 => dualvar(12, "FAT12"), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | FAT16 => dualvar(16, "FAT16"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | FAT32 => dualvar(32, "FAT32"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | FAT12_MAX_CLUSTERS => 4085-1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | FAT12_IDEAL_MAX_CLUSTERS => 4085-16, # docs recommend 16 away from cutoff on either side | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | FAT16_MIN_CLUSTERS => 4085, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | FAT16_IDEAL_MIN_CLUSTERS => 4085+16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | FAT16_MAX_CLUSTERS => 65525-1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | FAT16_IDEAL_MAX_CLUSTERS => 65525-16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | FAT32_MIN_CLUSTERS => 65525, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | FAT32_IDEAL_MIN_CLUSTERS => 65525+16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | FAT32_MAX_CLUSTERS => 0xFFFFFF5, # can't allow 0xFFFFFF7 to be allocatable ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 5 | our @EXPORT_OK= qw( FAT12 FAT16 FAT32 FAT12_MAX_CLUSTERS FAT12_IDEAL_MAX_CLUSTERS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | FAT16_MIN_CLUSTERS FAT16_IDEAL_MIN_CLUSTERS FAT16_MAX_CLUSTERS FAT16_IDEAL_MAX_CLUSTERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | FAT32_MIN_CLUSTERS FAT32_IDEAL_MIN_CLUSTERS FAT32_MAX_CLUSTERS ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 378 | ▶ | sub new($class, @attrs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=64 SCAR=57.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | my %attrs= @attrs == 1 && isa_hash $attrs[0]? %{$attrs[0]} : @attrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@attrs == 1 and &isa_hash($attrs[0])
MC/DC0%0/2
@attrs == 1 and &isa_hash($attrs[0])
@attrs == 1
&isa_hash($attrs[0])
Truth table33%1/3
A and B
A= @attrs == 1B= &isa_hash($attrs[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | my ($bytes_per_sector, $sectors_per_cluster, $fat_count, $reserved_sector_count, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | $fat_sector_count, $root_dirent_count, $cluster_count, $total_sector_count, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | $min_bits, $volume_offset, $align_clusters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 378 | ) = delete @attrs{qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | bytes_per_sector sectors_per_cluster fat_count reserved_sector_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | fat_sector_count root_dirent_count cluster_count total_sector_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | min_bits volume_offset align_clusters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | )}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 378 | ▶ | !defined $align_clusters or isa_pow2($align_clusters) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $align_clusters or &isa_pow2($align_clusters)
MC/DC0%0/2
not defined $align_clusters or &isa_pow2($align_clusters)
not defined $align_clusters
&isa_pow2($align_clusters)
Truth table66%2/3
not(A) or B
A= not defined $align_clustersB= &isa_pow2($align_clusters)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | or croak "align_clusters must be a power of 2 (was $align_clusters)"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 378 | ▶ | $volume_offset //= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$volume_offset //= 0
MC/DC100%1/1
$volume_offset //= 0
$volume_offset
Truth table100%2/2
A
A= $volume_offset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 378 | ▶ | isa_int($volume_offset) && $volume_offset >= 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&isa_int($volume_offset) and $volume_offset >= 0
MC/DC0%0/2
&isa_int($volume_offset) and $volume_offset >= 0
&isa_int($volume_offset)
$volume_offset >= 0
Truth table33%1/3
A and B
A= &isa_int($volume_offset)B= $volume_offset >= 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | or croak "volume_offset must be a non-negative integer"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 378 | ▶ | $bytes_per_sector //= 512; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$bytes_per_sector //= 512
MC/DC100%1/1
$bytes_per_sector //= 512
$bytes_per_sector
Truth table100%2/2
A
A= $bytes_per_sector
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 378 | ▶ | isa_pow2($bytes_per_sector) && 512 <= $bytes_per_sector && $bytes_per_sector <= 4096 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
&isa_pow2($bytes_per_sector) and 512 <= $bytes_per_sector and $bytes_per_sector <= 4096
&isa_pow2($bytes_per_sector) and 512 <= $bytes_per_sector
MC/DC0%0/3
&isa_pow2($bytes_per_sector) and 512 <= $bytes_per_sector and $bytes_per_sector <= 4096
&isa_pow2($bytes_per_sector)
512 <= $bytes_per_sector
$bytes_per_sector <= 4096
Truth table25%1/4
A and B and C
A= &isa_pow2($bytes_per_sector)B= 512 <= $bytes_per_sectorC= $bytes_per_sector <= 4096
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | or croak "Invalid bytes_per_sector $bytes_per_sector"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # Default sectors_per_cluster to whatever makes 4K | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 378 | ▶ | $sectors_per_cluster //= ($bytes_per_sector >= 4096? 1 : 4096 / $bytes_per_sector); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$sectors_per_cluster //= $bytes_per_sector >= 4096 ? 1 : 4096 / $bytes_per_sector
MC/DC100%1/1
$sectors_per_cluster //= $bytes_per_sector >= 4096 ? 1 : 4096 / $bytes_per_sector
$sectors_per_cluster
Truth table100%2/2
A
A= $sectors_per_cluster
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 378 | ▶ | isa_pow2($sectors_per_cluster) && $sectors_per_cluster <= 128 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&isa_pow2($sectors_per_cluster) and $sectors_per_cluster <= 128
MC/DC0%0/2
&isa_pow2($sectors_per_cluster) and $sectors_per_cluster <= 128
&isa_pow2($sectors_per_cluster)
$sectors_per_cluster <= 128
Truth table33%1/3
A and B
A= &isa_pow2($sectors_per_cluster)B= $sectors_per_cluster <= 128
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | or croak "Invalid sectors_per_cluster $sectors_per_cluster"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 378 | my $cluster_size= $bytes_per_sector * $sectors_per_cluster; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 378 | ▶ | $cluster_size <= 32*1024 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | or carp "Warning: bytes_per_sector * sectors_per_cluster > 32KiB which is not valid for some drivers"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # Default fat_count to 2 unless specified otherwise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 378 | ▶ | $fat_count //= 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$fat_count //= 2
MC/DC100%1/1
$fat_count //= 2
$fat_count
Truth table100%2/2
A
A= $fat_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 378 | ▶ | isa_int $fat_count && 0 < $fat_count && $fat_count <= 255 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
&isa_int($fat_count) and 0 < $fat_count and $fat_count <= 255
&isa_int($fat_count) and 0 < $fat_count
MC/DC0%0/3
&isa_int($fat_count) and 0 < $fat_count and $fat_count <= 255
&isa_int($fat_count)
0 < $fat_count
$fat_count <= 255
Truth table25%1/4
A and B and C
A= &isa_int($fat_count)B= 0 < $fat_countC= $fat_count <= 255
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | or croak "Invalid fat_count $fat_count"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 378 | my $self= bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | bytes_per_sector => $bytes_per_sector, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | sectors_per_cluster => $sectors_per_cluster, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | fat_count => $fat_count, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | volume_offset => $volume_offset, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # From here down, we are either determining cluster_count from other properties, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # or deriving other properties from cluster_count. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 378 | my $bits; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 378 | ▶ | if (defined $reserved_sector_count && defined $fat_sector_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%3/9
defined $reserved_sector_count and defined $fat_sector_count and defined $root_dirent_count and defined $total_sector_count
defined $reserved_sector_count and defined $fat_sector_count and defined $root_dirent_count
defined $reserved_sector_count and defined $fat_sector_count
MC/DC0%0/4
defined $reserved_sector_count and defined $fat_sector_count and defined $root_dirent_count and defined $total_sector_count
defined $reserved_sector_count
defined $fat_sector_count
defined $root_dirent_count
defined $total_sector_count
Truth table20%1/5
A and B and C and D
A= defined $reserved_sector_countB= defined $fat_sector_countC= defined $root_dirent_countD= defined $total_sector_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | && defined $root_dirent_count && defined $total_sector_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # All main properties of the geometry are defined. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | my $root_sector_count= int(($root_dirent_count + ($self->dirent_per_sector-1)) / $self->dirent_per_sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $data_sectors= $total_sector_count - $reserved_sector_count - $fat_count * $fat_sector_count - $root_sector_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $calc_cluster_count= int($data_sectors / $sectors_per_cluster); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | croak "Supplied cluster_count disagrees with computed value" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $cluster_count and $cluster_count != $calc_cluster_count
MC/DC0%0/2
defined $cluster_count and $cluster_count != $calc_cluster_count
defined $cluster_count
$cluster_count != $calc_cluster_count
Truth table0%0/3
A and B
A= defined $cluster_countB= $cluster_count != $calc_cluster_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | if defined $cluster_count && $cluster_count != $calc_cluster_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $cluster_count //= $calc_cluster_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$cluster_count //= $calc_cluster_count
MC/DC0%0/2
$cluster_count //= $calc_cluster_count
$cluster_count
$calc_cluster_count
Truth table0%0/3
A //= B
A= $cluster_countB= $calc_cluster_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | $bits= $cluster_count < FAT16_MIN_CLUSTERS? FAT12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | : $cluster_count < FAT32_MIN_CLUSTERS? FAT16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | : FAT32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | elsif (defined $cluster_count) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 378 | ▶ | isa_int $cluster_count && $cluster_count > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&isa_int($cluster_count) and $cluster_count > 0
MC/DC0%0/2
&isa_int($cluster_count) and $cluster_count > 0
&isa_int($cluster_count)
$cluster_count > 0
Truth table33%1/3
A and B
A= &isa_int($cluster_count)B= $cluster_count > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | or croak "Invalid cluster_count '$cluster_count'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # FAT docs recommend avoiding numbers near the boundary of FAT12/FAT16/FAT32 to avoid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # other people's math errors. But, allow the caller to disable this adjustment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 378 | ▶ | unless (delete $attrs{exact_cluster_count}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 378 | ▶ | if ($cluster_count >= FAT12_IDEAL_MAX_CLUSTERS && $cluster_count < FAT16_IDEAL_MIN_CLUSTERS) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$cluster_count >= 4069 and $cluster_count < 4101
MC/DC0%0/2
$cluster_count >= 4069 and $cluster_count < 4101
$cluster_count >= 4069
$cluster_count < 4101
Truth table66%2/3
A and B
A= $cluster_count >= 4069B= $cluster_count < 4101
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $cluster_count= FAT16_IDEAL_MIN_CLUSTERS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ▶ | } elsif ($cluster_count >= FAT16_IDEAL_MAX_CLUSTERS && $cluster_count < FAT32_IDEAL_MIN_CLUSTERS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cluster_count >= 65509 and $cluster_count < 65541
MC/DC0%0/2
$cluster_count >= 65509 and $cluster_count < 65541
$cluster_count >= 65509
$cluster_count < 65541
Truth table66%2/3
A and B
A= $cluster_count >= 65509B= $cluster_count < 65541
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $cluster_count= FAT32_IDEAL_MIN_CLUSTERS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # These are the official boundary numbers that determine the filesystem type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 378 | ▶ | $min_bits //= FAT12; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$min_bits //= "FAT12"
MC/DC0%0/1
$min_bits //= "FAT12"
$min_bits
Truth table50%1/2
A
A= $min_bits
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 378 | ▶ | $bits= $cluster_count < FAT16_MIN_CLUSTERS? FAT12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | : $cluster_count < FAT32_MIN_CLUSTERS? FAT16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | : FAT32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 378 | ▶ | if ($bits < $min_bits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $bits= $min_bits; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # Increase to the minimum number of clusters if a specific number of bits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # was requested. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | $cluster_count= ($bits == FAT16)? FAT16_IDEAL_MIN_CLUSTERS : FAT32_IDEAL_MIN_CLUSTERS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | croak "Not enough attributes supplied to determine geometry"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 378 | $self->{cluster_count}= $cluster_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 378 | $self->{bits}= $bits; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # Check how many sectors are occupied by each allocation table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 378 | my $fat_byte_count= ( ($cluster_count + 2) * $bits + 7 ) >> 3; # round up to bytes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 378 | ▶ | if (defined $fat_sector_count) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | $fat_sector_count * $bytes_per_sector >= $fat_byte_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | or croak "Invalid fat_sector_count, smaller than $fat_byte_count bytes"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 378 | $fat_sector_count= int(($fat_byte_count + ($bytes_per_sector - 1)) / $bytes_per_sector); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 378 | $self->{fat_sector_count}= $fat_sector_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # Check how many sectors are occupied by root directory entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # For fat12/16, The FAT spec document suggests 512 as a good default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # Allow the user to supply the actual number of root entries and then we round that. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 378 | my $used_root_dirent_count= delete $attrs{used_root_dirent_count}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 378 | ▶ | if ($bits < FAT32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 337 | ▶ | if (defined $root_dirent_count) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | ▶ | $root_dirent_count >= 1 && $root_dirent_count < 0xFFFF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$root_dirent_count >= 1 and $root_dirent_count < 65535
MC/DC0%0/2
$root_dirent_count >= 1 and $root_dirent_count < 65535
$root_dirent_count >= 1
$root_dirent_count < 65535
Truth table33%1/3
A and B
A= $root_dirent_count >= 1B= $root_dirent_count < 65535
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | or croak "Invalid root_dirent_count for FAT12/16"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 336 | ▶ | $root_dirent_count= $used_root_dirent_count // 512; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$used_root_dirent_count // 512
MC/DC100%1/1
$used_root_dirent_count // 512
$used_root_dirent_count
Truth table100%2/2
A
A= $used_root_dirent_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Round up to as many as fit in this number of sectors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 336 | my $remainder= ($root_dirent_count & ($self->dirent_per_sector - 1)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 336 | ▶ | $root_dirent_count += ($self->dirent_per_sector - $remainder) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | if $remainder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 337 | ▶ | ($reserved_sector_count //= 1) == 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$reserved_sector_count //= 1
MC/DC0%0/1
$reserved_sector_count //= 1
$reserved_sector_count
Truth table50%1/2
A
A= $reserved_sector_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | or croak "reserved_sector_count should be 1 for FAT12/16"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 41 | ▶ | ($root_dirent_count //= 0) == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$root_dirent_count //= 0
MC/DC0%0/1
$root_dirent_count //= 0
$root_dirent_count
Truth table50%1/2
A
A= $root_dirent_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | or croak "root_dirent_count must be zero for FAT32"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 41 | ▶ | $reserved_sector_count //= 32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$reserved_sector_count //= 32
MC/DC0%0/1
$reserved_sector_count //= 32
$reserved_sector_count
Truth table50%1/2
A
A= $reserved_sector_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 41 | ▶ | isa_int $reserved_sector_count && $reserved_sector_count >= 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
&isa_int($reserved_sector_count) and $reserved_sector_count >= 2
MC/DC0%0/2
&isa_int($reserved_sector_count) and $reserved_sector_count >= 2
&isa_int($reserved_sector_count)
$reserved_sector_count >= 2
Truth table33%1/3
A and B
A= &isa_int($reserved_sector_count)B= $reserved_sector_count >= 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | or croak "reserved_sector_count must be greater than 2 for FAT32"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # If caller requested alignment of clusters, figure that out | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 378 | ▶ | if (defined $align_clusters && $align_clusters > $bytes_per_sector) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $align_clusters and $align_clusters > $bytes_per_sector
MC/DC100%2/2
defined $align_clusters and $align_clusters > $bytes_per_sector
defined $align_clusters
$align_clusters > $bytes_per_sector
Truth table100%3/3
A and B
A= defined $align_clustersB= $align_clusters > $bytes_per_sector
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # there's a method for this, but avoid caching things yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 220 | my $data_addr= $volume_offset + $bytes_per_sector * ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | $reserved_sector_count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | + ($fat_count*$fat_sector_count) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | + ceil($root_dirent_count / $self->dirent_per_sector) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # If the cluster size is greater or equal to the requested alignment, ensure the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # data start falls on that boundary. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # If the cluster size is smaller than the requested alignment, ensure the data start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # falls on a cluster boundary so that some number of clusters will equal the alignment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 220 | ▶ | my $align= ($cluster_size >= $align_clusters)? $align_clusters : $cluster_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 220 | ▶ | if (my $ofs= $data_addr & ($align-1)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 162 | my $shift_n_sectors= ($align - $ofs) / $bytes_per_sector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | #say sprintf "# remainder=0x%X, cluster_size=$cluster_size align_clusters=$align_clusters $align-$ofs=".($align-$ofs)." shift %d sectors", $ofs, $shift_n_sectors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 162 | ▶ | if ($bits < FAT32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # Reserved sectors should be 1, so expand number of root entries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 149 | $root_dirent_count += $shift_n_sectors * $self->dirent_per_sector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # Add however many reserved sectors we need | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 13 | $reserved_sector_count += $shift_n_sectors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 378 | $self->{root_dirent_count}= $root_dirent_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 378 | $self->{reserved_sector_count}= $reserved_sector_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 378 | ▶ | carp "Unused constructor parameters: ".join(' ', keys %attrs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | if keys %attrs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 378 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 23345 | ▶ | sub volume_offset($self) { $self->{volume_offset} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
volume_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 23587 | ▶ | sub bytes_per_sector($self) { $self->{bytes_per_sector} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bytes_per_sector: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 22073 | ▶ | sub sectors_per_cluster($self) { $self->{sectors_per_cluster} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sectors_per_cluster: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 31338 | ▶ | sub bytes_per_cluster($self) { $self->{bytes_per_sector} * $self->{sectors_per_cluster} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bytes_per_cluster: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1513 | ▶ | sub dirent_per_sector($self) { $self->{bytes_per_sector} / 32 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dirent_per_sector: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | ▶ | sub dirent_per_cluster($self) { $self->{bytes_per_sector} * $self->{sectors_per_cluster} / 32 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dirent_per_cluster: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 406 | ▶ | sub bits($self) { $self->{bits} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bits: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 530 | ▶ | sub reserved_sector_count($self) { $self->{reserved_sector_count} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reserved_sector_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 62 | ▶ | sub reserved_size($self) { $self->{reserved_sector_count} * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reserved_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 503 | ▶ | sub fat_count($self) { $self->{fat_count} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fat_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 590 | ▶ | sub fat_sector_count($self) { $self->{fat_sector_count} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fat_sector_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 124 | ▶ | sub fat_size($self) { $self->{fat_sector_count} * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fat_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 22592 | ▶ | sub cluster_count($self) { $self->{cluster_count} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cluster_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub min_cluster_id($self) { 2 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min_cluster_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 22112 | ▶ | sub max_cluster_id($self) { $self->cluster_count + 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_cluster_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 591 | ▶ | sub root_dirent_count($self) { $self->{root_dirent_count} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root_dirent_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 559 | ▶ | sub root_dir_sector_count($self) { ceil($self->root_dirent_count / $self->dirent_per_sector) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root_dir_sector_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 60 | ▶ | sub root_dir_size($self) { $self->root_dir_sector_count * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root_dir_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 378 | ▶ | sub root_dir_start_sector($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root_dir_start_sector: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 378 | $self->reserved_sector_count + $self->fat_count * $self->fat_sector_count | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub root_dir_offset($self) { $self->root_dir_start_sector * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
root_dir_offset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 23539 | ▶ | sub data_start_sector($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_start_sector: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 23539 | ▶ | $self->{data_start_sector} //= $self->root_dir_start_sector + $self->root_dir_sector_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"data_start_sector"} //= $self->root_dir_start_sector + $self->root_dir_sector_count
MC/DC100%1/1
$self->{"data_start_sector"} //= $self->root_dir_start_sector + $self->root_dir_sector_count
$self->{"data_start_sector"}
Truth table100%2/2
A
A= $self->{"data_start_sector"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 270 | ▶ | sub data_limit_sector($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_limit_sector: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 270 | $self->data_start_sector + $self->cluster_count * $self->sectors_per_cluster | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1370 | ▶ | sub data_start_offset($self) { $self->data_start_sector * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_start_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 270 | ▶ | sub data_limit_offset($self) { $self->data_limit_sector * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_limit_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 1369 | ▶ | sub data_start_device_offset($self) { $self->volume_offset + $self->data_start_offset } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_start_device_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 270 | ▶ | sub data_limit_device_offset($self) { $self->volume_offset + $self->data_limit_offset } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_limit_device_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub data_sector_count($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
data_sector_count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $self->total_sector_count - $self->data_start_sector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 526 | ▶ | sub total_sector_count($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
total_sector_count: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 526 | ▶ | $self->{total_sector_count} //= $self->data_start_sector | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"total_sector_count"} //= $self->data_start_sector + $self->cluster_count * $self->sectors_per_cluster
MC/DC100%1/1
$self->{"total_sector_count"} //= $self->data_start_sector + $self->cluster_count * $self->sectors_per_cluster
$self->{"total_sector_count"}
Truth table100%2/2
A
A= $self->{"total_sector_count"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | + $self->cluster_count * $self->sectors_per_cluster; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 98 | ▶ | sub total_size($self) { $self->total_sector_count * $self->bytes_per_sector } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
total_size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 21564 | ▶ | sub get_cluster_start_sector($self, $cluster_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_start_sector: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 21564 | ▶ | croak "Cluster 0 and 1 are reserved" if $cluster_id < 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 21564 | ▶ | croak "Cluster $cluster_id beyond end of volume" if $cluster_id > $self->max_cluster_id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 21564 | return $self->data_start_sector + ($cluster_id-2) * $self->sectors_per_cluster; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 21564 | ▶ | sub get_cluster_offset($self, $cluster_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 21564 | $self->get_cluster_start_sector($cluster_id) * $self->bytes_per_sector; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 21557 | ▶ | sub get_cluster_device_offset($self, $cluster_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_device_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 21557 | $self->volume_offset + $self->get_cluster_offset($cluster_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 7 | ▶ | sub get_cluster_of_sector($self, $sector_idx) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_of_sector: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 7 | ▶ | return undef if $sector_idx < $self->data_start_sector; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 7 | my $cluster= int(($sector_idx - $self->data_start_sector) / $self->sectors_per_cluster); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 7 | ▶ | return undef if $cluster >= $self->cluster_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 7 | return $cluster + 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 7 | ▶ | sub get_cluster_of_offset($self, $offset) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_of_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 7 | $self->get_cluster_of_sector(int($offset / $self->bytes_per_sector)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | sub get_cluster_of_device_offset($self, $addr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_of_device_offset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | $self->get_cluster_of_offset($addr - $self->volume_offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 7 | ▶ | sub get_cluster_extent_of_volume_extent($self, $offset, $size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_extent_of_volume_extent: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 7 | my $cl_start= $self->get_cluster_of_offset($offset); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 7 | ▶ | $cl_start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | or croak "Offset $offset falls outside of cluster data region"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 7 | ▶ | $self->get_cluster_offset($cl_start) == $offset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | or croak "FAT_offset not aligned to a cluster boundary"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 7 | my $cl_cnt= ceil($size / $self->bytes_per_cluster); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 7 | ▶ | $cl_start + $cl_cnt <= $self->max_cluster_id+1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | or croak "byte range ($offset, $size) exceeds final cluster of volume"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 7 | return ($cl_start, $cl_cnt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 7 | ▶ | sub get_cluster_extent_of_device_extent($self, $addr, $size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_extent_of_device_extent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 7 | $self->get_cluster_extent_of_volume_extent($addr - $self->volume_offset, $size); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 587 | ▶ | sub get_cluster_alignment_of_device_alignment($self, $align) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cluster_alignment_of_device_alignment: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 587 | my $cluster_size= $self->bytes_per_cluster; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | # If the cluster size is greater or equal to the requested alignment, verify that the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | # data start (plus the volume offset that was implicitly added to every volume address) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # meets that alignment. If so, every cluster is aligned and the return value is (1,0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 587 | ▶ | if ($cluster_size >= $align) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 262 | ▶ | croak "Clusters are not aligned to $align" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | if $self->data_start_device_offset & ($align-1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 262 | return (1,0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # Otherwise, make sure the data_start (plus implied volume offset) is aligned to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # cluster_size, so then some multiple of clusters will reach the requested alignment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 325 | ▶ | croak "Clusters are not aligned to $cluster_size" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | if $self->data_start_device_offset & ($cluster_size-1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # The cluster alignment will be whatever multiple of clusters equals the byte alignment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # This will be at least 2. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 325 | my $cl_align= $align / $cluster_size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # How many bytes away from alignment is the beginning of ficticious cluster 0? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 325 | my $ofs_of_cl0= ($self->data_start_device_offset - ($cluster_size*2)) & ($align-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # If not aligned, add the rest of the distance to the next alignment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 325 | ▶ | my $cl_ofs= !$ofs_of_cl0? 0 : ($align - $ofs_of_cl0) / $cluster_size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 325 | return ($cl_align, $cl_ofs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub unpack { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unpack: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $class= shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | my $buf_ref= ref $_[0] eq 'SCALAR'? $_[0] : \$_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my %attrs= ref $_[1] eq 'HASH'? %{$_[1]} : @_[1..$#_]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | length($$buf_ref) >= 512 or croak "Pass at least the entire first sector to 'unpack'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # According to the official spec, the only way to know whether you have FAT32 or FAT16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # is to calculate the count of clusters available in the data region, which this module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # implements in the constructor. However, in order to unpack all of the fields of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # sector0, you have to know whether it is FAT16 or FAT32 because FAT32 moves some of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # fields. But you need those extended fields to calculate whether it is FAT32 or not... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # It's sort of a bullshit circular dependency when clearly you could use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # BPB_RootEntCnt to know whether it was FAT32 or not, since FAT32 will *always* be 0 and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # the previous generations *can't* be 0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # Anyway, instead of uniform single-pass field unpacking, we get this: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | state %fields= qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | bytes_per_sector @11v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | sectors_per_cluster @13C | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | reserved_sector_count @14v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | fat_count @16C | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | root_dirent_count @17v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | fat_sector_count @22v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | fat_sector_count32 @36V | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | total_sector_count @19v | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | total_sector_count32 @32V | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | state @fields= keys %fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | state $packstr= join ' ', values %fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | @attrs{@fields}= unpack $packstr, $$buf_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | for (qw( fat_sector_count total_sector_count )) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | my $_32= delete $attrs{$_.'32'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | $attrs{$_} ||= $_32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$attrs{$_} ||= $_32
MC/DC0%0/2
$attrs{$_} ||= $_32
$attrs{$_}
$_32
Truth table0%0/3
A ||= B
A= $attrs{$_}B= $_32
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | return $class->new(%attrs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # Avoiding dependency on namespace::clean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 5 | delete @{Sys::Export::VFAT::Geometry::}{qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | carp confess croak ceil dualvar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | isa_hash isa_int isa_pow2 round_up_to_multiple round_up_to_pow2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | )}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||