Author: emaste
Date: Sat Mar 17 01:48:27 2018
New Revision: 331083
URL: https://svnweb.freebsd.org/changeset/base/331083

Log:
  Prefix UFS symbols with UFS_ to reduce namespace pollution
  
  Followup to r313780.  Also prefix ext2's and nandfs's versions with
  EXT2_ and NANDFS_.
  
  Reported by:  kib
  Reviewed by:  kib, mckusick
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D9623

Modified:
  head/lib/libufs/inode.c
  head/sbin/dump/main.c
  head/sbin/dump/traverse.c
  head/sbin/fsck_ffs/dir.c
  head/sbin/fsck_ffs/fsutil.c
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/pass1.c
  head/sbin/fsck_ffs/pass2.c
  head/sbin/fsck_ffs/suj.c
  head/sbin/fsdb/fsdb.c
  head/sbin/fsdb/fsdbutil.c
  head/sbin/newfs/mkfs.c
  head/sbin/quotacheck/quotacheck.c
  head/sbin/restore/dirs.c
  head/sbin/restore/interactive.c
  head/sbin/restore/tape.c
  head/sbin/tunefs/tunefs.c
  head/stand/libsa/nandfs.c
  head/stand/libsa/ufs.c
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_dinode.h
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/ext2fs/ext2_vnops.c
  head/sys/fs/ext2fs/inode.h
  head/sys/fs/nandfs/nandfs.h
  head/sys/fs/nandfs/nandfs_vnops.c
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_vnops.c
  head/sys/ufs/ffs/softdep.h
  head/sys/ufs/ufs/dinode.h
  head/sys/ufs/ufs/inode.h
  head/sys/ufs/ufs/ufs_lookup.c
  head/sys/ufs/ufs/ufs_vnops.c
  head/usr.sbin/quot/quot.c

Modified: head/lib/libufs/inode.c
==============================================================================
--- head/lib/libufs/inode.c     Sat Mar 17 01:40:09 2018        (r331082)
+++ head/lib/libufs/inode.c     Sat Mar 17 01:48:27 2018        (r331083)
@@ -81,12 +81,12 @@ getino(struct uufsd *disk, void **dino, ino_t inode, i
 gotit: switch (disk->d_ufs) {
        case 1:
                dp1 = &((struct ufs1_dinode *)inoblock)[inode - min];
-               *mode = dp1->di_mode & IFMT;
+               *mode = dp1->di_mode & UFS_IFMT;
                *dino = dp1;
                return (0);
        case 2:
                dp2 = &((struct ufs2_dinode *)inoblock)[inode - min];
-               *mode = dp2->di_mode & IFMT;
+               *mode = dp2->di_mode & UFS_IFMT;
                *dino = dp2;
                return (0);
        default:

Modified: head/sbin/dump/main.c
==============================================================================
--- head/sbin/dump/main.c       Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/dump/main.c       Sat Mar 17 01:48:27 2018        (r331083)
@@ -550,7 +550,7 @@ main(int argc, char *argv[])
                 * Skip directory inodes deleted and maybe reallocated
                 */
                dp = getinode(ino, &mode);
-               if (mode != IFDIR)
+               if (mode != UFS_IFDIR)
                        continue;
                (void)dumpino(dp, ino);
        }
@@ -569,7 +569,7 @@ main(int argc, char *argv[])
                 * Skip inodes deleted and reallocated as directories.
                 */
                dp = getinode(ino, &mode);
-               if (mode == IFDIR)
+               if (mode == UFS_IFDIR)
                        continue;
                (void)dumpino(dp, ino);
        }

Modified: head/sbin/dump/traverse.c
==============================================================================
--- head/sbin/dump/traverse.c   Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/dump/traverse.c   Sat Mar 17 01:48:27 2018        (r331083)
@@ -195,7 +195,7 @@ mapfiles(ino_t maxino, long *tapesize)
                for (i = 0; i < inosused; i++, ino++) {
                        if (ino < UFS_ROOTINO ||
                            (dp = getinode(ino, &mode)) == NULL ||
-                           (mode & IFMT) == 0)
+                           (mode & UFS_IFMT) == 0)
                                continue;
                        if (ino >= maxino) {
                                msg("Skipping inode %ju >= maxino %ju\n",
@@ -209,19 +209,19 @@ mapfiles(ino_t maxino, long *tapesize)
                         * (this is used in mapdirs()).
                         */
                        SETINO(ino, usedinomap);
-                       if (mode == IFDIR)
+                       if (mode == UFS_IFDIR)
                                SETINO(ino, dumpdirmap);
                        if (WANTTODUMP(dp)) {
                                SETINO(ino, dumpinomap);
-                               if (mode != IFREG &&
-                                   mode != IFDIR &&
-                                   mode != IFLNK)
+                               if (mode != UFS_IFREG &&
+                                   mode != UFS_IFDIR &&
+                                   mode != UFS_IFLNK)
                                        *tapesize += 1;
                                else
                                        *tapesize += blockest(dp);
                                continue;
                        }
-                       if (mode == IFDIR) {
+                       if (mode == UFS_IFDIR) {
                                if (!nonodump &&
                                    (DIP(dp, di_flags) & UF_NODUMP))
                                        CLRINO(ino, usedinomap);
@@ -429,7 +429,7 @@ searchdir(
                         * Add back to dumpdirmap and remove from usedinomap
                         * to propagate nodump.
                         */
-                       if (mode == IFDIR) {
+                       if (mode == UFS_IFDIR) {
                                SETINO(dp->d_ino, dumpdirmap);
                                CLRINO(dp->d_ino, usedinomap);
                                ret |= HASSUBDIRS;
@@ -554,7 +554,7 @@ dumpino(union dinode *dp, ino_t ino)
 
        default:
                msg("Warning: undefined file type 0%o\n",
-                   DIP(dp, di_mode) & IFMT);
+                   DIP(dp, di_mode) & UFS_IFMT);
                return;
        }
        if (DIP(dp, di_size) > UFS_NDADDR * sblock->fs_bsize) {
@@ -890,11 +890,11 @@ getinode(ino_t inum, int *modep)
 gotit:
        if (sblock->fs_magic == FS_UFS1_MAGIC) {
                dp1 = &((struct ufs1_dinode *)inoblock)[inum - minino];
-               *modep = (dp1->di_mode & IFMT);
+               *modep = (dp1->di_mode & UFS_IFMT);
                return ((union dinode *)dp1);
        }
        dp2 = &((struct ufs2_dinode *)inoblock)[inum - minino];
-       *modep = (dp2->di_mode & IFMT);
+       *modep = (dp2->di_mode & UFS_IFMT);
        return ((union dinode *)dp2);
 }
 

Modified: head/sbin/fsck_ffs/dir.c
==============================================================================
--- head/sbin/fsck_ffs/dir.c    Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsck_ffs/dir.c    Sat Mar 17 01:48:27 2018        (r331083)
@@ -264,7 +264,7 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg)
        dp = ginode(ino);
        if (ftypeok(dp))
                pfatal("%s=%s\n",
-                   (DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE",
+                   (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ? "DIR" : "FILE",
                    pathbuf);
        else
                pfatal("NAME=%s\n", pathbuf);
@@ -308,7 +308,8 @@ adjust(struct inodesc *idesc, int lcnt)
        }
        if (lcnt != 0) {
                pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname :
-                       ((DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE"));
+                       ((DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ?
+                           "DIR" : "FILE"));
                pinode(idesc->id_number);
                printf(" COUNT %d SHOULD BE %d",
                        DIP(dp, di_nlink), DIP(dp, di_nlink) - lcnt);
@@ -388,7 +389,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
 
        memset(&idesc, 0, sizeof(struct inodesc));
        dp = ginode(orphan);
-       lostdir = (DIP(dp, di_mode) & IFMT) == IFDIR;
+       lostdir = (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR;
        pwarn("UNREF %s ", lostdir ? "DIR" : "FILE");
        pinode(orphan);
        if (preen && DIP(dp, di_size) == 0)
@@ -436,7 +437,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
                }
        }
        dp = ginode(lfdir);
-       if ((DIP(dp, di_mode) & IFMT) != IFDIR) {
+       if ((DIP(dp, di_mode) & UFS_IFMT) != UFS_IFDIR) {
                pfatal("lost+found IS NOT A DIRECTORY");
                if (reply("REALLOCATE") == 0)
                        return (0);
@@ -615,7 +616,7 @@ allocdir(ino_t parent, ino_t request, int mode)
        struct inoinfo *inp;
        struct dirtemplate *dirp;
 
-       ino = allocino(request, IFDIR|mode);
+       ino = allocino(request, UFS_IFDIR|mode);
        dirp = &dirhead;
        dirp->dot_ino = ino;
        dirp->dotdot_ino = parent;

Modified: head/sbin/fsck_ffs/fsutil.c
==============================================================================
--- head/sbin/fsck_ffs/fsutil.c Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsck_ffs/fsutil.c Sat Mar 17 01:48:27 2018        (r331083)
@@ -100,15 +100,15 @@ fsutilinit(void)
 int
 ftypeok(union dinode *dp)
 {
-       switch (DIP(dp, di_mode) & IFMT) {
+       switch (DIP(dp, di_mode) & UFS_IFMT) {
 
-       case IFDIR:
-       case IFREG:
-       case IFBLK:
-       case IFCHR:
-       case IFLNK:
-       case IFSOCK:
-       case IFIFO:
+       case UFS_IFDIR:
+       case UFS_IFREG:
+       case UFS_IFBLK:
+       case UFS_IFCHR:
+       case UFS_IFLNK:
+       case UFS_IFSOCK:
+       case UFS_IFIFO:
                return (1);
 
        default:

Modified: head/sbin/fsck_ffs/inode.c
==============================================================================
--- head/sbin/fsck_ffs/inode.c  Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsck_ffs/inode.c  Sat Mar 17 01:48:27 2018        (r331083)
@@ -71,8 +71,8 @@ ckinode(union dinode *dp, struct inodesc *idesc)
        idesc->id_lbn = -1;
        idesc->id_entryno = 0;
        idesc->id_filesize = DIP(dp, di_size);
-       mode = DIP(dp, di_mode) & IFMT;
-       if (mode == IFBLK || mode == IFCHR || (mode == IFLNK &&
+       mode = DIP(dp, di_mode) & UFS_IFMT;
+       if (mode == UFS_IFBLK || mode == UFS_IFCHR || (mode == UFS_IFLNK &&
            DIP(dp, di_size) < (unsigned)sblock.fs_maxsymlinklen))
                return (KEEPON);
        if (sblock.fs_magic == FS_UFS1_MAGIC)
@@ -347,7 +347,7 @@ getnextinode(ino_t inumber, int rebuildcg)
                 * Try to determine if we have reached the end of the
                 * allocated inodes.
                 */
-               mode = DIP(dp, di_mode) & IFMT;
+               mode = DIP(dp, di_mode) & UFS_IFMT;
                if (mode == 0) {
                        if (memcmp(dp->dp2.di_db, ufs2_zino.di_db,
                                UFS_NDADDR * sizeof(ufs2_daddr_t)) ||
@@ -362,9 +362,9 @@ getnextinode(ino_t inumber, int rebuildcg)
                ndb = howmany(DIP(dp, di_size), sblock.fs_bsize);
                if (ndb < 0)
                        return (NULL);
-               if (mode == IFBLK || mode == IFCHR)
+               if (mode == UFS_IFBLK || mode == UFS_IFCHR)
                        ndb++;
-               if (mode == IFLNK) {
+               if (mode == UFS_IFLNK) {
                        /*
                         * Fake ndb value so direct/indirect block checks below
                         * will detect any garbage after symlink string.
@@ -533,7 +533,7 @@ clri(struct inodesc *idesc, const char *type, int flag
        dp = ginode(idesc->id_number);
        if (flag == 1) {
                pwarn("%s %s", type,
-                   (DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE");
+                   (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ? "DIR":"FILE");
                pinode(idesc->id_number);
        }
        if (preen || reply("CLEAR") == 1) {
@@ -681,13 +681,13 @@ allocino(ino_t request, int type)
                return (0);
        setbit(cg_inosused(cgp), ino % sblock.fs_ipg);
        cgp->cg_cs.cs_nifree--;
-       switch (type & IFMT) {
-       case IFDIR:
+       switch (type & UFS_IFMT) {
+       case UFS_IFDIR:
                inoinfo(ino)->ino_state = DSTATE;
                cgp->cg_cs.cs_ndir++;
                break;
-       case IFREG:
-       case IFLNK:
+       case UFS_IFREG:
+       case UFS_IFLNK:
                inoinfo(ino)->ino_state = FSTATE;
                break;
        default:

Modified: head/sbin/fsck_ffs/pass1.c
==============================================================================
--- head/sbin/fsck_ffs/pass1.c  Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsck_ffs/pass1.c  Sat Mar 17 01:48:27 2018        (r331083)
@@ -251,7 +251,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
 
        if ((dp = getnextinode(inumber, rebuildcg)) == NULL)
                return (0);
-       mode = DIP(dp, di_mode) & IFMT;
+       mode = DIP(dp, di_mode) & UFS_IFMT;
        if (mode == 0) {
                if ((sblock.fs_magic == FS_UFS1_MAGIC &&
                     (memcmp(dp->dp1.di_db, ufs1_zino.di_db,
@@ -284,25 +284,25 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
                kernmaxfilesize = sblock.fs_maxfilesize;
        if (DIP(dp, di_size) > kernmaxfilesize ||
            DIP(dp, di_size) > sblock.fs_maxfilesize ||
-           (mode == IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
+           (mode == UFS_IFDIR && DIP(dp, di_size) > MAXDIRSIZE)) {
                if (debug)
                        printf("bad size %ju:", (uintmax_t)DIP(dp, di_size));
                goto unknown;
        }
-       if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
+       if (!preen && mode == UFS_IFMT && reply("HOLD BAD BLOCK") == 1) {
                dp = ginode(inumber);
                DIP_SET(dp, di_size, sblock.fs_fsize);
-               DIP_SET(dp, di_mode, IFREG|0600);
+               DIP_SET(dp, di_mode, UFS_IFREG|0600);
                inodirty();
        }
-       if ((mode == IFBLK || mode == IFCHR || mode == IFIFO ||
-            mode == IFSOCK) && DIP(dp, di_size) != 0) {
+       if ((mode == UFS_IFBLK || mode == UFS_IFCHR || mode == UFS_IFIFO ||
+            mode == UFS_IFSOCK) && DIP(dp, di_size) != 0) {
                if (debug)
                        printf("bad special-file size %ju:",
                            (uintmax_t)DIP(dp, di_size));
                goto unknown;
        }
-       if ((mode == IFBLK || mode == IFCHR) &&
+       if ((mode == UFS_IFBLK || mode == UFS_IFCHR) &&
            (dev_t)DIP(dp, di_rdev) == NODEV) {
                if (debug)
                        printf("bad special-file rdev NODEV:");
@@ -315,9 +315,9 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
                                (uintmax_t)DIP(dp, di_size), (uintmax_t)ndb);
                goto unknown;
        }
-       if (mode == IFBLK || mode == IFCHR)
+       if (mode == UFS_IFBLK || mode == UFS_IFCHR)
                ndb++;
-       if (mode == IFLNK) {
+       if (mode == UFS_IFLNK) {
                /*
                 * Fake ndb value so direct/indirect block checks below
                 * will detect any garbage after symlink string.
@@ -357,7 +357,7 @@ checkinode(ino_t inumber, struct inodesc *idesc, int r
                goto unknown;
        n_files++;
        inoinfo(inumber)->ino_linkcnt = DIP(dp, di_nlink);
-       if (mode == IFDIR) {
+       if (mode == UFS_IFDIR) {
                if (DIP(dp, di_size) == 0)
                        inoinfo(inumber)->ino_state = DCLEAR;
                else if (DIP(dp, di_nlink) <= 0)

Modified: head/sbin/fsck_ffs/pass2.c
==============================================================================
--- head/sbin/fsck_ffs/pass2.c  Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsck_ffs/pass2.c  Sat Mar 17 01:48:27 2018        (r331083)
@@ -112,8 +112,8 @@ pass2(void)
                        exit(EEXIT);
                }
                dp = ginode(UFS_ROOTINO);
-               DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~IFMT);
-               DIP_SET(dp, di_mode, DIP(dp, di_mode) | IFDIR);
+               DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~UFS_IFMT);
+               DIP_SET(dp, di_mode, DIP(dp, di_mode) | UFS_IFDIR);
                inodirty();
                break;
 
@@ -184,7 +184,7 @@ pass2(void)
                }
                dp = &dino;
                memset(dp, 0, sizeof(struct ufs2_dinode));
-               DIP_SET(dp, di_mode, IFDIR);
+               DIP_SET(dp, di_mode, UFS_IFDIR);
                DIP_SET(dp, di_size, inp->i_isize);
                for (i = 0; i < MIN(inp->i_numblks, UFS_NDADDR); i++)
                        DIP_SET(dp, di_db[i], inp->i_blks[i]);
@@ -478,7 +478,8 @@ again:
                                break;
                        dp = ginode(dirp->d_ino);
                        inoinfo(dirp->d_ino)->ino_state =
-                          (DIP(dp, di_mode) & IFMT) == IFDIR ? DSTATE : FSTATE;
+                          (DIP(dp, di_mode) & UFS_IFMT) == UFS_IFDIR ?
+                           DSTATE : FSTATE;
                        inoinfo(dirp->d_ino)->ino_linkcnt = DIP(dp, di_nlink);
                        goto again;
 

Modified: head/sbin/fsck_ffs/suj.c
==============================================================================
--- head/sbin/fsck_ffs/suj.c    Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsck_ffs/suj.c    Sat Mar 17 01:48:27 2018        (r331083)
@@ -605,7 +605,7 @@ ino_free(ino_t ino, int mode)
        if (ino < cgp->cg_irotor)
                cgp->cg_irotor = ino;
        cgp->cg_cs.cs_nifree++;
-       if ((mode & IFMT) == IFDIR) {
+       if ((mode & UFS_IFMT) == UFS_IFDIR) {
                freedir++;
                cgp->cg_cs.cs_ndir--;
        }
@@ -748,7 +748,7 @@ ino_blkatoff(union dinode *ip, ino_t ino, ufs_lbn_t lb
        /*
         * Now direct and indirect.
         */
-       if (DIP(ip, di_mode) == IFLNK &&
+       if (DIP(ip, di_mode) == UFS_IFLNK &&
            DIP(ip, di_size) < fs->fs_maxsymlinklen)
                return (0);
        if (lbn >= 0 && lbn < UFS_NDADDR) {
@@ -853,7 +853,7 @@ ino_isat(ino_t parent, off_t diroff, ino_t child, int 
        *isdot = 0;
        dip = ino_read(parent);
        *mode = DIP(dip, di_mode);
-       if ((*mode & IFMT) != IFDIR) {
+       if ((*mode & UFS_IFMT) != UFS_IFDIR) {
                if (debug) {
                        /*
                         * This can happen if the parent inode
@@ -1013,7 +1013,7 @@ ino_visit(union dinode *ip, ino_t ino, ino_visitor vis
        int i;
 
        size = DIP(ip, di_size);
-       mode = DIP(ip, di_mode) & IFMT;
+       mode = DIP(ip, di_mode) & UFS_IFMT;
        fragcnt = 0;
        if ((flags & VISIT_EXT) &&
            fs->fs_magic == FS_UFS2_MAGIC && ip->dp2.di_extsize) {
@@ -1027,8 +1027,8 @@ ino_visit(union dinode *ip, ino_t ino, ino_visitor vis
                }
        }
        /* Skip datablocks for short links and devices. */
-       if (mode == IFBLK || mode == IFCHR ||
-           (mode == IFLNK && size < fs->fs_maxsymlinklen))
+       if (mode == UFS_IFBLK || mode == UFS_IFCHR ||
+           (mode == UFS_IFLNK && size < fs->fs_maxsymlinklen))
                return (fragcnt);
        for (i = 0; i < UFS_NDADDR; i++) {
                if (DIP(ip, di_db[i]) == 0)
@@ -1265,7 +1265,7 @@ ino_reclaim(union dinode *ip, ino_t ino, int mode)
                    (uintmax_t)ino, DIP(ip, di_nlink), DIP(ip, di_mode));
 
        /* We are freeing an inode or directory. */
-       if ((DIP(ip, di_mode) & IFMT) == IFDIR)
+       if ((DIP(ip, di_mode) & UFS_IFMT) == UFS_IFDIR)
                ino_visit(ip, ino, ino_free_children, 0);
        DIP_SET(ip, di_nlink, 0);
        ino_visit(ip, ino, blk_free_visit, VISIT_EXT | VISIT_INDIR);
@@ -1300,7 +1300,7 @@ ino_decr(ino_t ino)
        if (mode == 0)
                err_suj("Inode %d has a link of %d with 0 mode\n", ino, nlink);
        nlink--;
-       if ((mode & IFMT) == IFDIR)
+       if ((mode & UFS_IFMT) == UFS_IFDIR)
                reqlink = 2;
        else
                reqlink = 1;
@@ -1335,13 +1335,13 @@ ino_adjust(struct suj_ino *sino)
 
        nlink = sino->si_nlink;
        ino = sino->si_ino;
-       mode = sino->si_mode & IFMT;
+       mode = sino->si_mode & UFS_IFMT;
        /*
         * If it's a directory with no dot links, it was truncated before
         * the name was cleared.  We need to clear the dirent that
         * points at it.
         */
-       if (mode == IFDIR && nlink == 1 && sino->si_dotlinks == 0) {
+       if (mode == UFS_IFDIR && nlink == 1 && sino->si_dotlinks == 0) {
                sino->si_nlink = nlink = 0;
                TAILQ_FOREACH(srec, &sino->si_recs, sr_next) {
                        rrec = (struct jrefrec *)srec->sr_rec;
@@ -1358,7 +1358,7 @@ ino_adjust(struct suj_ino *sino)
         * If it's a directory with no real names pointing to it go ahead
         * and truncate it.  This will free any children.
         */
-       if (mode == IFDIR && nlink - sino->si_dotlinks == 0) {
+       if (mode == UFS_IFDIR && nlink - sino->si_dotlinks == 0) {
                sino->si_nlink = nlink = 0;
                /*
                 * Mark any .. links so they know not to free this inode
@@ -1374,7 +1374,7 @@ ino_adjust(struct suj_ino *sino)
                }
        }
        ip = ino_read(ino);
-       mode = DIP(ip, di_mode) & IFMT;
+       mode = DIP(ip, di_mode) & UFS_IFMT;
        if (nlink > UFS_LINK_MAX)
                err_suj("ino %ju nlink manipulation error, new %ju, old %d\n",
                    (uintmax_t)ino, (uintmax_t)nlink, DIP(ip, di_nlink));
@@ -1393,7 +1393,7 @@ ino_adjust(struct suj_ino *sino)
        if (mode != sino->si_mode && debug)
                printf("ino %ju, mode %o != %o\n",
                    (uintmax_t)ino, mode, sino->si_mode);
-       if ((mode & IFMT) == IFDIR)
+       if ((mode & UFS_IFMT) == UFS_IFDIR)
                reqlink = 2;
        else
                reqlink = 1;
@@ -1506,15 +1506,15 @@ ino_trunc(ino_t ino, off_t size)
        int mode;
 
        ip = ino_read(ino);
-       mode = DIP(ip, di_mode) & IFMT;
+       mode = DIP(ip, di_mode) & UFS_IFMT;
        cursize = DIP(ip, di_size);
        if (debug)
                printf("Truncating ino %ju, mode %o to size %jd from size 
%jd\n",
                    (uintmax_t)ino, mode, size, cursize);
 
        /* Skip datablocks for short links and devices. */
-       if (mode == 0 || mode == IFBLK || mode == IFCHR ||
-           (mode == IFLNK && cursize < fs->fs_maxsymlinklen))
+       if (mode == 0 || mode == UFS_IFBLK || mode == UFS_IFCHR ||
+           (mode == UFS_IFLNK && cursize < fs->fs_maxsymlinklen))
                return;
        /* Don't extend. */
        if (size > cursize)
@@ -1587,7 +1587,7 @@ ino_trunc(ino_t ino, off_t size)
         * uninitialized space later.
         */
        off = blkoff(fs, size);
-       if (off && DIP(ip, di_mode) != IFDIR) {
+       if (off && DIP(ip, di_mode) != UFS_IFDIR) {
                uint8_t *buf;
                long clrsize;
 
@@ -1635,7 +1635,7 @@ ino_check(struct suj_ino *sino)
                rrec = (struct jrefrec *)srec->sr_rec;
                isat = ino_isat(rrec->jr_parent, rrec->jr_diroff,
                    rrec->jr_ino, &mode, &isdot);
-               if (isat && (mode & IFMT) != (rrec->jr_mode & IFMT))
+               if (isat && (mode & UFS_IFMT) != (rrec->jr_mode & UFS_IFMT))
                        err_suj("Inode mode/directory type mismatch %o != %o\n",
                            mode, rrec->jr_mode);
                if (debug)
@@ -1646,7 +1646,7 @@ ino_check(struct suj_ino *sino)
                            (uintmax_t)rrec->jr_parent,
                            (uintmax_t)rrec->jr_diroff,
                            rrec->jr_mode, isat, isdot);
-               mode = rrec->jr_mode & IFMT;
+               mode = rrec->jr_mode & UFS_IFMT;
                if (rrec->jr_op == JOP_REMREF)
                        removes++;
                newlinks += isat;
@@ -1915,7 +1915,7 @@ ino_unlinked(void)
        fs->fs_sujfree = 0;
        while (ino != 0) {
                ip = ino_read(ino);
-               mode = DIP(ip, di_mode) & IFMT;
+               mode = DIP(ip, di_mode) & UFS_IFMT;
                inon = DIP(ip, di_freelink);
                DIP_SET(ip, di_freelink, 0);
                /*
@@ -2371,7 +2371,7 @@ suj_verifyino(union dinode *ip)
                return (-1);
        }
 
-       if (DIP(ip, di_mode) != (IFREG | IREAD)) {
+       if (DIP(ip, di_mode) != (UFS_IFREG | UFS_IREAD)) {
                printf("Invalid mode %o for journal inode %ju\n",
                    DIP(ip, di_mode), (uintmax_t)sujino);
                return (-1);

Modified: head/sbin/fsdb/fsdb.c
==============================================================================
--- head/sbin/fsdb/fsdb.c       Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsdb/fsdb.c       Sat Mar 17 01:48:27 2018        (r331083)
@@ -512,14 +512,14 @@ CMDFUNCSTART(findblk)
            /* Get on-disk inode aka dinode. */
            curinum = inum;
            curinode = ginode(inum);
-           /* Find IFLNK dinode with allocated data blocks. */
-           switch (DIP(curinode, di_mode) & IFMT) {
-           case IFDIR:
-           case IFREG:
+           /* Find UFS_IFLNK dinode with allocated data blocks. */
+           switch (DIP(curinode, di_mode) & UFS_IFMT) {
+           case UFS_IFDIR:
+           case UFS_IFREG:
                if (DIP(curinode, di_blocks) == 0)
                    continue;
                break;
-           case IFLNK:
+           case UFS_IFLNK:
                {
                    uint64_t size = DIP(curinode, di_size);
                    if (size > 0 && size < sblock.fs_maxsymlinklen &&
@@ -889,10 +889,10 @@ struct typemap {
     const char *typename;
     int typebits;
 } typenamemap[]  = {
-    {"file", IFREG},
-    {"dir", IFDIR},
-    {"socket", IFSOCK},
-    {"fifo", IFIFO},
+    {"file", UFS_IFREG},
+    {"dir", UFS_IFDIR},
+    {"socket", UFS_IFSOCK},
+    {"fifo", UFS_IFIFO},
 };
 
 CMDFUNCSTART(newtype)
@@ -902,7 +902,7 @@ CMDFUNCSTART(newtype)
 
     if (!checkactive())
        return 1;
-    type = DIP(curinode, di_mode) & IFMT;
+    type = DIP(curinode, di_mode) & UFS_IFMT;
     for (tp = typenamemap;
         tp < &typenamemap[nitems(typenamemap)];
         tp++) {
@@ -917,7 +917,7 @@ CMDFUNCSTART(newtype)
        warnx("try one of `file', `dir', `socket', `fifo'");
        return 1;
     }
-    DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~IFMT);
+    DIP_SET(curinode, di_mode, DIP(curinode, di_mode) & ~UFS_IFMT);
     DIP_SET(curinode, di_mode, DIP(curinode, di_mode) | type);
     inodirty();
     printactive(0);

Modified: head/sbin/fsdb/fsdbutil.c
==============================================================================
--- head/sbin/fsdb/fsdbutil.c   Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/fsdb/fsdbutil.c   Sat Mar 17 01:48:27 2018        (r331083)
@@ -120,20 +120,20 @@ printstat(const char *cp, ino_t inum, union dinode *dp
     time_t t;
 
     printf("%s: ", cp);
-    switch (DIP(dp, di_mode) & IFMT) {
-    case IFDIR:
+    switch (DIP(dp, di_mode) & UFS_IFMT) {
+    case UFS_IFDIR:
        puts("directory");
        break;
-    case IFREG:
+    case UFS_IFREG:
        puts("regular file");
        break;
-    case IFBLK:
+    case UFS_IFBLK:
        printf("block special (%#jx)", (uintmax_t)DIP(dp, di_rdev));
        break;
-    case IFCHR:
+    case UFS_IFCHR:
        printf("character special (%#jx)", DIP(dp, di_rdev));
        break;
-    case IFLNK:
+    case UFS_IFLNK:
        fputs("symlink",stdout);
        if (DIP(dp, di_size) > 0 &&
            DIP(dp, di_size) < sblock.fs_maxsymlinklen &&
@@ -147,10 +147,10 @@ printstat(const char *cp, ino_t inum, union dinode *dp
            putchar('\n');
        }
        break;
-    case IFSOCK:
+    case UFS_IFSOCK:
        puts("socket");
        break;
-    case IFIFO:
+    case UFS_IFIFO:
        puts("fifo");
        break;
     }
@@ -338,7 +338,7 @@ checkactivedir(void)
        warnx("no current inode\n");
        return 0;
     }
-    if ((DIP(curinode, di_mode) & IFMT) != IFDIR) {
+    if ((DIP(curinode, di_mode) & UFS_IFMT) != UFS_IFDIR) {
        warnx("inode %ju not a directory", (uintmax_t)curinum);
        return 0;
     }
@@ -350,14 +350,14 @@ printactive(int doblocks)
 {
     if (!checkactive())
        return 1;
-    switch (DIP(curinode, di_mode) & IFMT) {
-    case IFDIR:
-    case IFREG:
-    case IFBLK:
-    case IFCHR:
-    case IFLNK:
-    case IFSOCK:
-    case IFIFO:
+    switch (DIP(curinode, di_mode) & UFS_IFMT) {
+    case UFS_IFDIR:
+    case UFS_IFREG:
+    case UFS_IFBLK:
+    case UFS_IFCHR:
+    case UFS_IFLNK:
+    case UFS_IFSOCK:
+    case UFS_IFIFO:
        if (doblocks)
            printblocks(curinum, curinode);
        else
@@ -368,7 +368,7 @@ printactive(int doblocks)
        break;
     default:
        printf("current inode %ju: screwy itype 0%o (mode 0%o)?\n",
-           (uintmax_t)curinum, DIP(curinode, di_mode) & IFMT,
+           (uintmax_t)curinum, DIP(curinode, di_mode) & UFS_IFMT,
            DIP(curinode, di_mode));
        break;
     }

Modified: head/sbin/newfs/mkfs.c
==============================================================================
--- head/sbin/newfs/mkfs.c      Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/newfs/mkfs.c      Sat Mar 17 01:48:27 2018        (r331083)
@@ -883,7 +883,7 @@ fsinit(time_t utime)
                /*
                 * create the root directory
                 */
-               node.dp1.di_mode = IFDIR | UMASK;
+               node.dp1.di_mode = UFS_IFDIR | UMASK;
                node.dp1.di_nlink = entries;
                node.dp1.di_size = makedir(root_dir, entries);
                node.dp1.di_db[0] = alloc(sblock.fs_fsize, node.dp1.di_mode);
@@ -919,7 +919,7 @@ fsinit(time_t utime)
                /*
                 * create the root directory
                 */
-               node.dp2.di_mode = IFDIR | UMASK;
+               node.dp2.di_mode = UFS_IFDIR | UMASK;
                node.dp2.di_nlink = entries;
                node.dp2.di_size = makedir(root_dir, entries);
                node.dp2.di_db[0] = alloc(sblock.fs_fsize, node.dp2.di_mode);
@@ -1002,7 +1002,7 @@ goth:
        acg.cg_cs.cs_nbfree--;
        sblock.fs_cstotal.cs_nbfree--;
        fscs[0].cs_nbfree--;
-       if (mode & IFDIR) {
+       if (mode & UFS_IFDIR) {
                acg.cg_cs.cs_ndir++;
                sblock.fs_cstotal.cs_ndir++;
                fscs[0].cs_ndir++;

Modified: head/sbin/quotacheck/quotacheck.c
==============================================================================
--- head/sbin/quotacheck/quotacheck.c   Sat Mar 17 01:40:09 2018        
(r331082)
+++ head/sbin/quotacheck/quotacheck.c   Sat Mar 17 01:48:27 2018        
(r331083)
@@ -370,7 +370,7 @@ chkquota(char *specname, struct quotafile *qfu, struct
                for (i = 0; i < inosused; i++, ino++) {
                        if ((dp = getnextinode(ino)) == NULL ||
                            ino < UFS_ROOTINO ||
-                           (mode = DIP(dp, di_mode) & IFMT) == 0)
+                           (mode = DIP(dp, di_mode) & UFS_IFMT) == 0)
                                continue;
                        /*
                         * XXX: Do not account for UIDs or GIDs that appear
@@ -405,16 +405,16 @@ chkquota(char *specname, struct quotafile *qfu, struct
                                fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA,
                                    (char *)0, mntpt);
                                fup->fu_curinodes++;
-                               if (mode == IFREG || mode == IFDIR ||
-                                   mode == IFLNK)
+                               if (mode == UFS_IFREG || mode == UFS_IFDIR ||
+                                   mode == UFS_IFLNK)
                                        fup->fu_curblocks += DIP(dp, di_blocks);
                        }
                        if (qfu) {
                                fup = addid((u_long)DIP(dp, di_uid), USRQUOTA,
                                    (char *)0, mntpt);
                                fup->fu_curinodes++;
-                               if (mode == IFREG || mode == IFDIR ||
-                                   mode == IFLNK)
+                               if (mode == UFS_IFREG || mode == UFS_IFDIR ||
+                                   mode == UFS_IFLNK)
                                        fup->fu_curblocks += DIP(dp, di_blocks);
                        }
                }

Modified: head/sbin/restore/dirs.c
==============================================================================
--- head/sbin/restore/dirs.c    Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/restore/dirs.c    Sat Mar 17 01:48:27 2018        (r331083)
@@ -178,7 +178,7 @@ extractdirs(int genmode)
        for (;;) {
                curfile.name = "<directory file - name unknown>";
                curfile.action = USING;
-               if (curfile.mode == 0 || (curfile.mode & IFMT) != IFDIR)
+               if (curfile.mode == 0 || (curfile.mode & UFS_IFMT) != UFS_IFDIR)
                        break;
                itp = allocinotab(&curfile, seekpt);
                getfile(putdir, putdirattrs, xtrnull);
@@ -205,7 +205,7 @@ void
 skipdirs(void)
 {
 
-       while (curfile.ino && (curfile.mode & IFMT) == IFDIR) {
+       while (curfile.ino && (curfile.mode & UFS_IFMT) == UFS_IFDIR) {
                skipfile();
        }
 }

Modified: head/sbin/restore/interactive.c
==============================================================================
--- head/sbin/restore/interactive.c     Sat Mar 17 01:40:09 2018        
(r331082)
+++ head/sbin/restore/interactive.c     Sat Mar 17 01:48:27 2018        
(r331083)
@@ -741,9 +741,9 @@ glob_stat(const char *name, struct stat *stp)
            (!vflag && dp->d_ino == UFS_WINO))
                return (-1);
        if (inodetype(dp->d_ino) == NODE)
-               stp->st_mode = IFDIR;
+               stp->st_mode = UFS_IFDIR;
        else
-               stp->st_mode = IFREG;
+               stp->st_mode = UFS_IFREG;
        return (0);
 }
 

Modified: head/sbin/restore/tape.c
==============================================================================
--- head/sbin/restore/tape.c    Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/restore/tape.c    Sat Mar 17 01:48:27 2018        (r331083)
@@ -592,19 +592,19 @@ extractfile(char *name)
        gid = curfile.gid;
        mode = curfile.mode;
        flags = curfile.file_flags;
-       switch (mode & IFMT) {
+       switch (mode & UFS_IFMT) {
 
        default:
                fprintf(stderr, "%s: unknown file mode 0%o\n", name, mode);
                skipfile();
                return (FAIL);
 
-       case IFSOCK:
+       case UFS_IFSOCK:
                vprintf(stdout, "skipped socket %s\n", name);
                skipfile();
                return (GOOD);
 
-       case IFDIR:
+       case UFS_IFDIR:
                if (mflag) {
                        ep = lookupname(name);
                        if (ep == NULL || ep->e_flags & EXTRACT)
@@ -615,7 +615,7 @@ extractfile(char *name)
                vprintf(stdout, "extract file %s\n", name);
                return (genliteraldir(name, curfile.ino));
 
-       case IFLNK:
+       case UFS_IFLNK:
                lnkbuf[0] = '\0';
                pathlen = 0;
                buf = setupextattr(extsize);
@@ -639,7 +639,7 @@ extractfile(char *name)
                }
                return (FAIL);
 
-       case IFIFO:
+       case UFS_IFIFO:
                vprintf(stdout, "extract fifo %s\n", name);
                if (Nflag) {
                        skipfile();
@@ -667,8 +667,8 @@ extractfile(char *name)
                (void) chflags(name, flags);
                return (GOOD);
 
-       case IFCHR:
-       case IFBLK:
+       case UFS_IFCHR:
+       case UFS_IFBLK:
                vprintf(stdout, "extract special file %s\n", name);
                if (Nflag) {
                        skipfile();
@@ -676,7 +676,7 @@ extractfile(char *name)
                }
                if (uflag)
                        (void) unlink(name);
-               if (mknod(name, (mode & (IFCHR | IFBLK)) | 0600,
+               if (mknod(name, (mode & (UFS_IFCHR | UFS_IFBLK)) | 0600,
                    (int)curfile.rdev) < 0) {
                        fprintf(stderr, "%s: cannot create special file: %s\n",
                            name, strerror(errno));
@@ -697,7 +697,7 @@ extractfile(char *name)
                (void) chflags(name, flags);
                return (GOOD);
 
-       case IFREG:
+       case UFS_IFREG:
                vprintf(stdout, "extract file %s\n", name);
                if (Nflag) {
                        skipfile();

Modified: head/sbin/tunefs/tunefs.c
==============================================================================
--- head/sbin/tunefs/tunefs.c   Sat Mar 17 01:40:09 2018        (r331082)
+++ head/sbin/tunefs/tunefs.c   Sat Mar 17 01:48:27 2018        (r331083)
@@ -1021,7 +1021,7 @@ journal_alloc(int64_t size)
                if (sblock.fs_magic == FS_UFS1_MAGIC) {
                        bzero(dp1, sizeof(*dp1));
                        dp1->di_size = size;
-                       dp1->di_mode = IFREG | IREAD;
+                       dp1->di_mode = UFS_IFREG | UFS_IREAD;
                        dp1->di_nlink = 1;
                        dp1->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
                        dp1->di_atime = utime;
@@ -1030,7 +1030,7 @@ journal_alloc(int64_t size)
                } else {
                        bzero(dp2, sizeof(*dp2));
                        dp2->di_size = size;
-                       dp2->di_mode = IFREG | IREAD;
+                       dp2->di_mode = UFS_IFREG | UFS_IREAD;
                        dp2->di_nlink = 1;
                        dp2->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
                        dp2->di_atime = utime;

Modified: head/stand/libsa/nandfs.c
==============================================================================
--- head/stand/libsa/nandfs.c   Sat Mar 17 01:40:09 2018        (r331082)
+++ head/stand/libsa/nandfs.c   Sat Mar 17 01:48:27 2018        (r331083)
@@ -654,7 +654,7 @@ nandfs_lookup_path(struct nandfs *fs, const char *path
        while ((strp = strsep(&lpath, "/")) != NULL) {
                if (*strp == '\0')
                        continue;
-               if ((node->inode->i_mode & IFMT) != IFDIR) {
+               if ((node->inode->i_mode & NANDFS_IFMT) != NANDFS_IFDIR) {
                        nandfs_free_node(node);
                        node = NULL;
                        goto out;
@@ -710,7 +710,7 @@ nandfs_lookup_path(struct nandfs *fs, const char *path
                NANDFS_DEBUG("%s: %.*s has mode %o\n", __func__,
                    dirent->name_len, dirent->name, node->inode->i_mode);
 
-               if ((node->inode->i_mode & IFMT) == IFLNK) {
+               if ((node->inode->i_mode & NANDFS_IFMT) == NANDFS_IFLNK) {
                        NANDFS_DEBUG("%s: %.*s is symlink\n",
                            __func__, dirent->name_len, dirent->name);
                        link_len = node->inode->i_size;

Modified: head/stand/libsa/ufs.c
==============================================================================
--- head/stand/libsa/ufs.c      Sat Mar 17 01:40:09 2018        (r331082)
+++ head/stand/libsa/ufs.c      Sat Mar 17 01:48:27 2018        (r331083)
@@ -557,7 +557,7 @@ ufs_open(upath, f)
                /*
                 * Check that current node is a directory.
                 */
-               if ((DIP(fp, di_mode) & IFMT) != IFDIR) {
+               if ((DIP(fp, di_mode) & UFS_IFMT) != UFS_IFDIR) {
                        rc = ENOTDIR;
                        goto out;
                }
@@ -599,7 +599,7 @@ ufs_open(upath, f)
                /*
                 * Check for symbolic link.
                 */
-               if ((DIP(fp, di_mode) & IFMT) == IFLNK) {
+               if ((DIP(fp, di_mode) & UFS_IFMT) == UFS_IFLNK) {
                        int link_len = DIP(fp, di_size);
                        int len;
 

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c     Sat Mar 17 01:40:09 2018        
(r331082)
+++ head/sys/fs/ext2fs/ext2_alloc.c     Sat Mar 17 01:48:27 2018        
(r331083)
@@ -393,7 +393,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred 
         * ext2_dirpref else obtain it using ino_to_cg. The preferred inode is
         * always the next inode.
         */
-       if ((mode & IFMT) == IFDIR) {
+       if ((mode & EXT2_IFMT) == EXT2_IFDIR) {
                cg = ext2_dirpref(pip);
                if (fs->e2fs_contigdirs[cg] < 255)
                        fs->e2fs_contigdirs[cg]++;
@@ -1290,7 +1290,7 @@ gotit:
                    e2fs_gd_get_i_unused(&fs->e2fs_gd[cg]) - 1);
        fs->e2fs->e2fs_ficount--;
        fs->e2fs_fmod = 1;
-       if ((mode & IFMT) == IFDIR) {
+       if ((mode & EXT2_IFMT) == EXT2_IFDIR) {
                e2fs_gd_set_ndirs(&fs->e2fs_gd[cg],
                    e2fs_gd_get_ndirs(&fs->e2fs_gd[cg]) + 1);
                fs->e2fs_total_dir++;
@@ -1395,7 +1395,7 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode)
            EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM))
                e2fs_gd_set_i_unused(&fs->e2fs_gd[cg],
                    e2fs_gd_get_i_unused(&fs->e2fs_gd[cg]) + 1);
-       if ((mode & IFMT) == IFDIR) {
+       if ((mode & EXT2_IFMT) == EXT2_IFDIR) {
                e2fs_gd_set_ndirs(&fs->e2fs_gd[cg],
                    e2fs_gd_get_ndirs(&fs->e2fs_gd[cg]) - 1);
                fs->e2fs_total_dir--;

Modified: head/sys/fs/ext2fs/ext2_dinode.h
==============================================================================
--- head/sys/fs/ext2fs/ext2_dinode.h    Sat Mar 17 01:40:09 2018        
(r331082)
+++ head/sys/fs/ext2fs/ext2_dinode.h    Sat Mar 17 01:48:27 2018        
(r331083)
@@ -105,7 +105,7 @@
  * Structure of an inode on the disk
  */
 struct ext2fs_dinode {
-       uint16_t        e2di_mode;      /*   0: IFMT, permissions; see below. */
+       uint16_t        e2di_mode;      /*   0: EXT2_IFMT, permissions; below.*/
        uint16_t        e2di_uid;       /*   2: Owner UID */
        uint32_t        e2di_size;      /*   4: Size (in bytes) */
        uint32_t        e2di_atime;     /*   8: Access time */

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_lookup.c    Sat Mar 17 01:40:09 2018        
(r331082)
+++ head/sys/fs/ext2fs/ext2_lookup.c    Sat Mar 17 01:48:27 2018        
(r331083)
@@ -591,7 +591,7 @@ found:
                 * may not delete it (unless she's root). This
                 * implements append-only directories.
                 */
-               if ((dp->i_mode & ISVTX) &&
+               if ((dp->i_mode & EXT2_ISVTX) &&
                    cred->cr_uid != 0 &&
                    cred->cr_uid != dp->i_uid &&
                    VTOI(tdp)->i_uid != cred->cr_uid) {

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c     Sat Mar 17 01:40:09 2018        
(r331082)
+++ head/sys/fs/ext2fs/ext2_vnops.c     Sat Mar 17 01:48:27 2018        
(r331083)
@@ -352,7 +352,7 @@ ext2_getattr(struct vop_getattr_args *ap)
         */
        vap->va_fsid = dev2udev(ip->i_devvp->v_rdev);
        vap->va_fileid = ip->i_number;
-       vap->va_mode = ip->i_mode & ~IFMT;
+       vap->va_mode = ip->i_mode & ~EXT2_IFMT;
        vap->va_nlink = ip->i_nlink;
        vap->va_uid = ip->i_uid;
        vap->va_gid = ip->i_gid;
@@ -534,7 +534,7 @@ ext2_chmod(struct vnode *vp, int mode, struct ucred *c
                if (error)
                        return (EFTYPE);
        }
-       if (!groupmember(ip->i_gid, cred) && (mode & ISGID)) {
+       if (!groupmember(ip->i_gid, cred) && (mode & EXT2_ISGID)) {
                error = priv_check_cred(cred, PRIV_VFS_SETGID, 0);
                if (error)
                        return (error);
@@ -584,9 +584,10 @@ ext2_chown(struct vnode *vp, uid_t uid, gid_t gid, str
        ip->i_gid = gid;
        ip->i_uid = uid;
        ip->i_flag |= IN_CHANGE;
-       if ((ip->i_mode & (ISUID | ISGID)) && (ouid != uid || ogid != gid)) {
+       if ((ip->i_mode & (EXT2_ISUID | EXT2_ISGID)) &&
+           (ouid != uid || ogid != gid)) {
                if (priv_check_cred(cred, PRIV_VFS_RETAINSUGID, 0) != 0)
-                       ip->i_mode &= ~(ISUID | ISGID);
+                       ip->i_mode &= ~(EXT2_ISUID | EXT2_ISGID);
        }
        return (0);
 }
@@ -843,7 +844,7 @@ abortit:
                error = EPERM;
                goto abortit;
        }
-       if ((ip->i_mode & IFMT) == IFDIR) {
+       if ((ip->i_mode & EXT2_IFMT) == EXT2_IFDIR) {
                /*
                 * Avoid ".", "..", and aliases of "." for obvious reasons.
                 */
@@ -974,7 +975,7 @@ abortit:
                 * to it. Also, ensure source and target are compatible
                 * (both directories, or both not directories).
                 */
-               if ((xp->i_mode & IFMT) == IFDIR) {
+               if ((xp->i_mode & EXT2_IFMT) == EXT2_IFDIR) {
                        if (!ext2_dirempty(xp, dp->i_number, tcnp->cn_cred)) {
                                error = ENOTEMPTY;
                                goto bad;
@@ -1318,7 +1319,7 @@ ext2_mkdir(struct vop_mkdir_args *ap)
                goto out;
        }
        dmode = vap->va_mode & 0777;
-       dmode |= IFDIR;
+       dmode |= EXT2_IFDIR;
        /*
         * Must simulate part of ext2_makeinode here to acquire the inode,
         * but not have it entered in the parent directory. The entry is
@@ -1341,8 +1342,8 @@ ext2_mkdir(struct vop_mkdir_args *ap)
                 * 'give it away' so that the SUID is still forced on.
                 */
                if ((dvp->v_mount->mnt_flag & MNT_SUIDDIR) &&
-                   (dp->i_mode & ISUID) && dp->i_uid) {
-                       dmode |= ISUID;
+                   (dp->i_mode & EXT2_ISUID) && dp->i_uid) {
+                       dmode |= EXT2_ISUID;
                        ip->i_uid = dp->i_uid;
                } else {
                        ip->i_uid = cnp->cn_cred->cr_uid;
@@ -1521,7 +1522,7 @@ ext2_symlink(struct vop_symlink_args *ap)
        struct inode *ip;
        int len, error;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to