diff options
Diffstat (limited to 'perl-install/resize_fat/any.pm')
-rw-r--r-- | perl-install/resize_fat/any.pm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/perl-install/resize_fat/any.pm b/perl-install/resize_fat/any.pm index 6acd0b52c..7d7d006fa 100644 --- a/perl-install/resize_fat/any.pm +++ b/perl-install/resize_fat/any.pm @@ -57,7 +57,8 @@ sub max_size($) { #- Each FAT entry is flagged as either FREE, FILE or DIRECTORY. sub flag_clusters { my ($fs) = @_; - my ($cluster, $entry, $type); + my ($cluster, $entry, $type, $nb_dirs); + my $fat_flag_map = "\0" x ($fs->{nb_clusters} + 2); my $f = sub { ($entry) = @_; @@ -69,14 +70,11 @@ sub flag_clusters { $type = $DIRECTORY; } else { return } - for (; !resize_fat::fat::is_eof($cluster); $cluster = resize_fat::fat::next($fs, $cluster)) { - $cluster == 0 and die "Bad FAT: unterminated chain for $entry->{name}\n"; - $fs->{fat_flag_map}[$cluster] and die "Bad FAT: cluster $cluster is cross-linked for $entry->{name}\n"; - $fs->{fat_flag_map}[$cluster] = $type; - $fs->{clusters}{count}{dirs}++ if $type == $DIRECTORY; - } + my $nb = resize_fat::c_rewritten::checkFat($fat_flag_map, $cluster, $type, $entry->{name}); + $nb_dirs += $nb if $type == $DIRECTORY; + 0; }; - $fs->{fat_flag_map} = [ ($FREE) x ($fs->{nb_clusters} + 2) ]; - $fs->{clusters}{count}{dirs} = 0; resize_fat::directory::traverse_all($fs, $f); + $fs->{fat_flag_map} = $fat_flag_map; + $fs->{clusters}{count}{dirs} = $nb_dirs; } |