aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-04-22 03:33:25 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-04-29 01:53:05 -0400
commit42173f6860af7e016a950a9a19a66679cfc46d98 (patch)
treeb0e6c8efae40909b235412ff1e23d0063ec9a6f6
parenta01e035ebb552223c03f2d9138ffc73f2d4d3965 (diff)
[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: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h24
-rw-r--r--fs/xfs/xfs_acl.c6
-rw-r--r--fs/xfs/xfs_vnodeops.c20
3 files changed, 7 insertions, 43 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 8b4d63ce8694..9d73cb5c0fc7 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -25,12 +25,6 @@ struct attrlist_cursor_kern;
25 25
26typedef struct inode bhv_vnode_t; 26typedef struct inode bhv_vnode_t;
27 27
28#define VN_ISLNK(vp) S_ISLNK((vp)->i_mode)
29#define VN_ISREG(vp) S_ISREG((vp)->i_mode)
30#define VN_ISDIR(vp) S_ISDIR((vp)->i_mode)
31#define VN_ISCHR(vp) S_ISCHR((vp)->i_mode)
32#define VN_ISBLK(vp) S_ISBLK((vp)->i_mode)
33
34/* 28/*
35 * Vnode to Linux inode mapping. 29 * Vnode to Linux inode mapping.
36 */ 30 */
@@ -151,24 +145,6 @@ typedef struct bhv_vattr {
151 XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\ 145 XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
152 XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT) 146 XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
153 147
154/*
155 * Modes.
156 */
157#define VSUID S_ISUID /* set user id on execution */
158#define VSGID S_ISGID /* set group id on execution */
159#define VSVTX S_ISVTX /* save swapped text even after use */
160#define VREAD S_IRUSR /* read, write, execute permissions */
161#define VWRITE S_IWUSR
162#define VEXEC S_IXUSR
163
164#define MODEMASK S_IALLUGO /* mode bits plus permission bits */
165
166/*
167 * Check whether mandatory file locking is enabled.
168 */
169#define MANDLOCK(vp, mode) \
170 (VN_ISREG(vp) && ((mode) & (VSGID|(VEXEC>>3))) == VSGID)
171
172extern void vn_init(void); 148extern void vn_init(void);
173extern int vn_revalidate(bhv_vnode_t *); 149extern int vn_revalidate(bhv_vnode_t *);
174 150
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 8e130b9720ae..b1275cc45617 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -72,7 +72,7 @@ xfs_acl_vhasacl_default(
72{ 72{
73 int error; 73 int error;
74 74
75 if (!VN_ISDIR(vp)) 75 if (!S_ISDIR(vp->i_mode))
76 return 0; 76 return 0;
77 xfs_acl_get_attr(vp, NULL, _ACL_TYPE_DEFAULT, ATTR_KERNOVAL, &error); 77 xfs_acl_get_attr(vp, NULL, _ACL_TYPE_DEFAULT, ATTR_KERNOVAL, &error);
78 return (error == 0); 78 return (error == 0);
@@ -379,7 +379,7 @@ xfs_acl_allow_set(
379 379
380 if (vp->i_flags & (S_IMMUTABLE|S_APPEND)) 380 if (vp->i_flags & (S_IMMUTABLE|S_APPEND))
381 return EPERM; 381 return EPERM;
382 if (kind == _ACL_TYPE_DEFAULT && !VN_ISDIR(vp)) 382 if (kind == _ACL_TYPE_DEFAULT && !S_ISDIR(vp->i_mode))
383 return ENOTDIR; 383 return ENOTDIR;
384 if (vp->i_sb->s_flags & MS_RDONLY) 384 if (vp->i_sb->s_flags & MS_RDONLY)
385 return EROFS; 385 return EROFS;
@@ -719,7 +719,7 @@ xfs_acl_inherit(
719 * If the new file is a directory, its default ACL is a copy of 719 * If the new file is a directory, its default ACL is a copy of
720 * the containing directory's default ACL. 720 * the containing directory's default ACL.
721 */ 721 */
722 if (VN_ISDIR(vp)) 722 if (S_ISDIR(vp->i_mode))
723 xfs_acl_set_attr(vp, pdaclp, _ACL_TYPE_DEFAULT, &error); 723 xfs_acl_set_attr(vp, pdaclp, _ACL_TYPE_DEFAULT, &error);
724 if (!error && !basicperms) 724 if (!error && !basicperms)
725 xfs_acl_set_attr(vp, cacl, _ACL_TYPE_ACCESS, &error); 725 xfs_acl_set_attr(vp, cacl, _ACL_TYPE_ACCESS, &error);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 6650601c64f7..3fef54b11582 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -211,7 +211,6 @@ xfs_setattr(
211 int flags, 211 int flags,
212 cred_t *credp) 212 cred_t *credp)
213{ 213{
214 bhv_vnode_t *vp = XFS_ITOV(ip);
215 xfs_mount_t *mp = ip->i_mount; 214 xfs_mount_t *mp = ip->i_mount;
216 xfs_trans_t *tp; 215 xfs_trans_t *tp;
217 int mask; 216 int mask;
@@ -222,7 +221,6 @@ xfs_setattr(
222 gid_t gid=0, igid=0; 221 gid_t gid=0, igid=0;
223 int timeflags = 0; 222 int timeflags = 0;
224 xfs_prid_t projid=0, iprojid=0; 223 xfs_prid_t projid=0, iprojid=0;
225 int mandlock_before, mandlock_after;
226 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; 224 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
227 int file_owner; 225 int file_owner;
228 int need_iolock = 1; 226 int need_iolock = 1;
@@ -383,7 +381,7 @@ xfs_setattr(
383 m |= S_ISGID; 381 m |= S_ISGID;
384#if 0 382#if 0
385 /* Linux allows this, Irix doesn't. */ 383 /* Linux allows this, Irix doesn't. */
386 if ((vap->va_mode & S_ISVTX) && !VN_ISDIR(vp)) 384 if ((vap->va_mode & S_ISVTX) && !S_ISDIR(ip->i_d.di_mode))
387 m |= S_ISVTX; 385 m |= S_ISVTX;
388#endif 386#endif
389 if (m && !capable(CAP_FSETID)) 387 if (m && !capable(CAP_FSETID))
@@ -461,10 +459,10 @@ xfs_setattr(
461 goto error_return; 459 goto error_return;
462 } 460 }
463 461
464 if (VN_ISDIR(vp)) { 462 if (S_ISDIR(ip->i_d.di_mode)) {
465 code = XFS_ERROR(EISDIR); 463 code = XFS_ERROR(EISDIR);
466 goto error_return; 464 goto error_return;
467 } else if (!VN_ISREG(vp)) { 465 } else if (!S_ISREG(ip->i_d.di_mode)) {
468 code = XFS_ERROR(EINVAL); 466 code = XFS_ERROR(EINVAL);
469 goto error_return; 467 goto error_return;
470 } 468 }
@@ -626,9 +624,6 @@ xfs_setattr(
626 xfs_trans_ihold(tp, ip); 624 xfs_trans_ihold(tp, ip);
627 } 625 }
628 626
629 /* determine whether mandatory locking mode changes */
630 mandlock_before = MANDLOCK(vp, ip->i_d.di_mode);
631
632 /* 627 /*
633 * Truncate file. Must have write permission and not be a directory. 628 * Truncate file. Must have write permission and not be a directory.
634 */ 629 */
@@ -858,13 +853,6 @@ xfs_setattr(
858 code = xfs_trans_commit(tp, commit_flags); 853 code = xfs_trans_commit(tp, commit_flags);
859 } 854 }
860 855
861 /*
862 * If the (regular) file's mandatory locking mode changed, then
863 * notify the vnode. We do this under the inode lock to prevent
864 * racing calls to vop_vnode_change.
865 */
866 mandlock_after = MANDLOCK(vp, ip->i_d.di_mode);
867
868 xfs_iunlock(ip, lock_flags); 856 xfs_iunlock(ip, lock_flags);
869 857
870 /* 858 /*
@@ -1491,7 +1479,7 @@ xfs_release(
1491 xfs_mount_t *mp = ip->i_mount; 1479 xfs_mount_t *mp = ip->i_mount;
1492 int error; 1480 int error;
1493 1481
1494 if (!VN_ISREG(vp) || (ip->i_d.di_mode == 0)) 1482 if (!S_ISREG(ip->i_d.di_mode) || (ip->i_d.di_mode == 0))
1495 return 0; 1483 return 0;
1496 1484
1497 /* If this is a read-only mount, don't do this (would generate I/O) */ 1485 /* If this is a read-only mount, don't do this (would generate I/O) */