Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 May 2010 12:43:18 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r207568 - stable/8/sbin/fsck_msdosfs
Message-ID:  <201005031243.o43ChI1S081815@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon May  3 12:43:17 2010
New Revision: 207568
URL: http://svn.freebsd.org/changeset/base/207568

Log:
  MFC r203874:
  Rename fields to match better the msdosfs headers.

Modified:
  stable/8/sbin/fsck_msdosfs/boot.c
  stable/8/sbin/fsck_msdosfs/check.c
  stable/8/sbin/fsck_msdosfs/dir.c
  stable/8/sbin/fsck_msdosfs/dosfs.h
  stable/8/sbin/fsck_msdosfs/fat.c
Directory Properties:
  stable/8/sbin/fsck_msdosfs/   (props changed)

Modified: stable/8/sbin/fsck_msdosfs/boot.c
==============================================================================
--- stable/8/sbin/fsck_msdosfs/boot.c	Mon May  3 12:41:27 2010	(r207567)
+++ stable/8/sbin/fsck_msdosfs/boot.c	Mon May  3 12:43:17 2010	(r207568)
@@ -62,22 +62,22 @@ readboot(int dosfs, struct bootblock *bo
 	boot->ValidFat = -1;
 
 	/* decode bios parameter block */
-	boot->BytesPerSec = block[11] + (block[12] << 8);
-	boot->SecPerClust = block[13];
-	boot->ResSectors = block[14] + (block[15] << 8);
-	boot->FATs = block[16];
-	boot->RootDirEnts = block[17] + (block[18] << 8);
-	boot->Sectors = block[19] + (block[20] << 8);
-	boot->Media = block[21];
-	boot->FATsmall = block[22] + (block[23] << 8);
+	boot->bpbBytesPerSec = block[11] + (block[12] << 8);
+	boot->bpbSecPerClust = block[13];
+	boot->bpbResSectors = block[14] + (block[15] << 8);
+	boot->bpbFATs = block[16];
+	boot->bpbRootDirEnts = block[17] + (block[18] << 8);
+	boot->bpbSectors = block[19] + (block[20] << 8);
+	boot->bpbMedia = block[21];
+	boot->bpbFATsmall = block[22] + (block[23] << 8);
 	boot->SecPerTrack = block[24] + (block[25] << 8);
-	boot->Heads = block[26] + (block[27] << 8);
-	boot->HiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + (block[31] << 24);
-	boot->HugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + (block[35] << 24);
+	boot->bpbHeads = block[26] + (block[27] << 8);
+	boot->bpbHiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + (block[31] << 24);
+	boot->bpbHugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + (block[35] << 24);
 
-	boot->FATsecs = boot->FATsmall;
+	boot->FATsecs = boot->bpbFATsmall;
 
-	if (!boot->RootDirEnts)
+	if (!boot->bpbRootDirEnts)
 		boot->flags |= FAT32;
 	if (boot->flags & FAT32) {
 		boot->FATsecs = block[36] + (block[37] << 8)
@@ -92,13 +92,13 @@ readboot(int dosfs, struct bootblock *bo
 			       block[43], block[42]);
 			return FSFATAL;
 		}
-		boot->RootCl = block[44] + (block[45] << 8)
+		boot->bpbRootClust = block[44] + (block[45] << 8)
 			       + (block[46] << 16) + (block[47] << 24);
-		boot->FSInfo = block[48] + (block[49] << 8);
-		boot->Backup = block[50] + (block[51] << 8);
+		boot->bpbFSInfo = block[48] + (block[49] << 8);
+		boot->bpbBackup = block[50] + (block[51] << 8);
 
-		if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
-		    != boot->FSInfo * boot->BytesPerSec
+		if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET)
+		    != boot->bpbFSInfo * boot->bpbBytesPerSec
 		    || read(dosfs, fsinfo, sizeof fsinfo)
 		    != sizeof fsinfo) {
 			perror("could not read fsinfo block");
@@ -124,18 +124,18 @@ readboot(int dosfs, struct bootblock *bo
 				fsinfo[0x3fc] = fsinfo[0x3fd] = 0;
 				fsinfo[0x3fe] = 0x55;
 				fsinfo[0x3ff] = 0xaa;
-				if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
-				    != boot->FSInfo * boot->BytesPerSec
+				if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET)
+				    != boot->bpbFSInfo * boot->bpbBytesPerSec
 				    || write(dosfs, fsinfo, sizeof fsinfo)
 				    != sizeof fsinfo) {
-					perror("Unable to write FSInfo");
+					perror("Unable to write bpbFSInfo");
 					return FSFATAL;
 				}
 				ret = FSBOOTMOD;
 			} else
-				boot->FSInfo = 0;
+				boot->bpbFSInfo = 0;
 		}
-		if (boot->FSInfo) {
+		if (boot->bpbFSInfo) {
 			boot->FSFree = fsinfo[0x1e8] + (fsinfo[0x1e9] << 8)
 				       + (fsinfo[0x1ea] << 16)
 				       + (fsinfo[0x1eb] << 24);
@@ -144,8 +144,8 @@ readboot(int dosfs, struct bootblock *bo
 				       + (fsinfo[0x1ef] << 24);
 		}
 
-		if (lseek(dosfs, boot->Backup * boot->BytesPerSec, SEEK_SET)
-		    != boot->Backup * boot->BytesPerSec
+		if (lseek(dosfs, boot->bpbBackup * boot->bpbBytesPerSec, SEEK_SET)
+		    != boot->bpbBackup * boot->bpbBytesPerSec
 		    || read(dosfs, backup, sizeof backup) != sizeof  backup) {
 			perror("could not read backup bootblock");
 			return FSFATAL;
@@ -162,36 +162,36 @@ readboot(int dosfs, struct bootblock *bo
 			 * print out useful information and continue.
 			 */
 			pfatal("backup (block %d) mismatch with primary bootblock:\n",
-			        boot->Backup);
+			        boot->bpbBackup);
 			for (i = 11; i < 11 + 90; i++) {
 				if (block[i] != backup[i])
 					pfatal("\ti=%d\tprimary 0x%02x\tbackup 0x%02x\n",
 					       i, block[i], backup[i]);
 			}
 		}
-		/* Check backup FSInfo?					XXX */
+		/* Check backup bpbFSInfo?					XXX */
 	}
 
-	boot->ClusterOffset = (boot->RootDirEnts * 32 + boot->BytesPerSec - 1)
-	    / boot->BytesPerSec
-	    + boot->ResSectors
-	    + boot->FATs * boot->FATsecs
-	    - CLUST_FIRST * boot->SecPerClust;
+	boot->ClusterOffset = (boot->bpbRootDirEnts * 32 + boot->bpbBytesPerSec - 1)
+	    / boot->bpbBytesPerSec
+	    + boot->bpbResSectors
+	    + boot->bpbFATs * boot->FATsecs
+	    - CLUST_FIRST * boot->bpbSecPerClust;
 
-	if (boot->BytesPerSec % DOSBOOTBLOCKSIZE != 0) {
-		pfatal("Invalid sector size: %u", boot->BytesPerSec);
+	if (boot->bpbBytesPerSec % DOSBOOTBLOCKSIZE != 0) {
+		pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
 		return FSFATAL;
 	}
-	if (boot->SecPerClust == 0) {
-		pfatal("Invalid cluster size: %u", boot->SecPerClust);
+	if (boot->bpbSecPerClust == 0) {
+		pfatal("Invalid cluster size: %u", boot->bpbSecPerClust);
 		return FSFATAL;
 	}
-	if (boot->Sectors) {
-		boot->HugeSectors = 0;
-		boot->NumSectors = boot->Sectors;
+	if (boot->bpbSectors) {
+		boot->bpbHugeSectors = 0;
+		boot->NumSectors = boot->bpbSectors;
 	} else
-		boot->NumSectors = boot->HugeSectors;
-	boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / boot->SecPerClust;
+		boot->NumSectors = boot->bpbHugeSectors;
+	boot->NumClusters = (boot->NumSectors - boot->ClusterOffset) / boot->bpbSecPerClust;
 
 	if (boot->flags&FAT32)
 		boot->ClustMask = CLUST32_MASK;
@@ -207,13 +207,13 @@ readboot(int dosfs, struct bootblock *bo
 
 	switch (boot->ClustMask) {
 	case CLUST32_MASK:
-		boot->NumFatEntries = (boot->FATsecs * boot->BytesPerSec) / 4;
+		boot->NumFatEntries = (boot->FATsecs * boot->bpbBytesPerSec) / 4;
 		break;
 	case CLUST16_MASK:
-		boot->NumFatEntries = (boot->FATsecs * boot->BytesPerSec) / 2;
+		boot->NumFatEntries = (boot->FATsecs * boot->bpbBytesPerSec) / 2;
 		break;
 	default:
-		boot->NumFatEntries = (boot->FATsecs * boot->BytesPerSec * 2) / 3;
+		boot->NumFatEntries = (boot->FATsecs * boot->bpbBytesPerSec * 2) / 3;
 		break;
 	}
 
@@ -222,7 +222,7 @@ readboot(int dosfs, struct bootblock *bo
 		       boot->NumClusters, boot->FATsecs);
 		return FSFATAL;
 	}
-	boot->ClusterSize = boot->BytesPerSec * boot->SecPerClust;
+	boot->ClusterSize = boot->bpbBytesPerSec * boot->bpbSecPerClust;
 
 	boot->NumFiles = 1;
 	boot->NumFree = 0;
@@ -235,8 +235,8 @@ writefsinfo(int dosfs, struct bootblock 
 {
 	u_char fsinfo[2 * DOSBOOTBLOCKSIZE];
 
-	if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
-	    != boot->FSInfo * boot->BytesPerSec
+	if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET)
+	    != boot->bpbFSInfo * boot->bpbBytesPerSec
 	    || read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) {
 		perror("could not read fsinfo block");
 		return FSFATAL;
@@ -249,11 +249,11 @@ writefsinfo(int dosfs, struct bootblock 
 	fsinfo[0x1ed] = (u_char)(boot->FSNext >> 8);
 	fsinfo[0x1ee] = (u_char)(boot->FSNext >> 16);
 	fsinfo[0x1ef] = (u_char)(boot->FSNext >> 24);
-	if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
-	    != boot->FSInfo * boot->BytesPerSec
+	if (lseek(dosfs, boot->bpbFSInfo * boot->bpbBytesPerSec, SEEK_SET)
+	    != boot->bpbFSInfo * boot->bpbBytesPerSec
 	    || write(dosfs, fsinfo, sizeof fsinfo)
 	    != sizeof fsinfo) {
-		perror("Unable to write FSInfo");
+		perror("Unable to write bpbFSInfo");
 		return FSFATAL;
 	}
 	/*

Modified: stable/8/sbin/fsck_msdosfs/check.c
==============================================================================
--- stable/8/sbin/fsck_msdosfs/check.c	Mon May  3 12:41:27 2010	(r207567)
+++ stable/8/sbin/fsck_msdosfs/check.c	Mon May  3 12:43:17 2010	(r207568)
@@ -98,7 +98,7 @@ checkfilesys(const char *fname)
 	}
 
 	if (boot.ValidFat < 0)
-		for (i = 1; i < (int)boot.FATs; i++) {
+		for (i = 1; i < (int)boot.bpbFATs; i++) {
 			struct fatEntry *currentFat;
 
 			mod |= readfat(dosfs, &boot, i, &currentFat);

Modified: stable/8/sbin/fsck_msdosfs/dir.c
==============================================================================
--- stable/8/sbin/fsck_msdosfs/dir.c	Mon May  3 12:41:27 2010	(r207567)
+++ stable/8/sbin/fsck_msdosfs/dir.c	Mon May  3 12:43:17 2010	(r207568)
@@ -219,8 +219,8 @@ resetDosDirSection(struct bootblock *boo
 	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 *boo
 
 	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 *boo
 				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, st
 {
 	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, st
 				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 bootbloc
 	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 *b
 			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");

Modified: stable/8/sbin/fsck_msdosfs/dosfs.h
==============================================================================
--- stable/8/sbin/fsck_msdosfs/dosfs.h	Mon May  3 12:41:27 2010	(r207567)
+++ stable/8/sbin/fsck_msdosfs/dosfs.h	Mon May  3 12:43:17 2010	(r207568)
@@ -39,31 +39,31 @@ typedef	u_int32_t	cl_t;	/* type holding 
  * FAT boot block.
  */
 struct bootblock {
-	u_int	BytesPerSec;		/* bytes per sector */
-	u_int	SecPerClust;		/* sectors per cluster */
-	u_int	ResSectors;		/* number of reserved sectors */
-	u_int	FATs;			/* number of FATs */
-	u_int	RootDirEnts;		/* number of root directory entries */
-	u_int	Media;			/* media descriptor */
-	u_int	FATsmall;		/* number of sectors per FAT */
+	u_int	bpbBytesPerSec;		/* bytes per sector */
+	u_int	bpbSecPerClust;		/* sectors per cluster */
+	u_int	bpbResSectors;		/* number of reserved sectors */
+	u_int	bpbFATs;		/* number of bpbFATs */
+	u_int	bpbRootDirEnts;		/* number of root directory entries */
+	u_int32_t bpbSectors;		/* total number of sectors */
+	u_int	bpbMedia;		/* media descriptor */
+	u_int	bpbFATsmall;		/* number of sectors per FAT */
 	u_int	SecPerTrack;		/* sectors per track */
-	u_int	Heads;			/* number of heads */
-	u_int32_t HiddenSecs;		/* # of hidden sectors */
-	u_int32_t Sectors;		/* total number of sectors */
-#define	FAT32		1		/* this is a FAT32 file system */
-					/*
-					 * Maybe, we should separate out
-					 * various parts of FAT32?	XXX
-					 */
-	u_int32_t HugeSectors;		/* # of sectors if bpbSectors == 0 */
-	u_int	FSInfo;			/* FSInfo sector */
-	u_int	Backup;			/* Backup of Bootblocks */
-	cl_t	RootCl;			/* Start of Root Directory */
+	u_int	bpbHeads;		/* number of heads */
+	u_int32_t bpbHiddenSecs;	/* # of hidden sectors */
+	u_int32_t bpbHugeSectors;	/* # of sectors if bpbbpbSectors == 0 */
+	cl_t	bpbRootClust;		/* Start of Root Directory */
+	u_int	bpbFSInfo;		/* FSInfo sector */
+	u_int	bpbBackup;		/* Backup of Bootblocks */
 	cl_t	FSFree;			/* Number of free clusters acc. FSInfo */
 	cl_t	FSNext;			/* Next free cluster acc. FSInfo */
 
 	/* and some more calculated values */
 	u_int	flags;			/* some flags: */
+#define	FAT32		1		/* this is a FAT32 file system */
+					/*
+					 * Maybe, we should separate out
+					 * various parts of FAT32?	XXX
+					 */
 	int	ValidFat;		/* valid fat if FAT32 non-mirrored */
 	cl_t	ClustMask;		/* mask for entries in FAT */
 	cl_t	NumClusters;		/* # of entries in a FAT */

Modified: stable/8/sbin/fsck_msdosfs/fat.c
==============================================================================
--- stable/8/sbin/fsck_msdosfs/fat.c	Mon May  3 12:41:27 2010	(r207567)
+++ stable/8/sbin/fsck_msdosfs/fat.c	Mon May  3 12:43:17 2010	(r207568)
@@ -73,10 +73,10 @@ checkdirty(int fs, struct bootblock *boo
 	if (boot->ClustMask != CLUST16_MASK && boot->ClustMask != CLUST32_MASK)
 		return 0;
 
-	off = boot->ResSectors;
-	off *= boot->BytesPerSec;
+	off = boot->bpbResSectors;
+	off *= boot->bpbBytesPerSec;
 
-	buffer = malloc(boot->BytesPerSec);
+	buffer = malloc(boot->bpbBytesPerSec);
 	if (buffer == NULL) {
 		perror("No space for FAT");
 		return 1;
@@ -87,7 +87,7 @@ checkdirty(int fs, struct bootblock *boo
 		goto err;
 	}
 
-	if (read(fs, buffer, boot->BytesPerSec) != boot->BytesPerSec) {
+	if (read(fs, buffer, boot->bpbBytesPerSec) != boot->bpbBytesPerSec) {
 		perror("Unable to read FAT");
 		goto err;
 	}
@@ -96,7 +96,7 @@ checkdirty(int fs, struct bootblock *boo
 	 * If we don't understand the FAT, then the file system must be
 	 * assumed to be unclean.
 	 */
-	if (buffer[0] != boot->Media || buffer[1] != 0xff)
+	if (buffer[0] != boot->bpbMedia || buffer[1] != 0xff)
 		goto err;
 	if (boot->ClustMask == CLUST16_MASK) {
 		if ((buffer[2] & 0xf8) != 0xf8 || (buffer[3] & 0x3f) != 0x3f)
@@ -163,22 +163,22 @@ _readfat(int fs, struct bootblock *boot,
 {
 	off_t off;
 
-	*buffer = malloc(boot->FATsecs * boot->BytesPerSec);
+	*buffer = malloc(boot->FATsecs * boot->bpbBytesPerSec);
 	if (*buffer == NULL) {
 		perror("No space for FAT");
 		return 0;
 	}
 
-	off = boot->ResSectors + no * boot->FATsecs;
-	off *= boot->BytesPerSec;
+	off = boot->bpbResSectors + no * boot->FATsecs;
+	off *= boot->bpbBytesPerSec;
 
 	if (lseek(fs, off, SEEK_SET) != off) {
 		perror("Unable to read FAT");
 		goto err;
 	}
 
-	if ((size_t)read(fs, *buffer, boot->FATsecs * boot->BytesPerSec)
-	    != boot->FATsecs * boot->BytesPerSec) {
+	if ((size_t)read(fs, *buffer, boot->FATsecs * boot->bpbBytesPerSec)
+	    != boot->FATsecs * boot->bpbBytesPerSec) {
 		perror("Unable to read FAT");
 		goto err;
 	}
@@ -215,7 +215,7 @@ readfat(int fs, struct bootblock *boot, 
 	}
 	(void)memset(fat, 0, len);
 
-	if (buffer[0] != boot->Media
+	if (buffer[0] != boot->bpbMedia
 	    || buffer[1] != 0xff || buffer[2] != 0xff
 	    || (boot->ClustMask == CLUST16_MASK && buffer[3] != 0xff)
 	    || (boot->ClustMask == CLUST32_MASK
@@ -229,7 +229,7 @@ readfat(int fs, struct bootblock *boot, 
 		 * file system is dirty if it doesn't reboot cleanly.
 		 * Check this special condition before errorring out.
 		 */
-		if (buffer[0] == boot->Media && buffer[1] == 0xff
+		if (buffer[0] == boot->bpbMedia && buffer[1] == 0xff
 		    && buffer[2] == 0xff
 		    && ((boot->ClustMask == CLUST16_MASK && buffer[3] == 0x7f)
 			|| (boot->ClustMask == CLUST32_MASK
@@ -546,7 +546,7 @@ writefat(int fs, struct bootblock *boot,
 	off_t off;
 	int ret = FSOK;
 
-	buffer = malloc(fatsz = boot->FATsecs * boot->BytesPerSec);
+	buffer = malloc(fatsz = boot->FATsecs * boot->bpbBytesPerSec);
 	if (buffer == NULL) {
 		perror("No space for FAT");
 		return FSFATAL;
@@ -555,7 +555,7 @@ writefat(int fs, struct bootblock *boot,
 	boot->NumFree = 0;
 	p = buffer;
 	if (correct_fat) {
-		*p++ = (u_char)boot->Media;
+		*p++ = (u_char)boot->bpbMedia;
 		*p++ = 0xff;
 		*p++ = 0xff;
 		switch (boot->ClustMask) {
@@ -628,9 +628,9 @@ writefat(int fs, struct bootblock *boot,
 			break;
 		}
 	}
-	for (i = 0; i < boot->FATs; i++) {
-		off = boot->ResSectors + i * boot->FATsecs;
-		off *= boot->BytesPerSec;
+	for (i = 0; i < boot->bpbFATs; i++) {
+		off = boot->bpbResSectors + i * boot->FATsecs;
+		off *= boot->bpbBytesPerSec;
 		if (lseek(fs, off, SEEK_SET) != off
 		    || (size_t)write(fs, buffer, fatsz) != fatsz) {
 			perror("Unable to write FAT");
@@ -672,7 +672,7 @@ checklost(int dosfs, struct bootblock *b
 	}
 	finishlf();
 
-	if (boot->FSInfo) {
+	if (boot->bpbFSInfo) {
 		ret = 0;
 		if (boot->FSFree != boot->NumFree) {
 			pwarn("Free space in FSInfo block (%d) not correct (%d)\n",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005031243.o43ChI1S081815>