]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
switch xfs to use linux imode flags internally
authorSteve Lord <lord@sgi.com>
Tue, 7 Oct 2003 21:21:25 +0000 (21:21 +0000)
committerSteve Lord <lord@sgi.com>
Tue, 7 Oct 2003 21:21:25 +0000 (21:21 +0000)
14 files changed:
db/check.c
db/frag.c
db/inode.c
include/xfs_dinode.h
include/xfs_inode.h
libxfs/util.c
libxfs/xfs_bmap.c
libxfs/xfs_dir.c
libxfs/xfs_dir2.c
libxfs/xfs_inode.c
logprint/log_misc.c
mkfs/proto.c
repair/dinode.c
repair/phase6.c

index b910fafe031cee2e4de3975c5ac8cef9cbf63960..a84888718dbd15de50ecd885615bee7aa285e94b 100644 (file)
@@ -2654,11 +2654,11 @@ process_inode(
        /*
         * di_mode is a 16-bit uint so no need to check the < 0 case
         */
-       if ((((dic->di_mode & IFMT) >> 12) > 15) ||
-           (!(okfmts[(dic->di_mode & IFMT) >> 12] & (1 << dic->di_format)))) {
+       if ((((dic->di_mode & S_IFMT) >> 12) > 15) ||
+           (!(okfmts[(dic->di_mode & S_IFMT) >> 12] & (1 << dic->di_format)))) {
                if (!sflag || id->ilist || CHECK_BLIST(bno))
                        dbprintf("bad format %d for inode %lld type %#o\n",
-                               dic->di_format, id->ino, dic->di_mode & IFMT);
+                               dic->di_format, id->ino, dic->di_mode & S_IFMT);
                error++;
                return;
        }
@@ -2693,14 +2693,14 @@ process_inode(
                        dic->di_flags & XFS_DIFLAG_NOATIME  ? " noa" : "",
                        dic->di_flags & XFS_DIFLAG_NODUMP   ? " nod" : "");
        security = 0;
-       switch (dic->di_mode & IFMT) {
-       case IFDIR:
+       switch (dic->di_mode & S_IFMT) {
+       case S_IFDIR:
                type = DBM_DIR;
                if (dic->di_format == XFS_DINODE_FMT_LOCAL)
                        break;
                blkmap = blkmap_alloc(dic->di_nextents);
                break;
-       case IFREG:
+       case S_IFREG:
                if (dic->di_flags & XFS_DIFLAG_REALTIME)
                        type = DBM_RTDATA;
                else if (id->ino == mp->m_sb.sb_rbmino) {
@@ -2720,10 +2720,10 @@ process_inode(
                }
                else
                        type = DBM_DATA;
-               if (dic->di_mode & (ISUID | ISGID))
+               if (dic->di_mode & (S_ISUID | S_ISGID))
                        security = 1;
                break;
-       case IFLNK:
+       case S_IFLNK:
                type = DBM_SYMLINK;
                break;
        default:
index 467fa8cb31c8d35d41881c8db40524aa2e44830e..10d8a849bd8b812abe8a0ecc9faec8a524fb5ef7 100644 (file)
--- a/db/frag.c
+++ b/db/frag.c
@@ -337,11 +337,11 @@ process_inode(
 
        dic = &dip->di_core;
        ino = XFS_AGINO_TO_INO(mp, INT_GET(agf->agf_seqno, ARCH_CONVERT), agino);
-       switch (dic->di_mode & IFMT) {
-       case IFDIR:
+       switch (dic->di_mode & S_IFMT) {
+       case S_IFDIR:
                skipd = !dflag;
                break;
-       case IFREG:
+       case S_IFREG:
                if (!rflag && (dic->di_flags & XFS_DIFLAG_REALTIME))
                        skipd = 1;
                else if (!Rflag &&
@@ -355,7 +355,7 @@ process_inode(
                else
                        skipd = !fflag;
                break;
-       case IFLNK:
+       case S_IFLNK:
                skipd = !lflag;
                break;
        default:
index c15eb83c265af7e1a3296328a73913b99f542e61..604cea191824630c026135fadde5dfc92d80a689 100644 (file)
@@ -390,12 +390,12 @@ inode_init(void)
 typnm_t
 inode_next_type(void)
 {
-       switch (iocur_top->mode & IFMT) {
-       case IFDIR:
+       switch (iocur_top->mode & S_IFMT) {
+       case S_IFDIR:
                return XFS_DIR_IS_V2(mp) ? TYP_DIR2 : TYP_DIR;
-       case IFLNK:
+       case S_IFLNK:
                return TYP_SYMLINK;
-       case IFREG:
+       case S_IFREG:
                if (iocur_top->ino == mp->m_sb.sb_rbmino)
                        return TYP_RTBITMAP;
                else if (iocur_top->ino == mp->m_sb.sb_rsumino)
@@ -460,7 +460,7 @@ inode_u_c_count(
        dip = obj;
        ASSERT((char *)&dip->di_u - (char *)dip == byteize(startoff));
        return INT_GET(dip->di_core.di_format, ARCH_CONVERT) == XFS_DINODE_FMT_LOCAL &&
-              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & IFMT) == IFREG ?
+              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFREG ?
                (int)INT_GET(dip->di_core.di_size, ARCH_CONVERT) : 0;
 }
 
@@ -504,7 +504,7 @@ inode_u_sfdir_count(
        dip = obj;
        ASSERT((char *)&dip->di_u - (char *)dip == byteize(startoff));
        return INT_GET(dip->di_core.di_format, ARCH_CONVERT) == XFS_DINODE_FMT_LOCAL &&
-              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & IFMT) == IFDIR
+              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFDIR
               && XFS_DIR_IS_V1(mp);
 }
 
@@ -520,7 +520,7 @@ inode_u_sfdir2_count(
        dip = obj;
        ASSERT((char *)&dip->di_u - (char *)dip == byteize(startoff));
        return INT_GET(dip->di_core.di_format, ARCH_CONVERT) == XFS_DINODE_FMT_LOCAL &&
-              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & IFMT) == IFDIR &&
+              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFDIR &&
               XFS_DIR_IS_V2(mp);
 }
 
@@ -563,7 +563,7 @@ inode_u_symlink_count(
        dip = obj;
        ASSERT((char *)&dip->di_u - (char *)dip == byteize(startoff));
        return INT_GET(dip->di_core.di_format, ARCH_CONVERT) == XFS_DINODE_FMT_LOCAL &&
-              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & IFMT) == IFLNK ?
+              (INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFLNK ?
                (int)INT_GET(dip->di_core.di_size, ARCH_CONVERT) : 0;
 }
 
@@ -601,7 +601,7 @@ set_cur_inode(
        dip = iocur_top->data;
        iocur_top->ino = ino;
        iocur_top->mode = INT_GET(dip->di_core.di_mode, ARCH_CONVERT);
-       if ((iocur_top->mode & IFMT) == IFDIR)
+       if ((iocur_top->mode & S_IFMT) == S_IFDIR)
                iocur_top->dirino = ino;
 
        /* track updated info in ring */
index 69a2ca652b83ab31336fb2a2b8f2aac0ccdeaf31..e0b529b337d9264f6b3b9792b3d2eb0298b787cd 100644 (file)
@@ -107,7 +107,7 @@ typedef struct xfs_dinode
                xfs_dir_shortform_t di_dirsf;   /* shortform directory */
                xfs_dir2_sf_t   di_dir2sf;      /* shortform directory v2 */
                char            di_c[1];        /* local contents */
-               xfs_dev_t       di_dev;         /* device for IFCHR/IFBLK */
+               xfs_dev_t       di_dev;         /* device for S_IFCHR/S_IFBLK */
                uuid_t          di_muuid;       /* mount point value */
                char            di_symlink[1];  /* local symbolic link */
        }               di_u;
@@ -436,25 +436,6 @@ void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n);
 
 #endif
 
-/*
- * File types (mode field)
- */
-#define        IFMT            S_IFMT
-#define        IFSOCK          S_IFSOCK
-#define        IFLNK           S_IFLNK
-#define        IFREG           S_IFREG
-#define        IFBLK           S_IFBLK
-#define        IFDIR           S_IFDIR
-#define        IFCHR           S_IFCHR
-#define        IFIFO           S_IFIFO
-
-#define        ISUID           S_ISUID
-#define        ISGID           S_ISGID
-#define        ISVTX           S_ISVTX
-#define        IREAD           S_IRUSR
-#define        IWRITE          S_IWUSR
-#define        IEXEC           S_IXUSR
-
 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE)
 xfs_dinode_t *xfs_buf_to_dinode(struct xfs_buf *bp);
 #define        XFS_BUF_TO_DINODE(bp)   xfs_buf_to_dinode(bp)
index 9994dd6072b0acb0779ddefd52d92a732a2930c1..8099e702516d45e92b8f9d70da84bafa6854440f 100644 (file)
@@ -179,7 +179,7 @@ typedef struct xfs_ihash {
  * Inode hashing and hash bucket locking.
  */
 #define XFS_BUCKETS(mp) (37*(mp)->m_sb.sb_agcount-1)
-#define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)ino) % (mp)->m_ihsize))
+#define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)(ino)) % (mp)->m_ihsize))
 
 /*
  * This is the xfs inode cluster hash.  This hash is used by xfs_iflush to
@@ -264,6 +264,8 @@ typedef struct xfs_inode {
        sema_t                  i_flock;        /* inode flush lock */
        atomic_t                i_pincount;     /* inode pin count */
        wait_queue_head_t       i_ipin_wait;    /* inode pinning wait queue */
+       struct xfs_inode        **i_refcache;   /* ptr to entry in ref cache */
+       struct xfs_inode        *i_release;     /* inode to unref */
 
        /* I/O state */
        xfs_iocore_t            i_iocore;       /* I/O core */
@@ -362,7 +364,8 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
 #define XFS_IUIOSZ     0x0002  /* inode i/o sizes have been explicitly set */
 #define XFS_IQUIESCE    0x0004  /* we have started quiescing for this inode */
 #define XFS_IRECLAIM    0x0008  /* we have started reclaiming this inode    */
-#define XFS_IRECLAIMABLE 0x0010 /* inode can be reclaimed */
+#define XFS_ISTALE     0x0010  /* inode has been staled */
+#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */
 
 /*
  * Flags for inode locking.
@@ -437,12 +440,12 @@ xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
 #define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
 
 /*
- * For multiple groups support: if ISGID bit is set in the parent
+ * For multiple groups support: if S_ISGID bit is set in the parent
  * directory, group of new file is set to that of the parent, and
- * new subdirectory gets ISGID bit from parent.
+ * new subdirectory gets S_ISGID bit from parent.
  */
 #define XFS_INHERIT_GID(pip, vfsp)     ((pip) != NULL && \
-       (((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & ISGID)))
+       (((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & S_ISGID)))
 
 /*
  * xfs_iget.c prototypes.
@@ -487,7 +490,8 @@ int         xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t,
                           struct xfs_buf **, boolean_t *, xfs_inode_t **);
 void           xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, int,
                           xfs_arch_t);
-int            xfs_ifree(struct xfs_trans *, xfs_inode_t *);
+int            xfs_ifree(struct xfs_trans *, xfs_inode_t *,
+                          struct xfs_bmap_free *);
 int            xfs_atruncate_start(xfs_inode_t *);
 void           xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
 int            xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
index 84a4ed68630ea51e88ff593358ad90dc39e5fc10..f1f338a86969c6fbf8779a854dddfde81f98dac4 100644 (file)
@@ -199,18 +199,18 @@ libxfs_ialloc(
        ip->i_d.di_dmstate = 0;
        ip->i_d.di_flags = 0;
        flags = XFS_ILOG_CORE;
-       switch (mode & IFMT) {
-       case IFIFO:
-       case IFCHR:
-       case IFBLK:
-       case IFSOCK:
+       switch (mode & S_IFMT) {
+       case S_IFIFO:
+       case S_IFCHR:
+       case S_IFBLK:
+       case S_IFSOCK:
                ip->i_d.di_format = XFS_DINODE_FMT_DEV;
                ip->i_df.if_u2.if_rdev = makedev(major(rdev), minor(rdev));                     ip->i_df.if_flags = 0;
                flags |= XFS_ILOG_DEV;
                break;
-       case IFREG:
-       case IFDIR:
-       case IFLNK:
+       case S_IFREG:
+       case S_IFDIR:
+       case S_IFLNK:
                ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
                ip->i_df.if_flags = XFS_IFEXTENTS;
                ip->i_df.if_bytes = ip->i_df.if_real_bytes = 0;
@@ -318,11 +318,11 @@ libxfs_iflush_int(xfs_inode_t *ip, xfs_buf_t *bp)
 
 #ifdef DEBUG
        ASSERT(ip->i_d.di_magic == XFS_DINODE_MAGIC);
-       if ((ip->i_d.di_mode & IFMT) == IFREG) {
+       if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
                ASSERT( (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS) ||
                        (ip->i_d.di_format == XFS_DINODE_FMT_BTREE) );
        }
-       else if ((ip->i_d.di_mode & IFMT) == IFDIR) {
+       else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
                ASSERT( (ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS) ||
                        (ip->i_d.di_format == XFS_DINODE_FMT_BTREE)   ||
                        (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) );
@@ -441,7 +441,7 @@ xfs_dir_bogus_removename(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
        xfs_da_args_t args;
        int count, totallen, newsize, retval;
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        if (namelen >= MAXNAMELEN) {
                return EINVAL;
        }
@@ -503,7 +503,7 @@ xfs_dir2_bogus_removename(
        int             rval;           /* return value */
        int             v;              /* type-checking value */
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        if (namelen >= MAXNAMELEN)
                return EINVAL;
 
index 9bef13752c7da6aa50a8c92b68fa159fb7cc89cb..5042c45c09ea2c8907cb4cac6dd6011a02e789b6 100644 (file)
@@ -2851,7 +2851,7 @@ xfs_bmap_local_to_extents(
         * We don't want to deal with the case of keeping inode data inline yet.
         * So sending the data fork of a regular inode is invalid.
         */
-       ASSERT(!((ip->i_d.di_mode & IFMT) == IFREG &&
+       ASSERT(!((ip->i_d.di_mode & S_IFMT) == S_IFREG &&
                 whichfork == XFS_DATA_FORK));
        ifp = XFS_IFORK_PTR(ip, whichfork);
        ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL);
index d6460c016314e49781b651356fb5830e132c6499..ba6561f045b5731b0a8b20ffb7d4b0bf045e2917 100644 (file)
@@ -90,7 +90,7 @@ xfs_dir_init(xfs_trans_t *trans, xfs_inode_t *dir, xfs_inode_t *parent_dir)
        args.dp = dir;
        args.trans = trans;
 
-       ASSERT((dir->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dir->i_d.di_mode & S_IFMT) == S_IFDIR);
        if ((error = xfs_dir_ino_validate(trans->t_mountp, parent_dir->i_ino)))
                return error;
 
@@ -109,7 +109,7 @@ xfs_dir_createname(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
        xfs_da_args_t args;
        int retval, newsize, done;
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
 
        if ((retval = xfs_dir_ino_validate(trans->t_mountp, inum)))
                return (retval);
@@ -175,7 +175,7 @@ xfs_dir_removename(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
        xfs_da_args_t args;
        int count, totallen, newsize, retval;
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        XFS_STATS_INC(xs_dir_remove);
        /*
         * Fill in the arg structure for this request.
@@ -218,7 +218,7 @@ xfs_dir_lookup(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
        xfs_da_args_t args;
        int retval;
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
 
        XFS_STATS_INC(xs_dir_lookup);
        /*
@@ -261,7 +261,7 @@ xfs_dir_replace(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
        xfs_da_args_t args;
        int retval;
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
 
        if ((retval = xfs_dir_ino_validate(trans->t_mountp, inum)))
                return retval;
index 0f8166c50ea46136f6265ea6d6fe249cb530615e..8adfb01211720710889a45852c2a45f72174355c 100644 (file)
@@ -77,7 +77,7 @@ xfs_dir2_init(
        memset((char *)&args, 0, sizeof(args));
        args.dp = dp;
        args.trans = tp;
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) {
                return error;
        }
@@ -102,7 +102,7 @@ xfs_dir2_createname(
        int                     rval;           /* return value */
        int                     v;              /* type-checking value */
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) {
                return rval;
        }
@@ -155,7 +155,7 @@ xfs_dir2_lookup(
        int             rval;           /* return value */
        int             v;              /* type-checking value */
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        XFS_STATS_INC(xs_dir_lookup);
 
        /*
@@ -213,7 +213,7 @@ xfs_dir2_removename(
        int             rval;           /* return value */
        int             v;              /* type-checking value */
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
        XFS_STATS_INC(xs_dir_remove);
        /*
         * Fill in the arg structure for this request.
@@ -265,7 +265,7 @@ xfs_dir2_replace(
        int             rval;           /* return value */
        int             v;              /* type-checking value */
 
-       ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
+       ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
 
        if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) {
                return rval;
index 86ec75bb7aff2dbefe675fde4571ca821c9aa912..98349abd63800e416680a5dcfcebefaf82314d3a 100644 (file)
@@ -263,11 +263,11 @@ xfs_iformat(
                return XFS_ERROR(EFSCORRUPTED);
        }
 
-       switch (ip->i_d.di_mode & IFMT) {
-       case IFIFO:
-       case IFCHR:
-       case IFBLK:
-       case IFSOCK:
+       switch (ip->i_d.di_mode & S_IFMT) {
+       case S_IFIFO:
+       case S_IFCHR:
+       case S_IFBLK:
+       case S_IFSOCK:
                if (unlikely(INT_GET(dip->di_core.di_format, ARCH_CONVERT) != XFS_DINODE_FMT_DEV)) {
                        XFS_CORRUPTION_ERROR("xfs_iformat(3)", XFS_ERRLEVEL_LOW,
                                              ip->i_mount, dip);
@@ -277,15 +277,15 @@ xfs_iformat(
                ip->i_df.if_u2.if_rdev = INT_GET(dip->di_u.di_dev, ARCH_CONVERT);
                break;
 
-       case IFREG:
-       case IFLNK:
-       case IFDIR:
+       case S_IFREG:
+       case S_IFLNK:
+       case S_IFDIR:
                switch (INT_GET(dip->di_core.di_format, ARCH_CONVERT)) {
                case XFS_DINODE_FMT_LOCAL:
                        /*
                         * no local regular files yet
                         */
-                       if (unlikely((INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & IFMT) == IFREG)) {
+                       if (unlikely((INT_GET(dip->di_core.di_mode, ARCH_CONVERT) & S_IFMT) == S_IFREG)) {
                                xfs_fs_cmn_err(CE_WARN, ip->i_mount,
                                        "corrupt inode (local format for regular file) %Lu.  Unmount and run xfs_repair.",
                                        (unsigned long long) ip->i_ino);
index 88252571007d80464770a7ade6af7c7ad7e558af..c691d628d60ca7f6ea8d44fca7e15e4e47104bb3 100644 (file)
@@ -689,7 +689,7 @@ xlog_print_trans_inode(xfs_caddr_t *ptr, int len, int *i, int num_ops)
     }
 
     bcopy(*ptr, &dino, sizeof(dino));
-    mode = dino.di_mode & IFMT;
+    mode = dino.di_mode & S_IFMT;
     size = (int)dino.di_size;
     xlog_print_trans_inode_core(&dino);
     *ptr += sizeof(xfs_dinode_core_t);
@@ -728,7 +728,7 @@ xlog_print_trans_inode(xfs_caddr_t *ptr, int len, int *i, int num_ops)
            (*i)++;
            xlog_print_op_header(op_head, *i, ptr);
            printf("LOCAL inode data\n");
-           if (mode == IFDIR) {
+           if (mode == S_IFDIR) {
                xlog_print_dir_sf((xfs_dir_shortform_t*)*ptr, size);
            }
            *ptr += INT_GET(op_head->oh_len, ARCH_CONVERT);
@@ -764,7 +764,7 @@ xlog_print_trans_inode(xfs_caddr_t *ptr, int len, int *i, int num_ops)
            (*i)++;
            xlog_print_op_header(op_head, *i, ptr);
            printf("LOCAL inode attr\n");
-           if (mode == IFDIR) {
+           if (mode == S_IFDIR) {
                xlog_print_dir_sf((xfs_dir_shortform_t*)*ptr, size);
            }
            *ptr += INT_GET(op_head->oh_len, ARCH_CONVERT);
index 9ada4abc0caa81ee5245d16bad1438faa6651ed0..f81511356ee7b8c3b9032f052cc42ecbe721a2e4 100644 (file)
@@ -206,17 +206,17 @@ rsvfile(
        libxfs_trans_ijoin(tp, ip, 0);
        libxfs_trans_ihold(tp, ip);
 
-       ip->i_d.di_mode &= ~ISUID;
+       ip->i_d.di_mode &= ~S_ISUID;
 
        /*
         * Note that we don't have to worry about mandatory
         * file locking being disabled here because we only
-        * clear the ISGID bit if the Group execute bit is
+        * clear the S_ISGID bit if the Group execute bit is
         * on, but if it was on then mandatory locking wouldn't
         * have been enabled.
         */
-       if (ip->i_d.di_mode & (IEXEC >> 3))
-               ip->i_d.di_mode &= ~ISGID;
+       if (ip->i_d.di_mode & S_IXGRP)
+               ip->i_d.di_mode &= ~S_ISGID;
 
        libxfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
 
@@ -426,7 +426,7 @@ parseproto(
        case '-':
                break;
        case 'u':
-               mode |= ISUID;
+               mode |= S_ISUID;
                break;
        default:
                fprintf(stderr, _("%s: bad format string %s\n"),
@@ -437,7 +437,7 @@ parseproto(
        case '-':
                break;
        case 'g':
-               mode |= ISGID;
+               mode |= S_ISGID;
                break;
        default:
                fprintf(stderr, _("%s: bad format string %s\n"),
@@ -463,7 +463,7 @@ parseproto(
        case IF_REGULAR:
                buf = newregfile(pp, &len);
                getres(tp, XFS_B_TO_FSB(mp, len));
-               error = libxfs_inode_alloc(&tp, pip, mode|IFREG, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1,
                                        mp->m_dev, &creds, &ip);
                if (error)
                        fail(_("Inode allocation failed"), error);
@@ -481,7 +481,7 @@ parseproto(
                llen = cvtnum(mp->m_sb.sb_blocksize, mp->m_sb.sb_sectsize, value);
                getres(tp, XFS_B_TO_FSB(mp, llen));
 
-               error = libxfs_inode_alloc(&tp, pip, mode|IFREG, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1,
                                                mp->m_dev, &creds, &ip);
                if (error)
                        fail(_("Inode pre-allocation failed"), error);
@@ -504,7 +504,7 @@ parseproto(
                getres(tp, 0);
                majdev = (int)getnum(pp);
                mindev = (int)getnum(pp);
-               error = libxfs_inode_alloc(&tp, pip, mode|IFBLK, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1,
                                makedev(majdev, mindev), &creds, &ip);
                if (error) {
                        fail(_("Inode allocation failed"), error);
@@ -520,7 +520,7 @@ parseproto(
                getres(tp, 0);
                majdev = (int)getnum(pp);
                mindev = (int)getnum(pp);
-               error = libxfs_inode_alloc(&tp, pip, mode|IFCHR, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1,
                                makedev(majdev, mindev), &creds, &ip);
                if (error)
                        fail(_("Inode allocation failed"), error);
@@ -533,7 +533,7 @@ parseproto(
 
        case IF_FIFO:
                getres(tp, 0);
-               error = libxfs_inode_alloc(&tp, pip, mode|IFIFO, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1,
                                mp->m_dev, &creds, &ip);
                if (error)
                        fail(_("Inode allocation failed"), error);
@@ -546,7 +546,7 @@ parseproto(
                buf = getstr(pp);
                len = (int)strlen(buf);
                getres(tp, XFS_B_TO_FSB(mp, len));
-               error = libxfs_inode_alloc(&tp, pip, mode|IFLNK, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1,
                                mp->m_dev, &creds, &ip);
                if (error)
                        fail(_("Inode allocation failed"), error);
@@ -558,7 +558,7 @@ parseproto(
                break;
        case IF_DIRECTORY:
                getres(tp, 0);
-               error = libxfs_inode_alloc(&tp, pip, mode|IFDIR, 1,
+               error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1,
                                mp->m_dev, &creds, &ip);
                if (error)
                        fail(_("Inode allocation failed"), error);
@@ -642,7 +642,7 @@ rtinit(
        if ((i = libxfs_trans_reserve(tp, MKFS_BLOCKRES_INODE, 0, 0, 0, 0)))
                res_failed(i);
        bzero(&creds, sizeof(creds));
-       error = libxfs_inode_alloc(&tp, mp->m_rootip, IFREG, 1,
+       error = libxfs_inode_alloc(&tp, mp->m_rootip, S_IFREG, 1,
                                mp->m_dev, &creds, &rbmip);
        if (error) {
                fail(_("Realtime bitmap inode allocation failed"), error);
@@ -660,7 +660,7 @@ rtinit(
        libxfs_mod_sb(tp, XFS_SB_RBMINO);
        libxfs_trans_ihold(tp, rbmip);
        mp->m_rbmip = rbmip;
-       error = libxfs_inode_alloc(&tp, mp->m_rootip, IFREG, 1,
+       error = libxfs_inode_alloc(&tp, mp->m_rootip, S_IFREG, 1,
                                mp->m_dev, &creds, &rsumip);
        if (error) {
                fail(_("Realtime summary inode allocation failed"), error);
index c42cba09ef97752ca90eb1e1be3e6e28fe39e26f..9d7f96ab045bcef761cc9b1e2b4e3202a48bbc36 100644 (file)
@@ -1914,10 +1914,10 @@ process_dinode_int(xfs_mount_t *mp,
         * as we reset the inode when we re-use it.
         */
        if (INT_GET(dinoc->di_mode, ARCH_CONVERT) != 0 &&
-               ((((INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT) >> 12) > 15) ||
+               ((((INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT) >> 12) > 15) ||
                dinoc->di_format < XFS_DINODE_FMT_DEV ||
                dinoc->di_format > XFS_DINODE_FMT_UUID ||
-                       (!(okfmts[(INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT) >> 12] &
+                       (!(okfmts[(INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT) >> 12] &
                          (1 << dinoc->di_format))))) {
                /* bad inode format */
                retval++;
@@ -1951,12 +1951,12 @@ process_dinode_int(xfs_mount_t *mp,
 
        /* set type and map type info */
 
-       switch (INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT) {
-       case IFDIR:
+       switch (INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT) {
+       case S_IFDIR:
                type = XR_INO_DIR;
                *isa_dir = 1;
                break;
-       case IFREG:
+       case S_IFREG:
                if (INT_GET(dinoc->di_flags, ARCH_CONVERT) & XFS_DIFLAG_REALTIME)
                        type = XR_INO_RTDATA;
                else if (lino == mp->m_sb.sb_rbmino)
@@ -1966,25 +1966,25 @@ process_dinode_int(xfs_mount_t *mp,
                else
                        type = XR_INO_DATA;
                break;
-       case IFLNK:
+       case S_IFLNK:
                type = XR_INO_SYMLINK;
                break;
-       case IFCHR:
+       case S_IFCHR:
                type = XR_INO_CHRDEV;
                break;
-       case IFBLK:
+       case S_IFBLK:
                type = XR_INO_BLKDEV;
                break;
-       case IFSOCK:
+       case S_IFSOCK:
                type = XR_INO_SOCK;
                break;
-       case IFIFO:
+       case S_IFIFO:
                type = XR_INO_FIFO;
                break;
        default:
                type = XR_INO_UNKNOWN;
                do_warn(_("Unexpected inode type %#o inode %llu\n"),
-                       (int) (INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT), lino);
+                       (int) (INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT), lino);
                abort();
                break;
        }
@@ -1999,9 +1999,9 @@ process_dinode_int(xfs_mount_t *mp,
                if (!no_modify)  {
                        do_warn(_("resetting to directory\n"));
                        INT_MOD_EXPR(dinoc->di_mode, ARCH_CONVERT,
-                         &= ~(INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT));
+                         &= ~(INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT));
                        INT_MOD_EXPR(dinoc->di_mode, ARCH_CONVERT,
-                         |= INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFDIR);
+                         |= INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFDIR);
                } else  {
                        do_warn(_("would reset to directory\n"));
                }
@@ -2016,7 +2016,7 @@ process_dinode_int(xfs_mount_t *mp,
        } else if (lino == mp->m_sb.sb_uquotino)  {
                if (type != XR_INO_DATA)  {
                        do_warn(_("user quota inode has bad type 0x%x\n"),
-                               INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT);
+                               INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT);
 
                        if (!no_modify)  {
                                *dirty += clear_dinode(mp, dino, lino);
@@ -2034,7 +2034,7 @@ process_dinode_int(xfs_mount_t *mp,
        } else if (lino == mp->m_sb.sb_gquotino)  {
                if (type != XR_INO_DATA)  {
                        do_warn(_("group quota inode has bad type 0x%x\n"),
-                               INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT);
+                               INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT);
 
                        if (!no_modify)  {
                                *dirty += clear_dinode(mp, dino, lino);
@@ -2060,9 +2060,9 @@ process_dinode_int(xfs_mount_t *mp,
                if (!no_modify)  {
                        do_warn(_("resetting to regular file\n"));
                        INT_MOD_EXPR(dinoc->di_mode, ARCH_CONVERT,
-                         &= ~(INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFMT));
+                         &= ~(INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFMT));
                        INT_MOD_EXPR(dinoc->di_mode, ARCH_CONVERT,
-                         |= INT_GET(dinoc->di_mode, ARCH_CONVERT) & IFREG);
+                         |= INT_GET(dinoc->di_mode, ARCH_CONVERT) & S_IFREG);
                } else  {
                        do_warn(_("would reset to regular file\n"));
                }
index 53d90cae762c27e954cee149e386c52b629be604..79c9b5c7aab77e9f3bb02fe393d9c0d1fa941972 100644 (file)
@@ -357,7 +357,7 @@ mk_rbmino(xfs_mount_t *mp)
        bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
 
        ip->i_d.di_magic = XFS_DINODE_MAGIC;
-       ip->i_d.di_mode = IFREG;
+       ip->i_d.di_mode = S_IFREG;
        ip->i_d.di_version = XFS_DINODE_VERSION_1;
        ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
        ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
@@ -592,7 +592,7 @@ mk_rsumino(xfs_mount_t *mp)
        bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
 
        ip->i_d.di_magic = XFS_DINODE_MAGIC;
-       ip->i_d.di_mode = IFREG;
+       ip->i_d.di_mode = S_IFREG;
        ip->i_d.di_version = XFS_DINODE_VERSION_1;
        ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
        ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
@@ -690,7 +690,7 @@ mk_root_dir(xfs_mount_t *mp)
        bzero(&ip->i_d, sizeof(xfs_dinode_core_t));
 
        ip->i_d.di_magic = XFS_DINODE_MAGIC;
-       ip->i_d.di_mode = (__uint16_t) mode|IFDIR;
+       ip->i_d.di_mode = (__uint16_t) mode|S_IFDIR;
        ip->i_d.di_version = XFS_DINODE_VERSION_1;
        ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS;
        ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
@@ -752,7 +752,7 @@ mk_orphanage(xfs_mount_t *mp)
                do_error(_("%d - couldn't iget root inode to make %s\n"),
                        i, ORPHANAGE);
 
-       error = libxfs_inode_alloc(&tp, pip, mode|IFDIR,
+       error = libxfs_inode_alloc(&tp, pip, mode|S_IFDIR,
                                        1, mp->m_dev, &zerocr, &ip);
 
        if (error) {