aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_msdosfs/dir.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2010-02-14 12:31:28 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2010-02-14 12:31:28 +0000
commit75fb535394c804bc6b115496754b0c87787223f9 (patch)
tree8470fd3f1b1383228bbcfc64389e211a5908fc14 /sbin/fsck_msdosfs/dir.c
parentb41cd53957bc0e3061a26b32f109805a0e7edff2 (diff)
Rename fields to match better the msdosfs headers. This work is still
incomplete as some info doesn't really belong to the structs where it is defined. Submitted by: Pedro F. Giffuni <giffunip tutopia com> Reviewed by: bde MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=203874
Diffstat (limited to 'sbin/fsck_msdosfs/dir.c')
-rw-r--r--sbin/fsck_msdosfs/dir.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c
index 515929c1e4b8..181fa37be594 100644
--- a/sbin/fsck_msdosfs/dir.c
+++ b/sbin/fsck_msdosfs/dir.c
@@ -219,8 +219,8 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
cl_t cl;
int ret = FSOK;
- b1 = boot->RootDirEnts * 32;
- b2 = boot->SecPerClust * boot->BytesPerSec;
+ b1 = boot->bpbRootDirEnts * 32;
+ b2 = boot->bpbSecPerClust * boot->bpbBytesPerSec;
if ((buffer = malloc( b1 > b2 ? b1 : b2)) == NULL) {
perror("No space for directory buffer");
@@ -242,15 +242,15 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
memset(rootDir, 0, sizeof *rootDir);
if (boot->flags & FAT32) {
- if (boot->RootCl < CLUST_FIRST || boot->RootCl >= boot->NumClusters) {
+ if (boot->bpbRootClust < CLUST_FIRST || boot->bpbRootClust >= boot->NumClusters) {
pfatal("Root directory starts with cluster out of range(%u)",
- boot->RootCl);
+ boot->bpbRootClust);
return FSFATAL;
}
- cl = fat[boot->RootCl].next;
+ cl = fat[boot->bpbRootClust].next;
if (cl < CLUST_FIRST
|| (cl >= CLUST_RSRVD && cl< CLUST_EOFS)
- || fat[boot->RootCl].head != boot->RootCl) {
+ || fat[boot->bpbRootClust].head != boot->bpbRootClust) {
if (cl == CLUST_FREE)
pwarn("Root directory starts with free cluster\n");
else if (cl >= CLUST_RSRVD)
@@ -261,14 +261,14 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
return FSFATAL;
}
if (ask(1, "Fix")) {
- fat[boot->RootCl].next = CLUST_FREE;
+ fat[boot->bpbRootClust].next = CLUST_FREE;
ret = FSFATMOD;
} else
ret = FSFATAL;
}
- fat[boot->RootCl].flags |= FAT_USED;
- rootDir->head = boot->RootCl;
+ fat[boot->bpbRootClust].flags |= FAT_USED;
+ rootDir->head = boot->bpbRootClust;
}
return ret;
@@ -313,7 +313,7 @@ delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
{
u_char *s, *e;
off_t off;
- int clsz = boot->SecPerClust * boot->BytesPerSec;
+ int clsz = boot->bpbSecPerClust * boot->bpbBytesPerSec;
s = delbuf + startoff;
e = delbuf + clsz;
@@ -323,8 +323,8 @@ delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
break;
e = delbuf + endoff;
}
- off = startcl * boot->SecPerClust + boot->ClusterOffset;
- off *= boot->BytesPerSec;
+ off = startcl * boot->bpbSecPerClust + boot->ClusterOffset;
+ off *= boot->bpbBytesPerSec;
if (lseek(f, off, SEEK_SET) != off
|| read(f, delbuf, clsz) != clsz) {
perror("Unable to read directory");
@@ -461,14 +461,14 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
vallfn = invlfn = empty = NULL;
do {
if (!(boot->flags & FAT32) && !dir->parent) {
- last = boot->RootDirEnts * 32;
- off = boot->ResSectors + boot->FATs * boot->FATsecs;
+ last = boot->bpbRootDirEnts * 32;
+ off = boot->bpbResSectors + boot->bpbFATs * boot->FATsecs;
} else {
- last = boot->SecPerClust * boot->BytesPerSec;
- off = cl * boot->SecPerClust + boot->ClusterOffset;
+ last = boot->bpbSecPerClust * boot->bpbBytesPerSec;
+ off = cl * boot->bpbSecPerClust + boot->ClusterOffset;
}
- off *= boot->BytesPerSec;
+ off *= boot->bpbBytesPerSec;
if (lseek(f, off, SEEK_SET) != off
|| read(f, buffer, last) != last) {
perror("Unable to read directory");
@@ -957,7 +957,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
return FSERROR;
}
lfoff = lfcl * boot->ClusterSize
- + boot->ClusterOffset * boot->BytesPerSec;
+ + boot->ClusterOffset * boot->bpbBytesPerSec;
if (lseek(dosfs, lfoff, SEEK_SET) != lfoff
|| (size_t)read(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) {
perror("could not read LOST.DIR");