Received: with ECARTIS (v1.0.0; list linux-xfs); Sat, 16 Aug 2003 15:15:11 -0700 (PDT) Received: from www.linux.org.uk (IDENT:93@parcelfarce.linux.theplanet.co.uk [195.92.249.252]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h7GMEpFl006098 for ; Sat, 16 Aug 2003 15:14:52 -0700 Received: from willy by www.linux.org.uk with local (Exim 4.14) id 19o9Jy-0002lk-Da for linux-xfs@oss.sgi.com; Sat, 16 Aug 2003 23:14:50 +0100 Date: Sat, 16 Aug 2003 23:14:50 +0100 From: Matthew Wilcox To: linux-xfs@oss.sgi.com Subject: [PATCH] Remove VOP_ACCESS Message-ID: <20030816221450.GJ19630@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-archive-position: 62 X-ecartis-version: Ecartis v1.0.0 Sender: linux-xfs-bounce@oss.sgi.com Errors-to: linux-xfs-bounce@oss.sgi.com X-original-sender: willy@debian.org Precedence: bulk X-list: linux-xfs Content-Length: 2705 Lines: 69 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