Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys - Use offsetof() in VOPARG_OFFSETOF() instead of re-impl...
details: https://anonhg.NetBSD.org/src/rev/64f3d9f7d145
branches: trunk
changeset: 763752:64f3d9f7d145
user: rmind <rmind%NetBSD.org@localhost>
date: Sun Apr 03 01:19:35 2011 +0000
description:
- Use offsetof() in VOPARG_OFFSETOF() instead of re-implementing it.
- Remove VDESC_NOMAP_VPP and VDESC_VPP_WILLRELE.
- Remove VRELEL_NOINACTIVE and VRELEL_ONHEAD.
diffstat:
sys/kern/vnode_if.sh | 8 ++------
sys/miscfs/genfs/layer_vnops.c | 17 +++--------------
sys/miscfs/umapfs/umap_vnops.c | 17 +++--------------
sys/sys/vnode.h | 27 +++++----------------------
sys/ufs/lfs/lfs_segment.c | 8 ++++----
5 files changed, 17 insertions(+), 60 deletions(-)
diffs (221 lines):
diff -r 117ca319770c -r 64f3d9f7d145 sys/kern/vnode_if.sh
--- a/sys/kern/vnode_if.sh Sat Apr 02 23:05:50 2011 +0000
+++ b/sys/kern/vnode_if.sh Sun Apr 03 01:19:35 2011 +0000
@@ -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++;
}
}
diff -r 117ca319770c -r 64f3d9f7d145 sys/miscfs/genfs/layer_vnops.c
--- a/sys/miscfs/genfs/layer_vnops.c Sat Apr 02 23:05:50 2011 +0000
+++ b/sys/miscfs/genfs/layer_vnops.c Sun Apr 03 01:19:35 2011 +0000
@@ -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;
}
diff -r 117ca319770c -r 64f3d9f7d145 sys/miscfs/umapfs/umap_vnops.c
--- a/sys/miscfs/umapfs/umap_vnops.c Sat Apr 02 23:05:50 2011 +0000
+++ b/sys/miscfs/umapfs/umap_vnops.c Sun Apr 03 01:19:35 2011 +0000
@@ -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.
*/
diff -r 117ca319770c -r 64f3d9f7d145 sys/sys/vnode.h
--- a/sys/sys/vnode.h Sat Apr 02 23:05:50 2011 +0000
+++ b/sys/sys/vnode.h Sun Apr 03 01:19:35 2011 +0000
@@ -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}.
+ * Macros for offsets in the vdesc struct.
*/
-#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)))
-
+#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 *);
diff -r 117ca319770c -r 64f3d9f7d145 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sat Apr 02 23:05:50 2011 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sun Apr 03 01:19:35 2011 +0000
@@ -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);
}
Home |
Main Index |
Thread Index |
Old Index