summaryrefslogtreecommitdiffstats
path: root/perl-install/resize_fat/fat.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/resize_fat/fat.pm')
-rw-r--r--perl-install/resize_fat/fat.pm25
1 files changed, 11 insertions, 14 deletions
diff --git a/perl-install/resize_fat/fat.pm b/perl-install/resize_fat/fat.pm
index fdf0c2ac8..20145982b 100644
--- a/perl-install/resize_fat/fat.pm
+++ b/perl-install/resize_fat/fat.pm
@@ -1,13 +1,11 @@
-package resize_fat::fat; # $Id$
+package resize_fat::fat;
use diagnostics;
use strict;
use resize_fat::any;
use resize_fat::io;
-use resize_fat::c_rewritten;
-
-1;
+use resize_fat::c_rewritten qw(next set_next);
sub read($) {
my ($fs) = @_;
@@ -32,7 +30,7 @@ sub write($) {
#- allocates where all the clusters will be moved to. Clusters before cut_point
#- remain in the same position, however cluster that are part of a directory are
#- moved regardless (this is a mechanism to prevent data loss) (cut_point is the
-#- first cluster that won't occur in the new fs)
+#- first cluster that will not occur in the new fs)
sub allocate_remap {
my ($fs, $cut_point) = @_;
my ($cluster, $new_cluster);
@@ -78,7 +76,7 @@ sub update {
is_eof($old_next) ?
set_eof($fs, $new) :
- set_next ($fs, $new, $new_next);
+ set_next($fs, $new, $new_next);
}
}
}
@@ -89,22 +87,19 @@ sub endianness($$) {
my ($val, $nb_bits) = @_;
my $r = 0;
for (; $nb_bits > 0; $nb_bits -= 8) {
- $r <<= 8;
+ $r = $r << 8;
$r += $val & 0xff;
- $val >>= 8;
+ $val = $val >> 8;
}
$nb_bits < 0 and die "error: endianness only handle numbers divisible by 8";
$r;
}
-*next = \&resize_fat::c_rewritten::next;
-*set_next = \&resize_fat::c_rewritten::set_next;
-
sub get_free($) {
my ($fs) = @_;
- foreach (my $i = 0; $i < $fs->{nb_clusters}; $i++) {
+ for (my $i = 0; $i < $fs->{nb_clusters}; $i++) {
my $cluster = ($i + $fs->{last_free_cluster} - 2) % $fs->{nb_clusters} + 2;
is_available(&next($fs, $cluster)) and return $fs->{last_free_cluster} = $cluster;
}
@@ -118,7 +113,7 @@ sub is_eof($) {
}
sub set_eof($$) {
my ($fs, $cluster) = @_;
- set_next ($fs, $cluster, $resize_fat::bad_cluster_value + 1);
+ set_next($fs, $cluster, $resize_fat::bad_cluster_value + 1);
}
#- returns true if <cluster> is empty. Note that this includes bad clusters.
@@ -134,5 +129,7 @@ sub is_available($) {
}
sub set_available($$) {
my ($fs, $cluster) = @_;
- set_next ($fs, $cluster, 0);
+ set_next($fs, $cluster, 0);
}
+
+1;