summaryrefslogtreecommitdiffstats
path: root/perl-install/resize_fat
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-02-09 11:38:02 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-02-09 11:38:02 +0000
commit4ce69234e573c58002f3d1a9f361489410e883b2 (patch)
treee9f590e2fd57d708f76c3249a442864a2b50a365 /perl-install/resize_fat
parent06f02f9536b2a9fb1283dd33c441b5e66da23551 (diff)
downloaddrakx-backup-do-not-use-4ce69234e573c58002f3d1a9f361489410e883b2.tar
drakx-backup-do-not-use-4ce69234e573c58002f3d1a9f361489410e883b2.tar.gz
drakx-backup-do-not-use-4ce69234e573c58002f3d1a9f361489410e883b2.tar.bz2
drakx-backup-do-not-use-4ce69234e573c58002f3d1a9f361489410e883b2.tar.xz
drakx-backup-do-not-use-4ce69234e573c58002f3d1a9f361489410e883b2.zip
no_comment
Diffstat (limited to 'perl-install/resize_fat')
-rw-r--r--perl-install/resize_fat/io.pm18
1 files changed, 7 insertions, 11 deletions
diff --git a/perl-install/resize_fat/io.pm b/perl-install/resize_fat/io.pm
index cbe0033ca..2c106b87c 100644
--- a/perl-install/resize_fat/io.pm
+++ b/perl-install/resize_fat/io.pm
@@ -4,6 +4,7 @@ use diagnostics;
use strict;
use resize_fat::fat;
+use c;
1;
@@ -24,23 +25,18 @@ sub write($$$$) {
sub read_cluster($$) {
my ($fs, $cluster) = @_;
my $buf;
+ my $pos = $fs->{cluster_offset} / 512 + $cluster * ($fs->{cluster_size} / 512);
- eval {
- $buf = &read($fs,
- $fs->{cluster_offset} + $cluster * $fs->{cluster_size},
- $fs->{cluster_size});
- }; @$ and die "reading cluster #$cluster failed on device $fs->{fs_name}";
+ c::lseek_sector(fileno $fs->{fd}, $pos, 0) or die "seeking to sector #$pos failed on device $fs->{fs_name}";
+ sysread $fs->{fd}, $buf, $fs->{cluster_size} or die "reading at sector #$pos failed on device $fs->{fs_name}";
$buf;
}
sub write_cluster($$$) {
my ($fs, $cluster, $buf) = @_;
+ my $pos = $fs->{cluster_offset} / 512 + $cluster * ($fs->{cluster_size} / 512);
- eval {
- &write($fs,
- $fs->{cluster_offset} + $cluster * $fs->{cluster_size},
- $fs->{cluster_size},
- $buf);
- }; @$ and die "writing cluster #$cluster failed on device $fs->{fs_name}";
+ c::lseek_sector(fileno $fs->{fd}, $pos, 0) or die "seeking to sector #$pos failed on device $fs->{fs_name}";
+ syswrite $fs->{fd}, $buf or die "writing at sector #$pos failed on device $fs->{fs_name}";
}
sub read_file($$) {