Author: kib
Date: Fri Nov 11 20:01:56 2016
New Revision: 308549
URL: https://svnweb.freebsd.org/changeset/base/308549

Log:
  MFC r308022:
  Use symbolic name for the value of fully free word in pm_inusemap.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c      Fri Nov 11 19:59:42 2016        
(r308548)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c      Fri Nov 11 20:01:56 2016        
(r308549)
@@ -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);
@@ -792,8 +794,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) {
@@ -809,8 +811,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) {
@@ -921,7 +923,7 @@ fillinusemap(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
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to