summaryrefslogtreecommitdiffstats
path: root/perl-install/swap.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-01-06 17:17:09 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-01-06 17:17:09 +0000
commit9dbafe26491c2a675728a892cf74878630175d79 (patch)
treea1c803588cf8cf48ae12707b88cc7e739a1a195d /perl-install/swap.pm
parentb46551bbf27c8a8b9189e5d803ff47ddc61e7fd3 (diff)
downloaddrakx-backup-do-not-use-9dbafe26491c2a675728a892cf74878630175d79.tar
drakx-backup-do-not-use-9dbafe26491c2a675728a892cf74878630175d79.tar.gz
drakx-backup-do-not-use-9dbafe26491c2a675728a892cf74878630175d79.tar.bz2
drakx-backup-do-not-use-9dbafe26491c2a675728a892cf74878630175d79.tar.xz
drakx-backup-do-not-use-9dbafe26491c2a675728a892cf74878630175d79.zip
replace *F with $F
Diffstat (limited to 'perl-install/swap.pm')
-rw-r--r--perl-install/swap.pm19
1 files changed, 9 insertions, 10 deletions
diff --git a/perl-install/swap.pm b/perl-install/swap.pm
index fd7d12c5b..659c9da07 100644
--- a/perl-install/swap.pm
+++ b/perl-install/swap.pm
@@ -33,16 +33,16 @@ sub kernel_greater_or_equal($$$) {
}
sub check_blocks {
- my ($fd, $version, $nbpages, $signature_page) = @_;
+ my ($F, $version, $nbpages, $signature_page) = @_;
my ($last_read_ok, $badpages) = (0, 0);
my ($buffer);
my $badpages_field_v1 = \substr($$signature_page, psizeof($signature_format_v1));
for (my $i = 0; $i < $nbpages; $i++) {
- $last_read_ok || sysseek($fd, $i * $pagesize, 0) or die "seek failed";
+ $last_read_ok || sysseek($F, $i * $pagesize, 0) or die "seek failed";
- unless ($last_read_ok = sysread($fd, $buffer, $pagesize)) {
+ unless ($last_read_ok = sysread($F, $buffer, $pagesize)) {
if ($version == 1) {
$badpages == $MAX_BADPAGES and die "too many bad pages";
vec($$badpages_field_v1, $badpages, $bitof_int) = $i;
@@ -80,8 +80,7 @@ sub make($;$) {
my $rdev = (stat $devicename)[6];
$rdev == 0x300 || $rdev == 0x340 and die "$devicename is not a good device for swap";
- local *F;
- sysopen F, $devicename, 2 or die "opening $devicename for writing failed: $!";
+ sysopen(my $F, $devicename, 2) or die "opening $devicename for writing failed: $!";
if ($version == 0) { $maxpages = $V0_MAX_PAGES }
elsif (kernel_greater_or_equal(2,2,1)) { $maxpages = $V1_MAX_PAGES }
@@ -93,7 +92,7 @@ sub make($;$) {
}
if ($checkBlocks) {
- $badpages = check_blocks(*F, $version, $nbpages, \$signature_page);
+ $badpages = check_blocks($F, $version, $nbpages, \$signature_page);
} elsif ($version == 0) {
for (my $i = 0; $i < $nbpages; $i++) { vec($signature_page, $i, 1) = 1 }
}
@@ -111,13 +110,13 @@ sub make($;$) {
MDK::Common::DataStructure::strcpy($signature_page, $version == 0 ? "SWAP-SPACE" : "SWAPSPACE2", $pagesize - 10);
my $offset = $version == 0 ? 0 : 1024;
- sysseek(F, $offset, 0) or die "unable to rewind swap-device: $!";
+ sysseek($F, $offset, 0) or die "unable to rewind swap-device: $!";
- syswrite(F, substr($signature_page, $offset)) or die "unable to write signature page: $!";
+ syswrite($F, substr($signature_page, $offset)) or die "unable to write signature page: $!";
#- A subsequent swapon() will fail if the signature is not actually on disk. (This is a kernel bug.)
- syscall_('fsync', fileno(F)) or die "fsync failed: $!";
- close F;
+ syscall_('fsync', fileno($F)) or die "fsync failed: $!";
+ close $F;
}
sub enable($;$) {