diff options
author | bde <bde@FreeBSD.org> | 2004-02-05 06:32:16 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2004-02-05 06:32:16 +0000 |
commit | 12c02b35e97ff2d4f5bf34a44e06193b4315e534 (patch) | |
tree | 9008ab2913063932f40be7efb7bb3092cae7d6a8 /sbin/fsck_msdosfs/check.c | |
parent | c03701303f41816c9200f9b8e4a89b06f6a94112 (diff) | |
download | FreeBSD-src-12c02b35e97ff2d4f5bf34a44e06193b4315e534.zip FreeBSD-src-12c02b35e97ff2d4f5bf34a44e06193b4315e534.tar.gz |
Prepare to fix checkdirty() by moving it from check.c to fat.c. It is
identical to a subset of readfat(), so it belongs near readfat() if not
in it.
Diffstat (limited to 'sbin/fsck_msdosfs/check.c')
-rw-r--r-- | sbin/fsck_msdosfs/check.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/sbin/fsck_msdosfs/check.c b/sbin/fsck_msdosfs/check.c index 16de7c7..6a40749 100644 --- a/sbin/fsck_msdosfs/check.c +++ b/sbin/fsck_msdosfs/check.c @@ -199,46 +199,3 @@ checkfilesys(const char *fname) return ret; } - -int -checkdirty(int fs, struct bootblock *boot) -{ - off_t off; - u_char *buffer; - int ret = 0; - - if (boot->ClustMask == CLUST12_MASK) - return 0; - - off = boot->ResSectors; - off *= boot->BytesPerSec; - - buffer = malloc(boot->BytesPerSec); - if (buffer == NULL) { - perror("No space for FAT"); - return 1; - } - - if (lseek(fs, off, SEEK_SET) != off) { - perror("Unable to read FAT"); - goto err; - } - - if (read(fs, buffer, boot->BytesPerSec) != boot->BytesPerSec) { - perror("Unable to read FAT"); - goto err; - } - - if (buffer[0] == boot->Media && buffer[1] == 0xff && buffer[2] == 0xff - && ((boot->ClustMask == CLUST16_MASK && buffer[3] == 0x7f) - || (boot->ClustMask == CLUST32_MASK && buffer[3] == 0x0f - && buffer[4] == 0xff && buffer[5] == 0xff - && buffer[6] == 0xff && buffer[7] == 0x07))) - ret = 0; - else - ret = 1; - -err: - free(buffer); - return ret; -} |