diff options
author | Mystery Man <unknown@mandriva.org> | 2002-07-23 11:21:56 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-07-23 11:21:56 +0000 |
commit | 882ed9f801f347b87e162777b296d5be79b8b7ba (patch) | |
tree | b3ee4e9e881f5bda8d243626aac2bea772f25e68 /perl-install/resize_fat/io.pm | |
parent | 127a73d935d78af53d3dadd05d4636f6b717976d (diff) | |
download | drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar.gz drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar.bz2 drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar.xz drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_8_9mdk'.V1_1_8_9mdk
Diffstat (limited to 'perl-install/resize_fat/io.pm')
-rw-r--r-- | perl-install/resize_fat/io.pm | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/perl-install/resize_fat/io.pm b/perl-install/resize_fat/io.pm deleted file mode 100644 index 7643a0953..000000000 --- a/perl-install/resize_fat/io.pm +++ /dev/null @@ -1,71 +0,0 @@ -package resize_fat::io; # $Id$ - -use diagnostics; -use strict; - -use resize_fat::fat; -use c; - -1; - - -sub read($$$) { - my ($fs, $pos, $size) = @_; - print "reading $size bytes at $pos\n"; - my $buf = "\0" x $size; - sysseek $fs->{fd}, $pos, 0 or die "seeking to byte #$pos failed on device $fs->{fs_name}"; - sysread $fs->{fd}, $buf, $size or die "reading at byte #$pos failed on device $fs->{fs_name}"; - $buf; -} -sub write($$$$) { - my ($fs, $pos, $size, $buf) = @_; - sysseek $fs->{fd}, $pos, 0 or die "seeking to byte #$pos failed on device $fs->{fs_name}"; - syswrite $fs->{fd}, $buf or die "writing at byte #$pos failed on device $fs->{fs_name}"; -} - -sub read_cluster($$) { - my ($fs, $cluster) = @_; - my $buf; - my $pos = $fs->{cluster_offset} / 512 + $cluster * ($fs->{cluster_size} / 512); - - 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); - - 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($$) { - my ($fs, $cluster) = @_; - my $buf = ''; - - for (; !resize_fat::fat::is_eof($cluster); $cluster = resize_fat::fat::next ($fs, $cluster)) { - $cluster == 0 and die "Bad FAT: unterminated chain\n"; - $buf .= read_cluster($fs, $cluster); - } - $buf; -} - -sub check_mounted($) { - my ($f) = @_; - - local *F; - open F, "/proc/mounts" or die "error opening /proc/mounts\n"; - foreach (<F>) { - /^$f\s/ and die "device is mounted"; - } -} - -sub open($) { - my ($fs) = @_; - - check_mounted($fs->{device}); - - sysopen F, $fs->{fs_name}, 2 or sysopen F, $fs->{fs_name}, 0 or die "error opening device $fs->{fs_name} for writing\n"; - $fs->{fd} = *F; -} |