Module Name: src Committed By: rmind Date: Sun Apr 3 01:19:37 UTC 2011
Modified Files: src/sys/kern: vnode_if.sh src/sys/miscfs/genfs: layer_vnops.c src/sys/miscfs/umapfs: umap_vnops.c src/sys/sys: vnode.h src/sys/ufs/lfs: lfs_segment.c Log Message: - Use offsetof() in VOPARG_OFFSETOF() instead of re-implementing it. - Remove VDESC_NOMAP_VPP and VDESC_VPP_WILLRELE. - Remove VRELEL_NOINACTIVE and VRELEL_ONHEAD. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/kern/vnode_if.sh cvs rdiff -u -r1.46 -r1.47 src/sys/miscfs/genfs/layer_vnops.c cvs rdiff -u -r1.51 -r1.52 src/sys/miscfs/umapfs/umap_vnops.c cvs rdiff -u -r1.226 -r1.227 src/sys/sys/vnode.h cvs rdiff -u -r1.219 -r1.220 src/sys/ufs/lfs/lfs_segment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vnode_if.sh diff -u src/sys/kern/vnode_if.sh:1.56 src/sys/kern/vnode_if.sh:1.57 --- src/sys/kern/vnode_if.sh:1.56 Wed Apr 14 13:58:51 2010 +++ src/sys/kern/vnode_if.sh Sun Apr 3 01:19:37 2011 @@ -29,7 +29,7 @@ * SUCH DAMAGE. */ " -SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.56 2010/04/14 13:58:51 pooka Exp $' +SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.57 2011/04/03 01:19:37 rmind Exp $' # Script to produce VFS front-end sugar. # @@ -368,11 +368,7 @@ } else { word = "RELE"; } - if (argdir[i] ~ /OUT/) { - printf(" | VDESC_VPP_WILL%s", word); - } else { - printf(" | VDESC_VP%s_WILL%s", vpnum, word); - }; + printf(" | VDESC_VP%s_WILL%s", vpnum, word); vpnum++; } } Index: src/sys/miscfs/genfs/layer_vnops.c diff -u src/sys/miscfs/genfs/layer_vnops.c:1.46 src/sys/miscfs/genfs/layer_vnops.c:1.47 --- src/sys/miscfs/genfs/layer_vnops.c:1.46 Thu Jan 13 10:28:38 2011 +++ src/sys/miscfs/genfs/layer_vnops.c Sun Apr 3 01:19:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: layer_vnops.c,v 1.46 2011/01/13 10:28:38 hannken Exp $ */ +/* $NetBSD: layer_vnops.c,v 1.47 2011/04/03 01:19:35 rmind Exp $ */ /* * Copyright (c) 1999 National Aeronautics & Space Administration @@ -170,7 +170,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.46 2011/01/13 10:28:38 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.47 2011/04/03 01:19:35 rmind Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -311,17 +311,7 @@ * (Assumes that the lower layer always returns * a VREF'ed vpp unless it gets an error.) */ - if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && - !(descp->vdesc_flags & VDESC_NOMAP_VPP) && - !error) { - /* - * XXX - even though some ops have vpp returned vp's, - * several ops actually vrele this before returning. - * We must avoid these ops. - * (This should go away when these ops are regularized.) - */ - if (descp->vdesc_flags & VDESC_VPP_WILLRELE) - goto out; + if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && !error) { vppp = VOPARG_OFFSETTO(struct vnode***, descp->vdesc_vpp_offset, ap); /* @@ -338,7 +328,6 @@ **vppp = NULL; } } -out: return error; } Index: src/sys/miscfs/umapfs/umap_vnops.c diff -u src/sys/miscfs/umapfs/umap_vnops.c:1.51 src/sys/miscfs/umapfs/umap_vnops.c:1.52 --- src/sys/miscfs/umapfs/umap_vnops.c:1.51 Mon Jan 10 11:11:04 2011 +++ src/sys/miscfs/umapfs/umap_vnops.c Sun Apr 3 01:19:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: umap_vnops.c,v 1.51 2011/01/10 11:11:04 hannken Exp $ */ +/* $NetBSD: umap_vnops.c,v 1.52 2011/04/03 01:19:36 rmind Exp $ */ /* * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.51 2011/01/10 11:11:04 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umap_vnops.c,v 1.52 2011/04/03 01:19:36 rmind Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -269,17 +269,7 @@ * (Assumes that the lower layer always returns * a VREF'ed vpp unless it gets an error.) */ - if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && - !(descp->vdesc_flags & VDESC_NOMAP_VPP) && - !error) { - /* - * XXX - even though some ops have vpp returned vp's, - * several ops actually vrele this before returning. - * We must avoid these ops. - * (This should go away when these ops are regularized.) - */ - if (descp->vdesc_flags & VDESC_VPP_WILLRELE) - goto out; + if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET && !error) { vppp = VOPARG_OFFSETTO(struct vnode***, descp->vdesc_vpp_offset, ap); /* @@ -297,7 +287,6 @@ } } - out: /* * Free duplicate cred structure and restore old one. */ Index: src/sys/sys/vnode.h diff -u src/sys/sys/vnode.h:1.226 src/sys/sys/vnode.h:1.227 --- src/sys/sys/vnode.h:1.226 Sat Apr 2 05:07:56 2011 +++ src/sys/sys/vnode.h Sun Apr 3 01:19:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode.h,v 1.226 2011/04/02 05:07:56 rmind Exp $ */ +/* $NetBSD: vnode.h,v 1.227 2011/04/03 01:19:36 rmind Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -433,8 +433,6 @@ #define VDESC_VP1_WILLPUT 0x00000202 #define VDESC_VP2_WILLPUT 0x00000404 #define VDESC_VP3_WILLPUT 0x00000808 -#define VDESC_NOMAP_VPP 0x00010000 -#define VDESC_VPP_WILLRELE 0x00020000 /* * VDESC_NO_OFFSET is used to identify the end of the offset list @@ -465,11 +463,6 @@ #ifdef _KERNEL /* - * A list of all the operation descs. - */ -extern struct vnodeop_desc *vnodeop_descs[]; - -/* * Interlock for scanning list of vnodes attached to a mountpoint */ extern kmutex_t mntvnode_lock; @@ -480,19 +473,10 @@ extern int (*vn_union_readdir_hook) (struct vnode **, struct file *, struct lwp *); /* - * This macro is very helpful in defining those offsets in the vdesc struct. - * - * This is stolen from X11R4. I ingored all the fancy stuff for - * Crays, so if you decide to port this to such a serious machine, - * you might want to consult Intrisics.h's XtOffset{,Of,To}. - */ -#define VOPARG_OFFSET(p_type,field) \ - ((int) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) -#define VOPARG_OFFSETOF(s_type,field) \ - VOPARG_OFFSET(s_type*,field) -#define VOPARG_OFFSETTO(S_TYPE,S_OFFSET,STRUCT_P) \ - ((S_TYPE)(((char*)(STRUCT_P))+(S_OFFSET))) - + * Macros for offsets in the vdesc struct. + */ +#define VOPARG_OFFSETOF(type, member) offsetof(type, member) +#define VOPARG_OFFSETTO(type,offset,sp) ((type)(((char *)(sp)) + (offset))) /* * This structure is used to configure the new vnodeops vector. @@ -501,6 +485,7 @@ const struct vnodeop_desc *opve_op; /* which operation this is */ int (*opve_impl)(void *); /* code implementing this operation */ }; + struct vnodeopv_desc { /* ptr to the ptr to the vector where op should go */ int (***opv_desc_vector_p)(void *); @@ -588,8 +573,6 @@ void vclean(struct vnode *, int); void vrevoke(struct vnode *); void vrelel(struct vnode *, int); -#define VRELEL_NOINACTIVE 0x01 -#define VRELEL_ONHEAD 0x02 #define VRELEL_ASYNC_RELE 0x03 struct vnode * vnalloc(struct mount *); Index: src/sys/ufs/lfs/lfs_segment.c diff -u src/sys/ufs/lfs/lfs_segment.c:1.219 src/sys/ufs/lfs/lfs_segment.c:1.220 --- src/sys/ufs/lfs/lfs_segment.c:1.219 Sat Apr 2 04:28:57 2011 +++ src/sys/ufs/lfs/lfs_segment.c Sun Apr 3 01:19:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.219 2011/04/02 04:28:57 rmind Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.220 2011/04/03 01:19:37 rmind Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.219 2011/04/02 04:28:57 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.220 2011/04/03 01:19:37 rmind Exp $"); #ifdef DEBUG # define vndebug(vp, str) do { \ @@ -2764,7 +2764,7 @@ /* does not call inactive */ mutex_enter(&vp->v_interlock); - vrelel(vp, VRELEL_NOINACTIVE); + vrelel(vp, 0); } /* @@ -2783,7 +2783,7 @@ /* does not call inactive, inserts non-held vnode at head of freelist */ mutex_enter(&vp->v_interlock); - vrelel(vp, VRELEL_NOINACTIVE | VRELEL_ONHEAD); + vrelel(vp, 0); }