svn commit: r308022 - head/sys/fs/msdosfs

Konstantin Belousov kib at FreeBSD.org
Fri Oct 28 11:23:37 UTC 2016


Author: kib
Date: Fri Oct 28 11:23:36 2016
New Revision: 308022
URL: https://svnweb.freebsd.org/changeset/base/308022

Log:
  Use symbolic name for the value of fully free word in pm_inusemap.
  Explicitely mention every bit in the value.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_fat.c	Fri Oct 28 11:01:49 2016	(r308021)
+++ head/sys/fs/msdosfs/msdosfs_fat.c	Fri Oct 28 11:23:36 2016	(r308022)
@@ -60,6 +60,8 @@
 #include <fs/msdosfs/fat.h>
 #include <fs/msdosfs/msdosfsmount.h>
 
+#define	FULL_RUN	((u_int)0xffffffff)
+
 static int	chainalloc(struct msdosfsmount *pmp, u_long start,
 		    u_long count, u_long fillwith, u_long *retcluster,
 		    u_long *got);
@@ -752,8 +754,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
 		idx = cn / N_INUSEBITS;
 		map = pmp->pm_inusemap[idx];
 		map |= (1 << (cn % N_INUSEBITS)) - 1;
-		if (map != (u_int)-1) {
-			cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+		if (map != FULL_RUN) {
+			cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
 			if ((l = chainlength(pmp, cn, count)) >= count)
 				return (chainalloc(pmp, cn, count, fillwith, retcluster, got));
 			if (l > foundl) {
@@ -769,8 +771,8 @@ clusteralloc1(struct msdosfsmount *pmp, 
 		idx = cn / N_INUSEBITS;
 		map = pmp->pm_inusemap[idx];
 		map |= (1 << (cn % N_INUSEBITS)) - 1;
-		if (map != (u_int)-1) {
-			cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
+		if (map != FULL_RUN) {
+			cn = idx * N_INUSEBITS + ffs(map ^ FULL_RUN) - 1;
 			if ((l = chainlength(pmp, cn, count)) >= count)
 				return (chainalloc(pmp, cn, count, fillwith, retcluster, got));
 			if (l > foundl) {
@@ -878,7 +880,7 @@ fillinusemap(struct msdosfsmount *pmp)
 	 * loop further down.
 	 */
 	for (cn = 0; cn < (pmp->pm_maxcluster + N_INUSEBITS) / N_INUSEBITS; cn++)
-		pmp->pm_inusemap[cn] = (u_int)-1;
+		pmp->pm_inusemap[cn] = FULL_RUN;
 
 	/*
 	 * Figure how many free clusters are in the filesystem by ripping


More information about the svn-src-all mailing list