Commit 42173f68 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Lachlan McIlroy

[XFS] Remove VN_IS* macros and related cruft.

We can just check i_mode / di_mode directly.

SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30896a
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent a01e035e
...@@ -25,12 +25,6 @@ struct attrlist_cursor_kern; ...@@ -25,12 +25,6 @@ struct attrlist_cursor_kern;
typedef struct inode bhv_vnode_t; typedef struct inode bhv_vnode_t;
#define VN_ISLNK(vp) S_ISLNK((vp)->i_mode)
#define VN_ISREG(vp) S_ISREG((vp)->i_mode)
#define VN_ISDIR(vp) S_ISDIR((vp)->i_mode)
#define VN_ISCHR(vp) S_ISCHR((vp)->i_mode)
#define VN_ISBLK(vp) S_ISBLK((vp)->i_mode)
/* /*
* Vnode to Linux inode mapping. * Vnode to Linux inode mapping.
*/ */
...@@ -151,24 +145,6 @@ typedef struct bhv_vattr { ...@@ -151,24 +145,6 @@ typedef struct bhv_vattr {
XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\ XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT) XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
/*
* Modes.
*/
#define VSUID S_ISUID /* set user id on execution */
#define VSGID S_ISGID /* set group id on execution */
#define VSVTX S_ISVTX /* save swapped text even after use */
#define VREAD S_IRUSR /* read, write, execute permissions */
#define VWRITE S_IWUSR
#define VEXEC S_IXUSR
#define MODEMASK S_IALLUGO /* mode bits plus permission bits */
/*
* Check whether mandatory file locking is enabled.
*/
#define MANDLOCK(vp, mode) \
(VN_ISREG(vp) && ((mode) & (VSGID|(VEXEC>>3))) == VSGID)
extern void vn_init(void); extern void vn_init(void);
extern int vn_revalidate(bhv_vnode_t *); extern int vn_revalidate(bhv_vnode_t *);
......
...@@ -72,7 +72,7 @@ xfs_acl_vhasacl_default( ...@@ -72,7 +72,7 @@ xfs_acl_vhasacl_default(
{ {
int error; int error;
if (!VN_ISDIR(vp)) if (!S_ISDIR(vp->i_mode))
return 0; return 0;
xfs_acl_get_attr(vp, NULL, _ACL_TYPE_DEFAULT, ATTR_KERNOVAL, &error); xfs_acl_get_attr(vp, NULL, _ACL_TYPE_DEFAULT, ATTR_KERNOVAL, &error);
return (error == 0); return (error == 0);
...@@ -379,7 +379,7 @@ xfs_acl_allow_set( ...@@ -379,7 +379,7 @@ xfs_acl_allow_set(
if (vp->i_flags & (S_IMMUTABLE|S_APPEND)) if (vp->i_flags & (S_IMMUTABLE|S_APPEND))
return EPERM; return EPERM;
if (kind == _ACL_TYPE_DEFAULT && !VN_ISDIR(vp)) if (kind == _ACL_TYPE_DEFAULT && !S_ISDIR(vp->i_mode))
return ENOTDIR; return ENOTDIR;
if (vp->i_sb->s_flags & MS_RDONLY) if (vp->i_sb->s_flags & MS_RDONLY)
return EROFS; return EROFS;
...@@ -719,7 +719,7 @@ xfs_acl_inherit( ...@@ -719,7 +719,7 @@ xfs_acl_inherit(
* If the new file is a directory, its default ACL is a copy of * If the new file is a directory, its default ACL is a copy of
* the containing directory's default ACL. * the containing directory's default ACL.
*/ */
if (VN_ISDIR(vp)) if (S_ISDIR(vp->i_mode))
xfs_acl_set_attr(vp, pdaclp, _ACL_TYPE_DEFAULT, &error); xfs_acl_set_attr(vp, pdaclp, _ACL_TYPE_DEFAULT, &error);
if (!error && !basicperms) if (!error && !basicperms)
xfs_acl_set_attr(vp, cacl, _ACL_TYPE_ACCESS, &error); xfs_acl_set_attr(vp, cacl, _ACL_TYPE_ACCESS, &error);
......
...@@ -211,7 +211,6 @@ xfs_setattr( ...@@ -211,7 +211,6 @@ xfs_setattr(
int flags, int flags,
cred_t *credp) cred_t *credp)
{ {
bhv_vnode_t *vp = XFS_ITOV(ip);
xfs_mount_t *mp = ip->i_mount; xfs_mount_t *mp = ip->i_mount;
xfs_trans_t *tp; xfs_trans_t *tp;
int mask; int mask;
...@@ -222,7 +221,6 @@ xfs_setattr( ...@@ -222,7 +221,6 @@ xfs_setattr(
gid_t gid=0, igid=0; gid_t gid=0, igid=0;
int timeflags = 0; int timeflags = 0;
xfs_prid_t projid=0, iprojid=0; xfs_prid_t projid=0, iprojid=0;
int mandlock_before, mandlock_after;
struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
int file_owner; int file_owner;
int need_iolock = 1; int need_iolock = 1;
...@@ -383,7 +381,7 @@ xfs_setattr( ...@@ -383,7 +381,7 @@ xfs_setattr(
m |= S_ISGID; m |= S_ISGID;
#if 0 #if 0
/* Linux allows this, Irix doesn't. */ /* Linux allows this, Irix doesn't. */
if ((vap->va_mode & S_ISVTX) && !VN_ISDIR(vp)) if ((vap->va_mode & S_ISVTX) && !S_ISDIR(ip->i_d.di_mode))
m |= S_ISVTX; m |= S_ISVTX;
#endif #endif
if (m && !capable(CAP_FSETID)) if (m && !capable(CAP_FSETID))
...@@ -461,10 +459,10 @@ xfs_setattr( ...@@ -461,10 +459,10 @@ xfs_setattr(
goto error_return; goto error_return;
} }
if (VN_ISDIR(vp)) { if (S_ISDIR(ip->i_d.di_mode)) {
code = XFS_ERROR(EISDIR); code = XFS_ERROR(EISDIR);
goto error_return; goto error_return;
} else if (!VN_ISREG(vp)) { } else if (!S_ISREG(ip->i_d.di_mode)) {
code = XFS_ERROR(EINVAL); code = XFS_ERROR(EINVAL);
goto error_return; goto error_return;
} }
...@@ -626,9 +624,6 @@ xfs_setattr( ...@@ -626,9 +624,6 @@ xfs_setattr(
xfs_trans_ihold(tp, ip); xfs_trans_ihold(tp, ip);
} }
/* determine whether mandatory locking mode changes */
mandlock_before = MANDLOCK(vp, ip->i_d.di_mode);
/* /*
* Truncate file. Must have write permission and not be a directory. * Truncate file. Must have write permission and not be a directory.
*/ */
...@@ -858,13 +853,6 @@ xfs_setattr( ...@@ -858,13 +853,6 @@ xfs_setattr(
code = xfs_trans_commit(tp, commit_flags); code = xfs_trans_commit(tp, commit_flags);
} }
/*
* If the (regular) file's mandatory locking mode changed, then
* notify the vnode. We do this under the inode lock to prevent
* racing calls to vop_vnode_change.
*/
mandlock_after = MANDLOCK(vp, ip->i_d.di_mode);
xfs_iunlock(ip, lock_flags); xfs_iunlock(ip, lock_flags);
/* /*
...@@ -1491,7 +1479,7 @@ xfs_release( ...@@ -1491,7 +1479,7 @@ xfs_release(
xfs_mount_t *mp = ip->i_mount; xfs_mount_t *mp = ip->i_mount;
int error; int error;
if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0)) if (!S_ISREG(ip->i_d.di_mode) || (ip->i_d.di_mode == 0))
return 0; return 0;
/* If this is a read-only mount, don't do this (would generate I/O) */ /* If this is a read-only mount, don't do this (would generate I/O) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment