xfs
[Top] [All Lists]

[PATCH] Remove VOP_ACCESS

To: linux-xfs@xxxxxxxxxxx
Subject: [PATCH] Remove VOP_ACCESS
From: Matthew Wilcox <willy@xxxxxxxxxx>
Date: Sat, 16 Aug 2003 23:14:50 +0100
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.1i
I was tracing through the various ->permission implementations to figure
out what was going on and I ran into this rather silly VOP_ stuff.
This patch makes it easier to figure out what's going on (ie that I'm
looking for the vop_access implementations.

 - Turn v_fops into a macro that returns a (vnodeops_t *).  Change _VOP_
   definition accordingly.
 - Expand VOP_ACCESS and remove definition.

Index: fs/xfs/linux/xfs_iops.c
===================================================================
RCS file: /var/cvs/linux-2.6/fs/xfs/linux/xfs_iops.c,v
retrieving revision 1.2
diff -u -p -r1.2 xfs_iops.c
--- fs/xfs/linux/xfs_iops.c     12 Aug 2003 19:11:20 -0000      1.2
+++ fs/xfs/linux/xfs_iops.c     16 Aug 2003 22:01:55 -0000
@@ -439,7 +439,8 @@ linvfs_permission(
        int             error;
 
        mode <<= 6;             /* convert from linux to vnode access bits */
-       VOP_ACCESS(vp, mode, NULL, error);
+
+       error = v_fops(vp)->vop_access(vp->v_fbhv, mode, NULL);
        return -error;
 }
 #else
Index: fs/xfs/linux/xfs_vnode.h
===================================================================
RCS file: /var/cvs/linux-2.6/fs/xfs/linux/xfs_vnode.h,v
retrieving revision 1.2
diff -u -p -r1.2 xfs_vnode.h
--- fs/xfs/linux/xfs_vnode.h    12 Aug 2003 19:11:20 -0000      1.2
+++ fs/xfs/linux/xfs_vnode.h    16 Aug 2003 22:01:55 -0000
@@ -75,8 +75,8 @@ typedef struct vnode {
 #endif
 } vnode_t;
 
-#define v_fbhv                 v_bh.bh_first          /* first behavior */
-#define v_fops                 v_bh.bh_first->bd_ops  /* first behavior ops */
+#define v_fbhv         v_bh.bh_first          /* first behavior */
+#define v_fops(vp)     ((vnodeops_t *)(vp)->v_bh.bh_first->bd_ops)
 
 #define VNODE_POSITION_BASE    BHV_POSITION_BASE       /* chain bottom */
 #define VNODE_POSITION_TOP     BHV_POSITION_TOP        /* chain top */
@@ -260,7 +260,7 @@ typedef struct vnodeops {
 /*
  * VOP's.
  */
-#define _VOP_(op, vp)  (*((vnodeops_t *)(vp)->v_fops)->op)
+#define _VOP_(op, vp)  (v_fops(vp)->op)
 
 #define VOP_READ(vp,file,iov,segs,offset,cr,rv)                        \
        rv = _VOP_(vop_read, vp)((vp)->v_fbhv,file,iov,segs,offset,cr)
@@ -276,8 +276,6 @@ typedef struct vnodeops {
        rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr)
 #define        VOP_SETATTR(vp, vap, f, cr, rv)                                 
\
        rv = _VOP_(vop_setattr, vp)((vp)->v_fbhv, vap, f, cr)
-#define        VOP_ACCESS(vp, mode, cr, rv)                                    
\
-       rv = _VOP_(vop_access, vp)((vp)->v_fbhv, mode, cr)
 #define        VOP_LOOKUP(vp,d,vpp,f,rdir,cr,rv)                               
\
        rv = _VOP_(vop_lookup, vp)((vp)->v_fbhv,d,vpp,f,rdir,cr)
 #define VOP_CREATE(dvp,d,vap,vpp,cr,rv)                                        
\

-- 
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk


<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] Remove VOP_ACCESS, Matthew Wilcox <=