Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 May 2017 19:29:28 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318595 - head/sys/fs/msdosfs
Message-ID:  <201705211929.v4LJTSP0073067@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Sun May 21 19:29:28 2017
New Revision: 318595
URL: https://svnweb.freebsd.org/changeset/base/318595

Log:
  msdosfs: capitalize FAT appropriately
  
  Diff reduction with NetBSD, including some nearby minor whitespace or
  style fixes.
  
  Obtained from:	NetBSD
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/fs/msdosfs/denode.h
  head/sys/fs/msdosfs/fat.h
  head/sys/fs/msdosfs/msdosfs_denode.c
  head/sys/fs/msdosfs/msdosfs_fat.c
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/fs/msdosfs/msdosfs_vnops.c
  head/sys/fs/msdosfs/msdosfsmount.h

Modified: head/sys/fs/msdosfs/denode.h
==============================================================================
--- head/sys/fs/msdosfs/denode.h	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/denode.h	Sun May 21 19:29:28 2017	(r318595)
@@ -98,7 +98,7 @@
 #define	MSDOSFSROOT_OFS	0x1fffffff
 
 /*
- * The fat cache structure. fc_fsrcn is the filesystem relative cluster
+ * The FAT cache structure. fc_fsrcn is the filesystem relative cluster
  * number that corresponds to the file relative cluster number in this
  * structure (fc_frcn).
  */
@@ -108,11 +108,11 @@ struct fatcache {
 };
 
 /*
- * The fat entry cache as it stands helps make extending files a "quick"
- * operation by avoiding having to scan the fat to discover the last
+ * The FAT entry cache as it stands helps make extending files a "quick"
+ * operation by avoiding having to scan the FAT to discover the last
  * cluster of the file. The cache also helps sequential reads by
  * remembering the last cluster read from the file.  This also prevents us
- * from having to rescan the fat to find the next cluster to read.  This
+ * from having to rescan the FAT to find the next cluster to read.  This
  * cache is probably pretty worthless if a file is opened by multiple
  * processes.
  */
@@ -126,7 +126,7 @@ struct fatcache {
 #define	FCE_EMPTY	0xffffffff	/* doesn't represent an actual cluster # */
 
 /*
- * Set a slot in the fat cache.
+ * Set a slot in the FAT cache.
  */
 #define	fc_setcache(dep, slot, frcn, fsrcn) \
 	(dep)->de_fc[(slot)].fc_frcn = (frcn); \
@@ -156,7 +156,7 @@ struct denode {
 	u_short de_MDate;	/* modification date */
 	u_long de_StartCluster; /* starting cluster of file */
 	u_long de_FileSize;	/* size of file in bytes */
-	struct fatcache de_fc[FC_SIZE];	/* fat cache */
+	struct fatcache de_fc[FC_SIZE];	/* FAT cache */
 	u_quad_t de_modrev;	/* Revision level for lease. */
 	uint64_t de_inode;	/* Inode number (really byte offset of direntry) */
 };

Modified: head/sys/fs/msdosfs/fat.h
==============================================================================
--- head/sys/fs/msdosfs/fat.h	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/fat.h	Sun May 21 19:29:28 2017	(r318595)
@@ -66,10 +66,10 @@
 
 /*
  * MSDOSFS:
- * Return true if filesystem uses 12 bit fats. Microsoft Programmer's
+ * Return true if filesystem uses 12 bit FATs. Microsoft Programmer's
  * Reference says if the maximum cluster number in a filesystem is greater
  * than 4078 ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK) then we've got a
- * 16 bit fat filesystem. While mounting, the result of this test is stored
+ * 16 bit FAT filesystem. While mounting, the result of this test is stored
  * in pm_fatentrysize.
  */
 #define	FAT12(pmp)	(pmp->pm_fatmask == FAT12_MASK)
@@ -83,8 +83,8 @@
  * These are the values for the function argument to the function
  * fatentry().
  */
-#define	FAT_GET		0x0001	/* get a fat entry */
-#define	FAT_SET		0x0002	/* set a fat entry */
+#define	FAT_GET		0x0001	/* get a FAT entry */
+#define	FAT_SET		0x0002	/* set a FAT entry */
 #define	FAT_GET_AND_SET	(FAT_GET | FAT_SET)
 
 /*

Modified: head/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_denode.c	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/msdosfs_denode.c	Sun May 21 19:29:28 2017	(r318595)
@@ -160,7 +160,7 @@ deget(struct msdosfsmount *pmp, u_long d
 	ldep->de_diroffset = diroffset;
 	ldep->de_inode = inode;
 	lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL);
-	fc_purge(ldep, 0);	/* init the fat cache for this denode */
+	fc_purge(ldep, 0);	/* init the FAT cache for this denode */
 	error = insmntque(nvp, mntp);
 	if (error != 0) {
 		free(ldep, M_MSDOSFSNODE);

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_fat.c	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/msdosfs_fat.c	Sun May 21 19:29:28 2017	(r318595)
@@ -176,8 +176,8 @@ pcbmap(struct denode *dep, u_long findcn
 		*sp = pmp->pm_bpcluster;
 
 	/*
-	 * Rummage around in the fat cache, maybe we can avoid tromping
-	 * through every fat entry for the file. And, keep track of how far
+	 * Rummage around in the FAT cache, maybe we can avoid tromping
+	 * through every FAT entry for the file. And, keep track of how far
 	 * off the cache was from where we wanted to be.
 	 */
 	i = 0;
@@ -244,13 +244,13 @@ hiteof:;
 		*cnp = i;
 	if (bp)
 		brelse(bp);
-	/* update last file cluster entry in the fat cache */
+	/* update last file cluster entry in the FAT cache */
 	fc_setcache(dep, FC_LASTFC, i - 1, prevcn);
 	return (E2BIG);
 }
 
 /*
- * Find the closest entry in the fat cache to the cluster we are looking
+ * Find the closest entry in the FAT cache to the cluster we are looking
  * for.
  */
 static void
@@ -276,7 +276,7 @@ fc_lookup(struct denode *dep, u_long fin
 }
 
 /*
- * Purge the fat cache in denode dep of all entries relating to file
+ * Purge the FAT cache in denode dep of all entries relating to file
  * relative cluster frcn and beyond.
  */
 void
@@ -295,13 +295,13 @@ fc_purge(struct denode *dep, u_int frcn)
 }
 
 /*
- * Update the fat.
- * If mirroring the fat, update all copies, with the first copy as last.
- * Else update only the current fat (ignoring the others).
+ * Update the FAT.
+ * If mirroring the FAT, update all copies, with the first copy as last.
+ * Else update only the current FAT (ignoring the others).
  *
  * pmp	 - msdosfsmount structure for filesystem to update
- * bp	 - addr of modified fat block
- * fatbn - block number relative to begin of filesystem of the modified fat block.
+ * bp	 - addr of modified FAT block
+ * fatbn - block number relative to begin of filesystem of the modified FAT block.
  */
 static void
 updatefats(struct msdosfsmount *pmp, struct buf *bp, u_long fatbn)
@@ -315,12 +315,12 @@ updatefats(struct msdosfsmount *pmp, str
 
 	if (pmp->pm_flags & MSDOSFS_FATMIRROR) {
 		/*
-		 * Now copy the block(s) of the modified fat to the other copies of
-		 * the fat and write them out.  This is faster than reading in the
-		 * other fats and then writing them back out.  This could tie up
-		 * the fat for quite a while. Preventing others from accessing it.
-		 * To prevent us from going after the fat quite so much we use
-		 * delayed writes, unless they specfied "synchronous" when the
+		 * Now copy the block(s) of the modified FAT to the other copies of
+		 * the FAT and write them out.  This is faster than reading in the
+		 * other FATs and then writing them back out.  This could tie up
+		 * the FAT for quite a while. Preventing others from accessing it.
+		 * To prevent us from going after the FAT quite so much we use
+		 * delayed writes, unless they specified "synchronous" when the
 		 * filesystem was mounted.  If synch is asked for then use
 		 * bwrite()'s and really slow things down.
 		 */
@@ -349,7 +349,7 @@ updatefats(struct msdosfsmount *pmp, str
 	}
 
 	/*
-	 * Write out the first (or current) fat last.
+	 * Write out the first (or current) FAT last.
 	 */
 	if (pmp->pm_mountp->mnt_flag & MNT_SYNCHRONOUS)
 		bwrite(bp);
@@ -358,7 +358,7 @@ updatefats(struct msdosfsmount *pmp, str
 }
 
 /*
- * Updating entries in 12 bit fats is a pain in the butt.
+ * Updating entries in 12 bit FATs is a pain in the butt.
  *
  * The following picture shows where nibbles go when moving from a 12 bit
  * cluster number into the appropriate bytes in the FAT.
@@ -436,21 +436,21 @@ clusterfree(struct msdosfsmount *pmp, u_
 }
 
 /*
- * Get or Set or 'Get and Set' the cluster'th entry in the fat.
+ * Get or Set or 'Get and Set' the cluster'th entry in the FAT.
  *
- * function	- whether to get or set a fat entry
+ * function	- whether to get or set a FAT entry
  * pmp		- address of the msdosfsmount structure for the filesystem
- *		  whose fat is to be manipulated.
+ *		  whose FAT is to be manipulated.
  * cn		- which cluster is of interest
  * oldcontents	- address of a word that is to receive the contents of the
  *		  cluster'th entry if this is a get function
  * newcontents	- the new value to be written into the cluster'th element of
- *		  the fat if this is a set function.
+ *		  the FAT if this is a set function.
  *
- * This function can also be used to free a cluster by setting the fat entry
+ * This function can also be used to free a cluster by setting the FAT entry
  * for a cluster to 0.
  *
- * All copies of the fat are updated if this is a set function. NOTE: If
+ * All copies of the FAT are updated if this is a set function. NOTE: If
  * fatentry() marks a cluster as free it does not update the inusemap in
  * the msdosfsmount structure. This is left to the caller.
  */
@@ -513,7 +513,7 @@ fatentry(int function, struct msdosfsmou
 		if (FAT12(pmp) & (cn & 1))
 			readcn >>= 4;
 		readcn &= pmp->pm_fatmask;
-		/* map reserved fat entries to same values for all fats */
+		/* map reserved FAT entries to same values for all FATs */
 		if ((readcn | ~pmp->pm_fatmask) >= CLUST_RSRVD)
 			readcn |= ~pmp->pm_fatmask;
 		*oldcontents = readcn;
@@ -537,7 +537,7 @@ fatentry(int function, struct msdosfsmou
 		case FAT32_MASK:
 			/*
 			 * According to spec we have to retain the
-			 * high order bits of the fat entry.
+			 * high order bits of the FAT entry.
 			 */
 			readcn = getulong(&bp->b_data[bo]);
 			readcn &= ~FAT32_MASK;
@@ -560,7 +560,7 @@ fatentry(int function, struct msdosfsmou
  * pmp	    - mount point
  * start    - first cluster of chain
  * count    - number of clusters in chain
- * fillwith - what to write into fat entry of last cluster
+ * fillwith - what to write into FAT entry of last cluster
  */
 static int
 fatchain(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith)
@@ -685,7 +685,7 @@ chainlength(struct msdosfsmount *pmp, u_
  * pmp	      - mount point.
  * start      - start of cluster chain.
  * count      - number of clusters to allocate.
- * fillwith   - put this value into the fat entry for the
+ * fillwith   - put this value into the FAT entry for the
  *		last allocated cluster.
  * retcluster - put the first allocated cluster's number here.
  * got	      - how many clusters were actually allocated.
@@ -730,7 +730,7 @@ chainalloc(struct msdosfsmount *pmp, u_l
  * pmp	      - mount point.
  * start      - preferred start of cluster chain.
  * count      - number of clusters requested.
- * fillwith   - put this value into the fat entry for the
+ * fillwith   - put this value into the FAT entry for the
  *		last allocated cluster.
  * retcluster - put the first allocated cluster's number here.
  * got	      - how many clusters were actually allocated.
@@ -882,7 +882,7 @@ freeclusterchain(struct msdosfsmount *pm
 }
 
 /*
- * Read in fat blocks looking for free clusters. For every free cluster
+ * Read in FAT blocks looking for free clusters. For every free cluster
  * found turn off its corresponding bit in the pm_inusemap.
  */
 int
@@ -896,7 +896,7 @@ fillinusemap(struct msdosfsmount *pmp)
 	MSDOSFS_ASSERT_MP_LOCKED(pmp);
 
 	/*
-	 * Mark all clusters in use, we mark the free ones in the fat scan
+	 * Mark all clusters in use, we mark the free ones in the FAT scan
 	 * loop further down.
 	 */
 	for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++)
@@ -904,7 +904,7 @@ fillinusemap(struct msdosfsmount *pmp)
 
 	/*
 	 * Figure how many free clusters are in the filesystem by ripping
-	 * through the fat counting the number of entries whose content is
+	 * through the FAT counting the number of entries whose content is
 	 * zero.  These represent free clusters.
 	 */
 	pmp->pm_freeclustercount = 0;
@@ -1042,8 +1042,8 @@ extendfile(struct denode *dep, u_long co
 		}
 
 		/*
-		 * Update the "last cluster of the file" entry in the denode's fat
-		 * cache.
+		 * Update the "last cluster of the file" entry in the
+		 * denode's FAT cache.
 		 */
 		fc_setcache(dep, FC_LASTFC, frcn + got - 1, cn + got - 1);
 

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vfsops.c	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.c	Sun May 21 19:29:28 2017	(r318595)
@@ -604,7 +604,7 @@ mountmsdosfs(struct vnode *devvp, struct
 		    <= ((CLUST_RSRVD - CLUST_FIRST) & FAT12_MASK)) {
 			/*
 			 * This will usually be a floppy disk. This size makes
-			 * sure that one fat entry will not be split across
+			 * sure that one FAT entry will not be split across
 			 * multiple blocks.
 			 */
 			pmp->pm_fatmask = FAT12_MASK;
@@ -717,9 +717,9 @@ mountmsdosfs(struct vnode *devvp, struct
 		goto error_exit;
 
 	/*
-	 * If they want fat updates to be synchronous then let them suffer
+	 * If they want FAT updates to be synchronous then let them suffer
 	 * the performance degradation in exchange for the on disk copy of
-	 * the fat being correct just about all the time.  I suppose this
+	 * the FAT being correct just about all the time.  I suppose this
 	 * would be a good thing to turn on if the kernel is still flakey.
 	 */
 	if (mp->mnt_flag & MNT_SYNCHRONOUS)
@@ -925,14 +925,14 @@ msdosfs_sync(struct mount *mp, int waitf
 	td = curthread;
 
 	/*
-	 * If we ever switch to not updating all of the fats all the time,
+	 * If we ever switch to not updating all of the FATs all the time,
 	 * this would be the place to update them from the first one.
 	 */
 	if (pmp->pm_fmod != 0) {
 		if (pmp->pm_flags & MSDOSFSMNT_RONLY)
 			panic("msdosfs_sync: rofs mod");
 		else {
-			/* update fats here */
+			/* update FATs here */
 		}
 	}
 	/*

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vnops.c	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c	Sun May 21 19:29:28 2017	(r318595)
@@ -736,7 +736,7 @@ msdosfs_write(struct vop_write_args *ap)
 			vfs_bio_clrbuf(bp);
 			/*
 			 * Do the bmap now, since pcbmap needs buffers
-			 * for the fat table. (see msdosfs_strategy)
+			 * for the FAT table. (see msdosfs_strategy)
 			 */
 			if (bp->b_blkno == bp->b_lblkno) {
 				error = pcbmap(dep, bp->b_lblkno, &bn, 0, 0);

Modified: head/sys/fs/msdosfs/msdosfsmount.h
==============================================================================
--- head/sys/fs/msdosfs/msdosfsmount.h	Sun May 21 17:07:12 2017	(r318594)
+++ head/sys/fs/msdosfs/msdosfsmount.h	Sun May 21 19:29:28 2017	(r318595)
@@ -65,7 +65,7 @@ MALLOC_DECLARE(M_MSDOSFSMNT);
 struct msdosfs_fileno;
 
 /*
- * Layout of the mount control block for a msdos filesystem.
+ * Layout of the mount control block for a MSDOSFS filesystem.
  */
 struct msdosfsmount {
 	struct mount *pm_mountp;/* vfs mount struct for this fs */
@@ -73,7 +73,7 @@ struct msdosfsmount {
 	struct bufobj *pm_bo;
 	uid_t pm_uid;		/* uid to set as owner of the files */
 	gid_t pm_gid;		/* gid to set as owner of the files */
-	mode_t pm_mask;		/* mask to and with file protection bits 
+	mode_t pm_mask;		/* mask to and with file protection bits
 				   for files */
 	mode_t pm_dirmask;	/* mask to and with file protection bits
 				   for directories */
@@ -81,7 +81,7 @@ struct msdosfsmount {
 	struct cdev *pm_dev;	/* character device mounted */
 	struct bpb50 pm_bpb;	/* BIOS parameter blk for this fs */
 	u_long pm_BlkPerSec;	/* How many DEV_BSIZE blocks fit inside a physical sector */
-	u_long pm_FATsecs;	/* actual number of fat sectors */
+	u_long pm_FATsecs;	/* actual number of FAT sectors */
 	u_long pm_fatblk;	/* block # of first FAT */
 	u_long pm_rootdirblk;	/* block # (cluster # for FAT32) of root directory number */
 	u_long pm_rootdirsize;	/* size in blocks (not clusters) */
@@ -93,15 +93,15 @@ struct msdosfsmount {
 	u_long pm_bnshift;	/* shift file offset right this amount to get a block number */
 	u_long pm_bpcluster;	/* bytes per cluster */
 	u_long pm_fmod;		/* ~0 if fs is modified, this can rollover to 0	*/
-	u_long pm_fatblocksize;	/* size of fat blocks in bytes */
-	u_long pm_fatblocksec;	/* size of fat blocks in sectors */
-	u_long pm_fatsize;	/* size of fat in bytes */
-	uint32_t pm_fatmask;	/* mask to use for fat numbers */
+	u_long pm_fatblocksize;	/* size of FAT blocks in bytes */
+	u_long pm_fatblocksec;	/* size of FAT blocks in sectors */
+	u_long pm_fatsize;	/* size of FAT in bytes */
+	uint32_t pm_fatmask;	/* mask to use for FAT numbers */
 	u_long pm_fsinfo;	/* fsinfo block number */
 	u_long pm_nxtfree;	/* next place to search for a free cluster */
-	u_int pm_fatmult;	/* these 2 values are used in fat */
+	u_int pm_fatmult;	/* these 2 values are used in FAT */
 	u_int pm_fatdiv;	/*	offset computation */
-	u_int pm_curfat;	/* current fat for FAT32 (0 otherwise) */
+	u_int pm_curfat;	/* current FAT for FAT32 (0 otherwise) */
 	u_int *pm_inusemap;	/* ptr to bitmap of in-use clusters */
 	uint64_t pm_flags;	/* see below */
 	void *pm_u2w;	/* Local->Unicode iconv handle */



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