From 25f65beed0677fa247c513705dbf538225f979c4 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 19 Sep 1999 17:31:42 +0000 Subject: no_comment --- perl-install/resize_fat/any.pm | 4 ++-- perl-install/resize_fat/boot_sector.pm | 8 ++++---- perl-install/resize_fat/dir_entry.pm | 2 +- perl-install/resize_fat/directory.pm | 4 ++-- perl-install/resize_fat/fat.pm | 2 +- perl-install/resize_fat/io.pm | 6 +++--- perl-install/resize_fat/main.pm | 20 ++++++++++---------- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'perl-install/resize_fat') diff --git a/perl-install/resize_fat/any.pm b/perl-install/resize_fat/any.pm index 26c98f886..6acd0b52c 100644 --- a/perl-install/resize_fat/any.pm +++ b/perl-install/resize_fat/any.pm @@ -40,7 +40,7 @@ sub min_size($) { #- moment, 2 directories are there, but that way nothing wrong can happen :) my $min_cluster_count = max(2 + $count->{used} + $count->{bad} + $count->{dirs}, min_cluster_count($fs)); - $min_cluster_count * divide($fs->{cluster_size}, $SECTORSIZE) + + $min_cluster_count * divide($fs->{cluster_size}, $SECTORSIZE) + divide($fs->{cluster_offset}, $SECTORSIZE); } #- calculates the maximum size of a partition, in physical sectors @@ -53,7 +53,7 @@ sub max_size($) { divide($fs->{cluster_offset}, $SECTORSIZE); } -#- fills in $fs->{fat_flag_map}. +#- fills in $fs->{fat_flag_map}. #- Each FAT entry is flagged as either FREE, FILE or DIRECTORY. sub flag_clusters { my ($fs) = @_; diff --git a/perl-install/resize_fat/boot_sector.pm b/perl-install/resize_fat/boot_sector.pm index 6da81e420..48e2a8d4e 100644 --- a/perl-install/resize_fat/boot_sector.pm +++ b/perl-install/resize_fat/boot_sector.pm @@ -48,12 +48,12 @@ my @fields = ( #- on success, 0 on failureparameters: filesystem an empty structure to fill. sub read($) { my ($fs) = @_; - + my $boot = eval { resize_fat::io::read($fs, 0, $SECTORSIZE) }; $@ and die "reading boot sector failed on device $fs->{fs_name}"; @{$fs}{@fields} = unpack $format, $boot; $fs->{nb_sectors} = $fs->{small_nb_sectors} || $fs->{big_nb_sectors}; - $fs->{cluster_size} = $fs->{cluster_size_in_sectors} * $fs->{sector_size}; + $fs->{cluster_size} = $fs->{cluster_size_in_sectors} * $fs->{sector_size}; $fs->{boot_sign} == 0xAA55 or die "Invalid signature for a MS-based filesystem."; $fs->{nb_fats} == 2 or die "Weird number of FATs: $fs->{nb_fats}, not 2.", @@ -75,7 +75,7 @@ sub read($) { $fs->{info_offset} = $fs->{info_offset_in_sectors} * $fs->{sector_size}; $resize_fat::bad_cluster_value = 0xffffff7; } - + $fs->{fat_offset} = $fs->{nb_reserved} * $fs->{sector_size}; $fs->{fat_size} = $fs->{fat_length} * $fs->{sector_size}; $fs->{root_dir_offset} = $fs->{fat_offset} + $fs->{fat_size} * $fs->{nb_fats}; @@ -84,7 +84,7 @@ sub read($) { $fs->{nb_fat_entries} = divide($fs->{fat_size}, $fs->{fs_type_size} / 8); - #- - 2 because clusters 0 & 1 doesn't exist + #- - 2 because clusters 0 & 1 doesn't exist $fs->{nb_clusters} = divide($fs->{nb_sectors} * $fs->{sector_size} - $fs->{cluster_offset}, $fs->{cluster_size}) - 2; $fs->{dir_entries_per_cluster} = divide($fs->{cluster_size}, psizeof($format)); diff --git a/perl-install/resize_fat/dir_entry.pm b/perl-install/resize_fat/dir_entry.pm index 47f326735..cfee23dae 100644 --- a/perl-install/resize_fat/dir_entry.pm +++ b/perl-install/resize_fat/dir_entry.pm @@ -57,7 +57,7 @@ sub is_special_entry($) { #- return true if entry has been modified sub remap { my ($fat_remap, $entry) = @_; - + is_special_entry($entry) and return; my $cluster = get_cluster($entry); diff --git a/perl-install/resize_fat/directory.pm b/perl-install/resize_fat/directory.pm index 3b779e2de..46e810021 100644 --- a/perl-install/resize_fat/directory.pm +++ b/perl-install/resize_fat/directory.pm @@ -42,7 +42,7 @@ sub traverse($$$) { my $entry; @{$entry}{@fields} = unpack $format, $$raw; - &$f($entry) + &$f($entry) and $$raw = pack $format, @{$entry}{@fields}; } $directory; @@ -56,7 +56,7 @@ sub traverse_all($$) { &$f($entry); - resize_fat::dir_entry::is_directory($entry) + resize_fat::dir_entry::is_directory($entry) and traverse($fs, resize_fat::io::read_file($fs, resize_fat::dir_entry::get_cluster($entry)), $traverse_all); undef; #- no need to write back (cf traverse) diff --git a/perl-install/resize_fat/fat.pm b/perl-install/resize_fat/fat.pm index 5c0b259b4..e6039077a 100644 --- a/perl-install/resize_fat/fat.pm +++ b/perl-install/resize_fat/fat.pm @@ -124,7 +124,7 @@ sub next($$) { endianness(vec($fs->{fat}, $cluster, $fs->{fs_type_size}), $fs->{fs_type_size}); } -sub set_next($$$) { +sub set_next($$$) { my ($fs, $cluster, $new_v) = @_; $cluster > $fs->{nb_clusters} + 2 and die "fat::set_next: cluster $cluster outside filesystem"; vec($fs->{fat}, $cluster, $fs->{fs_type_size}) = endianness($new_v, $fs->{fs_type_size}); diff --git a/perl-install/resize_fat/io.pm b/perl-install/resize_fat/io.pm index 4d1a37158..48309db91 100644 --- a/perl-install/resize_fat/io.pm +++ b/perl-install/resize_fat/io.pm @@ -26,7 +26,7 @@ sub read_cluster($$) { my $buf; eval { - $buf = &read($fs, + $buf = &read($fs, $fs->{cluster_offset} + $cluster * $fs->{cluster_size}, $fs->{cluster_size}); }; @$ and die "reading cluster #$cluster failed on device $fs->{fs_name}"; @@ -36,9 +36,9 @@ sub write_cluster($$$) { my ($fs, $cluster, $buf) = @_; eval { - &write($fs, + &write($fs, $fs->{cluster_offset} + $cluster * $fs->{cluster_size}, - $fs->{cluster_size}, + $fs->{cluster_size}, $buf); }; @$ and die "writing cluster #$cluster failed on device $fs->{fs_name}"; } diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm index 692ade0cb..1e5ac62be 100644 --- a/perl-install/resize_fat/main.pm +++ b/perl-install/resize_fat/main.pm @@ -57,8 +57,8 @@ sub new($$$) { sub copy_clusters { my ($fs, $cluster) = @_; my @buffer; - my $flush = sub { - while (@buffer) { + my $flush = sub { + while (@buffer) { my $cluster = shift @buffer; resize_fat::io::write_cluster($fs, $cluster, shift @buffer); } @@ -75,7 +75,7 @@ sub copy_clusters { sub construct_dir_tree { my ($fs) = @_; - if ($resize_fat::isFAT32) { + if ($resize_fat::isFAT32) { #- fat32's root must remain in the first 64k clusters #- so don't set it as DIRECTORY, it will be specially handled $fs->{fat_flag_map}[$fs->{fat32_root_dir_cluster}] = $resize_fat::any::FREE; @@ -84,8 +84,8 @@ sub construct_dir_tree { for (my $cluster = 2; $cluster < $fs->{nb_clusters} + 2; $cluster++) { $fs->{fat_flag_map}[$cluster] == $resize_fat::any::DIRECTORY or next; - resize_fat::io::write_cluster($fs, - $fs->{fat_remap}[$cluster], + resize_fat::io::write_cluster($fs, + $fs->{fat_remap}[$cluster], resize_fat::directory::remap($fs, resize_fat::io::read_cluster($fs, $cluster))); } @@ -100,8 +100,8 @@ sub construct_dir_tree { if ($resize_fat::isFAT32) { my $cluster = $fs->{fat32_root_dir_cluster}; - resize_fat::io::write_cluster($fs, - $fs->{fat_remap}[$cluster], + resize_fat::io::write_cluster($fs, + $fs->{fat_remap}[$cluster], resize_fat::directory::remap($fs, resize_fat::io::read_cluster($fs, $cluster))); } else { resize_fat::io::write($fs, $fs->{root_dir_offset}, $fs->{root_dir_size}, @@ -114,7 +114,7 @@ sub max_size($) { &resize_fat::any::max_size } #- resize #- - size is in sectors -#- - checks boundaries before starting +#- - checks boundaries before starting #- - copies all data beyond new_cluster_count behind the frontier sub resize { my ($fs, $size) = @_; @@ -135,7 +135,7 @@ sub resize { log::l("resize_fat: Allocating new clusters"); resize_fat::fat::allocate_remap($fs, $new_nb_clusters); - log::l("resize_fat: Copying files"); + log::l("resize_fat: Copying files"); copy_clusters($fs, $new_nb_clusters); log::l("resize_fat: Copying directories"); @@ -147,7 +147,7 @@ sub resize { $fs->{nb_sectors} = $size; $fs->{nb_clusters} = $new_nb_clusters; - $fs->{clusters}{count}->{free} = + $fs->{clusters}{count}->{free} = $fs->{nb_clusters} - $fs->{clusters}{count}->{used} - $fs->{clusters}->{count}->{bad} - 2; $fs->{system_id} = 'was here!'; -- cgit v1.2.1