Home | History | Annotate | Line # | Download | only in kern
vnode_if.c revision 1.78.2.1
      1  1.78.2.1     skrll /*	$NetBSD: vnode_if.c,v 1.78.2.1 2009/01/19 13:19:40 skrll Exp $	*/
      2       1.9   thorpej 
      3       1.1       cgd /*
      4      1.52     perry  * Warning: DO NOT EDIT! This file is automatically generated!
      5       1.1       cgd  * (Modifications made here may easily be lost!)
      6       1.1       cgd  *
      7       1.1       cgd  * Created from the file:
      8  1.78.2.1     skrll  *	NetBSD: vnode_if.src,v 1.58 2008/11/15 19:08:12 pooka Exp
      9       1.1       cgd  * by the script:
     10  1.78.2.1     skrll  *	NetBSD: vnode_if.sh,v 1.50 2008/11/17 08:46:03 pooka Exp
     11       1.1       cgd  */
     12       1.1       cgd 
     13       1.1       cgd /*
     14      1.10      fvdl  * Copyright (c) 1992, 1993, 1994, 1995
     15       1.1       cgd  *	The Regents of the University of California.  All rights reserved.
     16       1.1       cgd  *
     17       1.1       cgd  * Redistribution and use in source and binary forms, with or without
     18       1.1       cgd  * modification, are permitted provided that the following conditions
     19       1.1       cgd  * are met:
     20       1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     21       1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     22       1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     23       1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     24       1.1       cgd  *    documentation and/or other materials provided with the distribution.
     25      1.45       agc  * 3. Neither the name of the University nor the names of its contributors
     26       1.1       cgd  *    may be used to endorse or promote products derived from this software
     27       1.1       cgd  *    without specific prior written permission.
     28       1.1       cgd  *
     29      1.14  christos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     30       1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     31       1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     32       1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     33       1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     34       1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     35       1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     36       1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     37       1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     38       1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     39       1.1       cgd  * SUCH DAMAGE.
     40       1.1       cgd  */
     41      1.39     lukem 
     42      1.39     lukem #include <sys/cdefs.h>
     43  1.78.2.1     skrll __KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.78.2.1 2009/01/19 13:19:40 skrll Exp $");
     44      1.39     lukem 
     45      1.24   thorpej 
     46      1.50   thorpej #include "opt_vnode_lockdebug.h"
     47       1.1       cgd 
     48       1.1       cgd #include <sys/param.h>
     49       1.1       cgd #include <sys/mount.h>
     50      1.23   thorpej #include <sys/buf.h>
     51       1.1       cgd #include <sys/vnode.h>
     52      1.72        ad #include <sys/lock.h>
     53       1.1       cgd 
     54      1.34     lukem const struct vnodeop_desc vop_default_desc = {
     55       1.1       cgd 	0,
     56       1.1       cgd 	"default",
     57       1.1       cgd 	0,
     58       1.1       cgd 	NULL,
     59       1.1       cgd 	VDESC_NO_OFFSET,
     60       1.1       cgd 	VDESC_NO_OFFSET,
     61       1.1       cgd 	VDESC_NO_OFFSET,
     62       1.1       cgd 	NULL,
     63       1.1       cgd };
     64       1.1       cgd 
     65       1.1       cgd 
     66      1.33  jdolecek /* Special cases: */
     67      1.33  jdolecek 
     68      1.33  jdolecek const int vop_bwrite_vp_offsets[] = {
     69      1.33  jdolecek 	VDESC_NO_OFFSET
     70      1.33  jdolecek };
     71      1.33  jdolecek const struct vnodeop_desc vop_bwrite_desc = {
     72      1.67     pooka 	VOP_BWRITE_DESCOFFSET,
     73      1.33  jdolecek 	"vop_bwrite",
     74      1.33  jdolecek 	0,
     75      1.33  jdolecek 	vop_bwrite_vp_offsets,
     76      1.33  jdolecek 	VDESC_NO_OFFSET,
     77      1.33  jdolecek 	VDESC_NO_OFFSET,
     78      1.33  jdolecek 	VDESC_NO_OFFSET,
     79      1.33  jdolecek 	NULL,
     80      1.33  jdolecek };
     81      1.33  jdolecek int
     82      1.60   thorpej VOP_BWRITE(struct buf *bp)
     83      1.33  jdolecek {
     84      1.72        ad 	int error;
     85      1.72        ad 	bool mpsafe;
     86      1.33  jdolecek 	struct vop_bwrite_args a;
     87      1.50   thorpej #ifdef VNODE_LOCKDEBUG
     88      1.50   thorpej #endif
     89      1.33  jdolecek 	a.a_desc = VDESC(vop_bwrite);
     90      1.33  jdolecek 	a.a_bp = bp;
     91      1.72        ad 	mpsafe = (bp->b_vp->v_vflag & VV_MPSAFE);
     92      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
     93      1.72        ad 	error = (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a));
     94      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
     95      1.72        ad 	return error;
     96      1.33  jdolecek }
     97      1.33  jdolecek 
     98      1.33  jdolecek /* End of special cases */
     99      1.33  jdolecek 
    100      1.31  jdolecek const int vop_lookup_vp_offsets[] = {
    101       1.1       cgd 	VOPARG_OFFSETOF(struct vop_lookup_args,a_dvp),
    102       1.1       cgd 	VDESC_NO_OFFSET
    103       1.1       cgd };
    104      1.33  jdolecek const struct vnodeop_desc vop_lookup_desc = {
    105      1.67     pooka 	VOP_LOOKUP_DESCOFFSET,
    106       1.1       cgd 	"vop_lookup",
    107       1.1       cgd 	0,
    108       1.1       cgd 	vop_lookup_vp_offsets,
    109       1.1       cgd 	VOPARG_OFFSETOF(struct vop_lookup_args, a_vpp),
    110       1.1       cgd 	VDESC_NO_OFFSET,
    111       1.1       cgd 	VOPARG_OFFSETOF(struct vop_lookup_args, a_cnp),
    112       1.1       cgd 	NULL,
    113       1.1       cgd };
    114      1.23   thorpej int
    115      1.60   thorpej VOP_LOOKUP(struct vnode *dvp,
    116      1.60   thorpej     struct vnode **vpp,
    117      1.60   thorpej     struct componentname *cnp)
    118      1.23   thorpej {
    119      1.72        ad 	int error;
    120      1.72        ad 	bool mpsafe;
    121      1.23   thorpej 	struct vop_lookup_args a;
    122      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    123      1.50   thorpej #endif
    124      1.23   thorpej 	a.a_desc = VDESC(vop_lookup);
    125      1.23   thorpej 	a.a_dvp = dvp;
    126      1.23   thorpej 	a.a_vpp = vpp;
    127      1.23   thorpej 	a.a_cnp = cnp;
    128      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
    129      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    130      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_lookup), &a));
    131      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    132      1.69     pooka #ifdef DIAGNOSTIC
    133      1.72        ad 	if (error == 0)
    134      1.69     pooka 		KASSERT((*vpp)->v_size != VSIZENOTSET
    135      1.69     pooka 		    && (*vpp)->v_writesize != VSIZENOTSET);
    136      1.69     pooka #endif /* DIAGNOSTIC */
    137      1.72        ad 	return error;
    138      1.23   thorpej }
    139       1.1       cgd 
    140      1.31  jdolecek const int vop_create_vp_offsets[] = {
    141       1.1       cgd 	VOPARG_OFFSETOF(struct vop_create_args,a_dvp),
    142       1.1       cgd 	VDESC_NO_OFFSET
    143       1.1       cgd };
    144      1.33  jdolecek const struct vnodeop_desc vop_create_desc = {
    145      1.67     pooka 	VOP_CREATE_DESCOFFSET,
    146       1.1       cgd 	"vop_create",
    147      1.17  wrstuden 	0 | VDESC_VP0_WILLPUT,
    148       1.1       cgd 	vop_create_vp_offsets,
    149       1.1       cgd 	VOPARG_OFFSETOF(struct vop_create_args, a_vpp),
    150       1.1       cgd 	VDESC_NO_OFFSET,
    151       1.1       cgd 	VOPARG_OFFSETOF(struct vop_create_args, a_cnp),
    152       1.1       cgd 	NULL,
    153       1.1       cgd };
    154      1.23   thorpej int
    155      1.60   thorpej VOP_CREATE(struct vnode *dvp,
    156      1.60   thorpej     struct vnode **vpp,
    157      1.60   thorpej     struct componentname *cnp,
    158      1.60   thorpej     struct vattr *vap)
    159      1.23   thorpej {
    160      1.72        ad 	int error;
    161      1.72        ad 	bool mpsafe;
    162      1.23   thorpej 	struct vop_create_args a;
    163      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    164      1.50   thorpej 	int islocked_dvp;
    165      1.50   thorpej #endif
    166      1.23   thorpej 	a.a_desc = VDESC(vop_create);
    167      1.23   thorpej 	a.a_dvp = dvp;
    168      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    169      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
    170      1.50   thorpej 	if (islocked_dvp != 1)
    171      1.50   thorpej 		panic("vop_create: dvp: locked %d, expected %d", islocked_dvp, 1);
    172      1.50   thorpej #endif
    173      1.23   thorpej 	a.a_vpp = vpp;
    174      1.23   thorpej 	a.a_cnp = cnp;
    175      1.23   thorpej 	a.a_vap = vap;
    176      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
    177      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    178      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_create), &a));
    179      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    180      1.69     pooka #ifdef DIAGNOSTIC
    181      1.72        ad 	if (error == 0)
    182      1.69     pooka 		KASSERT((*vpp)->v_size != VSIZENOTSET
    183      1.69     pooka 		    && (*vpp)->v_writesize != VSIZENOTSET);
    184      1.69     pooka #endif /* DIAGNOSTIC */
    185      1.72        ad 	return error;
    186      1.23   thorpej }
    187       1.1       cgd 
    188      1.31  jdolecek const int vop_mknod_vp_offsets[] = {
    189       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mknod_args,a_dvp),
    190       1.1       cgd 	VDESC_NO_OFFSET
    191       1.1       cgd };
    192      1.33  jdolecek const struct vnodeop_desc vop_mknod_desc = {
    193      1.67     pooka 	VOP_MKNOD_DESCOFFSET,
    194       1.1       cgd 	"vop_mknod",
    195      1.37     assar 	0 | VDESC_VP0_WILLPUT,
    196       1.1       cgd 	vop_mknod_vp_offsets,
    197       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mknod_args, a_vpp),
    198       1.1       cgd 	VDESC_NO_OFFSET,
    199       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mknod_args, a_cnp),
    200       1.1       cgd 	NULL,
    201       1.1       cgd };
    202      1.23   thorpej int
    203      1.60   thorpej VOP_MKNOD(struct vnode *dvp,
    204      1.60   thorpej     struct vnode **vpp,
    205      1.60   thorpej     struct componentname *cnp,
    206      1.60   thorpej     struct vattr *vap)
    207      1.23   thorpej {
    208      1.72        ad 	int error;
    209      1.72        ad 	bool mpsafe;
    210      1.23   thorpej 	struct vop_mknod_args a;
    211      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    212      1.50   thorpej 	int islocked_dvp;
    213      1.50   thorpej #endif
    214      1.23   thorpej 	a.a_desc = VDESC(vop_mknod);
    215      1.23   thorpej 	a.a_dvp = dvp;
    216      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    217      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
    218      1.50   thorpej 	if (islocked_dvp != 1)
    219      1.50   thorpej 		panic("vop_mknod: dvp: locked %d, expected %d", islocked_dvp, 1);
    220      1.50   thorpej #endif
    221      1.23   thorpej 	a.a_vpp = vpp;
    222      1.23   thorpej 	a.a_cnp = cnp;
    223      1.23   thorpej 	a.a_vap = vap;
    224      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
    225      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    226      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_mknod), &a));
    227      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    228      1.69     pooka #ifdef DIAGNOSTIC
    229      1.72        ad 	if (error == 0)
    230      1.69     pooka 		KASSERT((*vpp)->v_size != VSIZENOTSET
    231      1.69     pooka 		    && (*vpp)->v_writesize != VSIZENOTSET);
    232      1.69     pooka #endif /* DIAGNOSTIC */
    233      1.72        ad 	return error;
    234      1.23   thorpej }
    235       1.1       cgd 
    236      1.31  jdolecek const int vop_open_vp_offsets[] = {
    237       1.1       cgd 	VOPARG_OFFSETOF(struct vop_open_args,a_vp),
    238       1.1       cgd 	VDESC_NO_OFFSET
    239       1.1       cgd };
    240      1.33  jdolecek const struct vnodeop_desc vop_open_desc = {
    241      1.67     pooka 	VOP_OPEN_DESCOFFSET,
    242       1.1       cgd 	"vop_open",
    243       1.1       cgd 	0,
    244       1.1       cgd 	vop_open_vp_offsets,
    245       1.1       cgd 	VDESC_NO_OFFSET,
    246       1.1       cgd 	VOPARG_OFFSETOF(struct vop_open_args, a_cred),
    247       1.1       cgd 	VDESC_NO_OFFSET,
    248       1.1       cgd 	NULL,
    249       1.1       cgd };
    250      1.23   thorpej int
    251      1.60   thorpej VOP_OPEN(struct vnode *vp,
    252      1.60   thorpej     int mode,
    253      1.73     pooka     kauth_cred_t cred)
    254      1.23   thorpej {
    255      1.72        ad 	int error;
    256      1.72        ad 	bool mpsafe;
    257      1.23   thorpej 	struct vop_open_args a;
    258      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    259      1.50   thorpej 	int islocked_vp;
    260      1.50   thorpej #endif
    261      1.23   thorpej 	a.a_desc = VDESC(vop_open);
    262      1.23   thorpej 	a.a_vp = vp;
    263      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    264      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    265      1.50   thorpej 	if (islocked_vp != 1)
    266      1.50   thorpej 		panic("vop_open: vp: locked %d, expected %d", islocked_vp, 1);
    267      1.50   thorpej #endif
    268      1.23   thorpej 	a.a_mode = mode;
    269      1.23   thorpej 	a.a_cred = cred;
    270      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    271      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    272      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_open), &a));
    273      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    274      1.72        ad 	return error;
    275      1.23   thorpej }
    276       1.1       cgd 
    277      1.31  jdolecek const int vop_close_vp_offsets[] = {
    278       1.1       cgd 	VOPARG_OFFSETOF(struct vop_close_args,a_vp),
    279       1.1       cgd 	VDESC_NO_OFFSET
    280       1.1       cgd };
    281      1.33  jdolecek const struct vnodeop_desc vop_close_desc = {
    282      1.67     pooka 	VOP_CLOSE_DESCOFFSET,
    283       1.1       cgd 	"vop_close",
    284       1.1       cgd 	0,
    285       1.1       cgd 	vop_close_vp_offsets,
    286       1.1       cgd 	VDESC_NO_OFFSET,
    287       1.1       cgd 	VOPARG_OFFSETOF(struct vop_close_args, a_cred),
    288       1.1       cgd 	VDESC_NO_OFFSET,
    289       1.1       cgd 	NULL,
    290       1.1       cgd };
    291      1.23   thorpej int
    292      1.60   thorpej VOP_CLOSE(struct vnode *vp,
    293      1.60   thorpej     int fflag,
    294      1.73     pooka     kauth_cred_t cred)
    295      1.23   thorpej {
    296      1.72        ad 	int error;
    297      1.72        ad 	bool mpsafe;
    298      1.23   thorpej 	struct vop_close_args a;
    299      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    300      1.50   thorpej 	int islocked_vp;
    301      1.50   thorpej #endif
    302      1.23   thorpej 	a.a_desc = VDESC(vop_close);
    303      1.23   thorpej 	a.a_vp = vp;
    304      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    305      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    306      1.50   thorpej 	if (islocked_vp != 1)
    307      1.50   thorpej 		panic("vop_close: vp: locked %d, expected %d", islocked_vp, 1);
    308      1.50   thorpej #endif
    309      1.23   thorpej 	a.a_fflag = fflag;
    310      1.23   thorpej 	a.a_cred = cred;
    311      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    312      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    313      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_close), &a));
    314      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    315      1.72        ad 	return error;
    316      1.23   thorpej }
    317       1.1       cgd 
    318      1.31  jdolecek const int vop_access_vp_offsets[] = {
    319       1.1       cgd 	VOPARG_OFFSETOF(struct vop_access_args,a_vp),
    320       1.1       cgd 	VDESC_NO_OFFSET
    321       1.1       cgd };
    322      1.33  jdolecek const struct vnodeop_desc vop_access_desc = {
    323      1.67     pooka 	VOP_ACCESS_DESCOFFSET,
    324       1.1       cgd 	"vop_access",
    325       1.1       cgd 	0,
    326       1.1       cgd 	vop_access_vp_offsets,
    327       1.1       cgd 	VDESC_NO_OFFSET,
    328       1.1       cgd 	VOPARG_OFFSETOF(struct vop_access_args, a_cred),
    329       1.1       cgd 	VDESC_NO_OFFSET,
    330       1.1       cgd 	NULL,
    331       1.1       cgd };
    332      1.23   thorpej int
    333      1.60   thorpej VOP_ACCESS(struct vnode *vp,
    334      1.60   thorpej     int mode,
    335      1.73     pooka     kauth_cred_t cred)
    336      1.23   thorpej {
    337      1.72        ad 	int error;
    338      1.72        ad 	bool mpsafe;
    339      1.23   thorpej 	struct vop_access_args a;
    340      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    341      1.50   thorpej 	int islocked_vp;
    342      1.50   thorpej #endif
    343      1.23   thorpej 	a.a_desc = VDESC(vop_access);
    344      1.23   thorpej 	a.a_vp = vp;
    345      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    346      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    347      1.50   thorpej 	if (islocked_vp != 1)
    348      1.50   thorpej 		panic("vop_access: vp: locked %d, expected %d", islocked_vp, 1);
    349      1.50   thorpej #endif
    350      1.23   thorpej 	a.a_mode = mode;
    351      1.23   thorpej 	a.a_cred = cred;
    352      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    353      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    354      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_access), &a));
    355      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    356      1.72        ad 	return error;
    357      1.23   thorpej }
    358       1.1       cgd 
    359      1.31  jdolecek const int vop_getattr_vp_offsets[] = {
    360       1.1       cgd 	VOPARG_OFFSETOF(struct vop_getattr_args,a_vp),
    361       1.1       cgd 	VDESC_NO_OFFSET
    362       1.1       cgd };
    363      1.33  jdolecek const struct vnodeop_desc vop_getattr_desc = {
    364      1.67     pooka 	VOP_GETATTR_DESCOFFSET,
    365       1.1       cgd 	"vop_getattr",
    366       1.1       cgd 	0,
    367       1.1       cgd 	vop_getattr_vp_offsets,
    368       1.1       cgd 	VDESC_NO_OFFSET,
    369       1.1       cgd 	VOPARG_OFFSETOF(struct vop_getattr_args, a_cred),
    370       1.1       cgd 	VDESC_NO_OFFSET,
    371       1.1       cgd 	NULL,
    372       1.1       cgd };
    373      1.23   thorpej int
    374      1.60   thorpej VOP_GETATTR(struct vnode *vp,
    375      1.60   thorpej     struct vattr *vap,
    376      1.73     pooka     kauth_cred_t cred)
    377      1.23   thorpej {
    378      1.72        ad 	int error;
    379      1.72        ad 	bool mpsafe;
    380      1.23   thorpej 	struct vop_getattr_args a;
    381      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    382      1.50   thorpej #endif
    383      1.23   thorpej 	a.a_desc = VDESC(vop_getattr);
    384      1.23   thorpej 	a.a_vp = vp;
    385      1.23   thorpej 	a.a_vap = vap;
    386      1.23   thorpej 	a.a_cred = cred;
    387      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    388      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    389      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_getattr), &a));
    390      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    391      1.72        ad 	return error;
    392      1.23   thorpej }
    393       1.1       cgd 
    394      1.31  jdolecek const int vop_setattr_vp_offsets[] = {
    395       1.1       cgd 	VOPARG_OFFSETOF(struct vop_setattr_args,a_vp),
    396       1.1       cgd 	VDESC_NO_OFFSET
    397       1.1       cgd };
    398      1.33  jdolecek const struct vnodeop_desc vop_setattr_desc = {
    399      1.67     pooka 	VOP_SETATTR_DESCOFFSET,
    400       1.1       cgd 	"vop_setattr",
    401       1.1       cgd 	0,
    402       1.1       cgd 	vop_setattr_vp_offsets,
    403       1.1       cgd 	VDESC_NO_OFFSET,
    404       1.1       cgd 	VOPARG_OFFSETOF(struct vop_setattr_args, a_cred),
    405       1.1       cgd 	VDESC_NO_OFFSET,
    406       1.1       cgd 	NULL,
    407       1.1       cgd };
    408      1.23   thorpej int
    409      1.60   thorpej VOP_SETATTR(struct vnode *vp,
    410      1.60   thorpej     struct vattr *vap,
    411      1.73     pooka     kauth_cred_t cred)
    412      1.23   thorpej {
    413      1.72        ad 	int error;
    414      1.72        ad 	bool mpsafe;
    415      1.23   thorpej 	struct vop_setattr_args a;
    416      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    417      1.50   thorpej 	int islocked_vp;
    418      1.50   thorpej #endif
    419      1.23   thorpej 	a.a_desc = VDESC(vop_setattr);
    420      1.23   thorpej 	a.a_vp = vp;
    421      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    422      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    423      1.50   thorpej 	if (islocked_vp != 1)
    424      1.50   thorpej 		panic("vop_setattr: vp: locked %d, expected %d", islocked_vp, 1);
    425      1.50   thorpej #endif
    426      1.23   thorpej 	a.a_vap = vap;
    427      1.23   thorpej 	a.a_cred = cred;
    428      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    429      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    430      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_setattr), &a));
    431      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    432      1.72        ad 	return error;
    433      1.23   thorpej }
    434       1.1       cgd 
    435      1.31  jdolecek const int vop_read_vp_offsets[] = {
    436       1.1       cgd 	VOPARG_OFFSETOF(struct vop_read_args,a_vp),
    437       1.1       cgd 	VDESC_NO_OFFSET
    438       1.1       cgd };
    439      1.33  jdolecek const struct vnodeop_desc vop_read_desc = {
    440      1.67     pooka 	VOP_READ_DESCOFFSET,
    441       1.1       cgd 	"vop_read",
    442       1.1       cgd 	0,
    443       1.1       cgd 	vop_read_vp_offsets,
    444       1.1       cgd 	VDESC_NO_OFFSET,
    445       1.1       cgd 	VOPARG_OFFSETOF(struct vop_read_args, a_cred),
    446       1.1       cgd 	VDESC_NO_OFFSET,
    447       1.1       cgd 	NULL,
    448       1.1       cgd };
    449      1.23   thorpej int
    450      1.60   thorpej VOP_READ(struct vnode *vp,
    451      1.60   thorpej     struct uio *uio,
    452      1.60   thorpej     int ioflag,
    453      1.65      elad     kauth_cred_t cred)
    454      1.23   thorpej {
    455      1.72        ad 	int error;
    456      1.72        ad 	bool mpsafe;
    457      1.23   thorpej 	struct vop_read_args a;
    458      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    459      1.50   thorpej 	int islocked_vp;
    460      1.50   thorpej #endif
    461      1.23   thorpej 	a.a_desc = VDESC(vop_read);
    462      1.23   thorpej 	a.a_vp = vp;
    463      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    464      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    465      1.50   thorpej 	if (islocked_vp != 1)
    466      1.50   thorpej 		panic("vop_read: vp: locked %d, expected %d", islocked_vp, 1);
    467      1.50   thorpej #endif
    468      1.23   thorpej 	a.a_uio = uio;
    469      1.23   thorpej 	a.a_ioflag = ioflag;
    470      1.23   thorpej 	a.a_cred = cred;
    471      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    472      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    473      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_read), &a));
    474      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    475      1.72        ad 	return error;
    476      1.23   thorpej }
    477       1.1       cgd 
    478      1.31  jdolecek const int vop_write_vp_offsets[] = {
    479       1.1       cgd 	VOPARG_OFFSETOF(struct vop_write_args,a_vp),
    480       1.1       cgd 	VDESC_NO_OFFSET
    481       1.1       cgd };
    482      1.33  jdolecek const struct vnodeop_desc vop_write_desc = {
    483      1.67     pooka 	VOP_WRITE_DESCOFFSET,
    484       1.1       cgd 	"vop_write",
    485       1.1       cgd 	0,
    486       1.1       cgd 	vop_write_vp_offsets,
    487       1.1       cgd 	VDESC_NO_OFFSET,
    488       1.1       cgd 	VOPARG_OFFSETOF(struct vop_write_args, a_cred),
    489       1.1       cgd 	VDESC_NO_OFFSET,
    490       1.1       cgd 	NULL,
    491       1.1       cgd };
    492      1.23   thorpej int
    493      1.60   thorpej VOP_WRITE(struct vnode *vp,
    494      1.60   thorpej     struct uio *uio,
    495      1.60   thorpej     int ioflag,
    496      1.65      elad     kauth_cred_t cred)
    497      1.23   thorpej {
    498      1.72        ad 	int error;
    499      1.72        ad 	bool mpsafe;
    500      1.23   thorpej 	struct vop_write_args a;
    501      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    502      1.50   thorpej 	int islocked_vp;
    503      1.50   thorpej #endif
    504      1.23   thorpej 	a.a_desc = VDESC(vop_write);
    505      1.23   thorpej 	a.a_vp = vp;
    506      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    507      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    508      1.50   thorpej 	if (islocked_vp != 1)
    509      1.50   thorpej 		panic("vop_write: vp: locked %d, expected %d", islocked_vp, 1);
    510      1.50   thorpej #endif
    511      1.23   thorpej 	a.a_uio = uio;
    512      1.23   thorpej 	a.a_ioflag = ioflag;
    513      1.23   thorpej 	a.a_cred = cred;
    514      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    515      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    516      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_write), &a));
    517      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    518      1.72        ad 	return error;
    519      1.23   thorpej }
    520       1.1       cgd 
    521      1.31  jdolecek const int vop_ioctl_vp_offsets[] = {
    522       1.1       cgd 	VOPARG_OFFSETOF(struct vop_ioctl_args,a_vp),
    523       1.1       cgd 	VDESC_NO_OFFSET
    524       1.1       cgd };
    525      1.33  jdolecek const struct vnodeop_desc vop_ioctl_desc = {
    526      1.67     pooka 	VOP_IOCTL_DESCOFFSET,
    527       1.1       cgd 	"vop_ioctl",
    528       1.1       cgd 	0,
    529       1.1       cgd 	vop_ioctl_vp_offsets,
    530       1.1       cgd 	VDESC_NO_OFFSET,
    531       1.1       cgd 	VOPARG_OFFSETOF(struct vop_ioctl_args, a_cred),
    532       1.1       cgd 	VDESC_NO_OFFSET,
    533       1.1       cgd 	NULL,
    534       1.1       cgd };
    535      1.23   thorpej int
    536      1.60   thorpej VOP_IOCTL(struct vnode *vp,
    537      1.60   thorpej     u_long command,
    538      1.60   thorpej     void *data,
    539      1.60   thorpej     int fflag,
    540      1.73     pooka     kauth_cred_t cred)
    541      1.23   thorpej {
    542      1.72        ad 	int error;
    543      1.72        ad 	bool mpsafe;
    544      1.23   thorpej 	struct vop_ioctl_args a;
    545      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    546      1.50   thorpej 	int islocked_vp;
    547      1.50   thorpej #endif
    548      1.23   thorpej 	a.a_desc = VDESC(vop_ioctl);
    549      1.23   thorpej 	a.a_vp = vp;
    550      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    551      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
    552      1.50   thorpej 	if (islocked_vp != 0)
    553      1.50   thorpej 		panic("vop_ioctl: vp: locked %d, expected %d", islocked_vp, 0);
    554      1.50   thorpej #endif
    555      1.23   thorpej 	a.a_command = command;
    556      1.23   thorpej 	a.a_data = data;
    557      1.23   thorpej 	a.a_fflag = fflag;
    558      1.23   thorpej 	a.a_cred = cred;
    559      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    560      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    561      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_ioctl), &a));
    562      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    563      1.72        ad 	return error;
    564      1.23   thorpej }
    565       1.1       cgd 
    566      1.31  jdolecek const int vop_fcntl_vp_offsets[] = {
    567      1.18  wrstuden 	VOPARG_OFFSETOF(struct vop_fcntl_args,a_vp),
    568      1.18  wrstuden 	VDESC_NO_OFFSET
    569      1.18  wrstuden };
    570      1.33  jdolecek const struct vnodeop_desc vop_fcntl_desc = {
    571      1.67     pooka 	VOP_FCNTL_DESCOFFSET,
    572      1.18  wrstuden 	"vop_fcntl",
    573      1.18  wrstuden 	0,
    574      1.18  wrstuden 	vop_fcntl_vp_offsets,
    575      1.18  wrstuden 	VDESC_NO_OFFSET,
    576      1.18  wrstuden 	VOPARG_OFFSETOF(struct vop_fcntl_args, a_cred),
    577      1.18  wrstuden 	VDESC_NO_OFFSET,
    578      1.18  wrstuden 	NULL,
    579      1.18  wrstuden };
    580      1.23   thorpej int
    581      1.60   thorpej VOP_FCNTL(struct vnode *vp,
    582      1.60   thorpej     u_int command,
    583      1.60   thorpej     void *data,
    584      1.60   thorpej     int fflag,
    585      1.73     pooka     kauth_cred_t cred)
    586      1.23   thorpej {
    587      1.72        ad 	int error;
    588      1.72        ad 	bool mpsafe;
    589      1.23   thorpej 	struct vop_fcntl_args a;
    590      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    591      1.50   thorpej 	int islocked_vp;
    592      1.50   thorpej #endif
    593      1.23   thorpej 	a.a_desc = VDESC(vop_fcntl);
    594      1.23   thorpej 	a.a_vp = vp;
    595      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    596      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
    597      1.64  perseant 	if (islocked_vp != 0)
    598      1.64  perseant 		panic("vop_fcntl: vp: locked %d, expected %d", islocked_vp, 0);
    599      1.50   thorpej #endif
    600      1.23   thorpej 	a.a_command = command;
    601      1.23   thorpej 	a.a_data = data;
    602      1.23   thorpej 	a.a_fflag = fflag;
    603      1.23   thorpej 	a.a_cred = cred;
    604      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    605      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    606      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_fcntl), &a));
    607      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    608      1.72        ad 	return error;
    609      1.23   thorpej }
    610      1.18  wrstuden 
    611      1.31  jdolecek const int vop_poll_vp_offsets[] = {
    612       1.3   mycroft 	VOPARG_OFFSETOF(struct vop_poll_args,a_vp),
    613       1.1       cgd 	VDESC_NO_OFFSET
    614       1.1       cgd };
    615      1.33  jdolecek const struct vnodeop_desc vop_poll_desc = {
    616      1.67     pooka 	VOP_POLL_DESCOFFSET,
    617       1.3   mycroft 	"vop_poll",
    618       1.1       cgd 	0,
    619       1.3   mycroft 	vop_poll_vp_offsets,
    620       1.1       cgd 	VDESC_NO_OFFSET,
    621       1.3   mycroft 	VDESC_NO_OFFSET,
    622       1.1       cgd 	VDESC_NO_OFFSET,
    623       1.1       cgd 	NULL,
    624       1.1       cgd };
    625      1.23   thorpej int
    626      1.60   thorpej VOP_POLL(struct vnode *vp,
    627      1.73     pooka     int events)
    628      1.23   thorpej {
    629      1.72        ad 	int error;
    630      1.72        ad 	bool mpsafe;
    631      1.23   thorpej 	struct vop_poll_args a;
    632      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    633      1.50   thorpej 	int islocked_vp;
    634      1.50   thorpej #endif
    635      1.23   thorpej 	a.a_desc = VDESC(vop_poll);
    636      1.23   thorpej 	a.a_vp = vp;
    637      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    638      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
    639      1.50   thorpej 	if (islocked_vp != 0)
    640      1.50   thorpej 		panic("vop_poll: vp: locked %d, expected %d", islocked_vp, 0);
    641      1.50   thorpej #endif
    642      1.23   thorpej 	a.a_events = events;
    643      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    644      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    645      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_poll), &a));
    646      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    647      1.72        ad 	return error;
    648      1.23   thorpej }
    649       1.1       cgd 
    650      1.40  jdolecek const int vop_kqfilter_vp_offsets[] = {
    651      1.40  jdolecek 	VOPARG_OFFSETOF(struct vop_kqfilter_args,a_vp),
    652      1.40  jdolecek 	VDESC_NO_OFFSET
    653      1.40  jdolecek };
    654      1.40  jdolecek const struct vnodeop_desc vop_kqfilter_desc = {
    655      1.67     pooka 	VOP_KQFILTER_DESCOFFSET,
    656      1.40  jdolecek 	"vop_kqfilter",
    657      1.40  jdolecek 	0,
    658      1.40  jdolecek 	vop_kqfilter_vp_offsets,
    659      1.40  jdolecek 	VDESC_NO_OFFSET,
    660      1.40  jdolecek 	VDESC_NO_OFFSET,
    661      1.40  jdolecek 	VDESC_NO_OFFSET,
    662      1.40  jdolecek 	NULL,
    663      1.40  jdolecek };
    664      1.40  jdolecek int
    665      1.60   thorpej VOP_KQFILTER(struct vnode *vp,
    666      1.60   thorpej     struct knote *kn)
    667      1.40  jdolecek {
    668      1.72        ad 	int error;
    669      1.72        ad 	bool mpsafe;
    670      1.40  jdolecek 	struct vop_kqfilter_args a;
    671      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    672      1.50   thorpej 	int islocked_vp;
    673      1.50   thorpej #endif
    674      1.40  jdolecek 	a.a_desc = VDESC(vop_kqfilter);
    675      1.40  jdolecek 	a.a_vp = vp;
    676      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    677      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
    678      1.50   thorpej 	if (islocked_vp != 0)
    679      1.50   thorpej 		panic("vop_kqfilter: vp: locked %d, expected %d", islocked_vp, 0);
    680      1.50   thorpej #endif
    681      1.40  jdolecek 	a.a_kn = kn;
    682      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    683      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    684      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_kqfilter), &a));
    685      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    686      1.72        ad 	return error;
    687      1.40  jdolecek }
    688      1.40  jdolecek 
    689      1.31  jdolecek const int vop_revoke_vp_offsets[] = {
    690      1.10      fvdl 	VOPARG_OFFSETOF(struct vop_revoke_args,a_vp),
    691      1.10      fvdl 	VDESC_NO_OFFSET
    692      1.10      fvdl };
    693      1.33  jdolecek const struct vnodeop_desc vop_revoke_desc = {
    694      1.67     pooka 	VOP_REVOKE_DESCOFFSET,
    695      1.10      fvdl 	"vop_revoke",
    696      1.10      fvdl 	0,
    697      1.10      fvdl 	vop_revoke_vp_offsets,
    698      1.10      fvdl 	VDESC_NO_OFFSET,
    699      1.10      fvdl 	VDESC_NO_OFFSET,
    700      1.10      fvdl 	VDESC_NO_OFFSET,
    701      1.10      fvdl 	NULL,
    702      1.10      fvdl };
    703      1.23   thorpej int
    704      1.60   thorpej VOP_REVOKE(struct vnode *vp,
    705      1.60   thorpej     int flags)
    706      1.23   thorpej {
    707      1.72        ad 	int error;
    708      1.72        ad 	bool mpsafe;
    709      1.23   thorpej 	struct vop_revoke_args a;
    710      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    711      1.50   thorpej 	int islocked_vp;
    712      1.50   thorpej #endif
    713      1.23   thorpej 	a.a_desc = VDESC(vop_revoke);
    714      1.23   thorpej 	a.a_vp = vp;
    715      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    716      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
    717      1.50   thorpej 	if (islocked_vp != 0)
    718      1.50   thorpej 		panic("vop_revoke: vp: locked %d, expected %d", islocked_vp, 0);
    719      1.50   thorpej #endif
    720      1.23   thorpej 	a.a_flags = flags;
    721      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    722      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    723      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_revoke), &a));
    724      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    725      1.72        ad 	return error;
    726      1.23   thorpej }
    727      1.10      fvdl 
    728      1.31  jdolecek const int vop_mmap_vp_offsets[] = {
    729       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mmap_args,a_vp),
    730       1.1       cgd 	VDESC_NO_OFFSET
    731       1.1       cgd };
    732      1.33  jdolecek const struct vnodeop_desc vop_mmap_desc = {
    733      1.67     pooka 	VOP_MMAP_DESCOFFSET,
    734       1.1       cgd 	"vop_mmap",
    735       1.1       cgd 	0,
    736       1.1       cgd 	vop_mmap_vp_offsets,
    737       1.1       cgd 	VDESC_NO_OFFSET,
    738       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mmap_args, a_cred),
    739       1.1       cgd 	VDESC_NO_OFFSET,
    740       1.1       cgd 	NULL,
    741       1.1       cgd };
    742      1.23   thorpej int
    743      1.60   thorpej VOP_MMAP(struct vnode *vp,
    744      1.70     pooka     vm_prot_t prot,
    745      1.73     pooka     kauth_cred_t cred)
    746      1.23   thorpej {
    747      1.72        ad 	int error;
    748      1.72        ad 	bool mpsafe;
    749      1.23   thorpej 	struct vop_mmap_args a;
    750      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    751      1.50   thorpej #endif
    752      1.23   thorpej 	a.a_desc = VDESC(vop_mmap);
    753      1.23   thorpej 	a.a_vp = vp;
    754      1.70     pooka 	a.a_prot = prot;
    755      1.23   thorpej 	a.a_cred = cred;
    756      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    757      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    758      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_mmap), &a));
    759      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    760      1.72        ad 	return error;
    761      1.23   thorpej }
    762       1.1       cgd 
    763      1.31  jdolecek const int vop_fsync_vp_offsets[] = {
    764       1.1       cgd 	VOPARG_OFFSETOF(struct vop_fsync_args,a_vp),
    765       1.1       cgd 	VDESC_NO_OFFSET
    766       1.1       cgd };
    767      1.33  jdolecek const struct vnodeop_desc vop_fsync_desc = {
    768      1.67     pooka 	VOP_FSYNC_DESCOFFSET,
    769       1.1       cgd 	"vop_fsync",
    770       1.1       cgd 	0,
    771       1.1       cgd 	vop_fsync_vp_offsets,
    772       1.1       cgd 	VDESC_NO_OFFSET,
    773       1.1       cgd 	VOPARG_OFFSETOF(struct vop_fsync_args, a_cred),
    774       1.1       cgd 	VDESC_NO_OFFSET,
    775       1.1       cgd 	NULL,
    776       1.1       cgd };
    777      1.23   thorpej int
    778      1.60   thorpej VOP_FSYNC(struct vnode *vp,
    779      1.65      elad     kauth_cred_t cred,
    780      1.60   thorpej     int flags,
    781      1.60   thorpej     off_t offlo,
    782      1.73     pooka     off_t offhi)
    783      1.23   thorpej {
    784      1.72        ad 	int error;
    785      1.72        ad 	bool mpsafe;
    786      1.23   thorpej 	struct vop_fsync_args a;
    787      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    788      1.50   thorpej 	int islocked_vp;
    789      1.50   thorpej #endif
    790      1.23   thorpej 	a.a_desc = VDESC(vop_fsync);
    791      1.23   thorpej 	a.a_vp = vp;
    792      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    793      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    794      1.50   thorpej 	if (islocked_vp != 1)
    795      1.50   thorpej 		panic("vop_fsync: vp: locked %d, expected %d", islocked_vp, 1);
    796      1.50   thorpej #endif
    797      1.23   thorpej 	a.a_cred = cred;
    798      1.23   thorpej 	a.a_flags = flags;
    799      1.25      fvdl 	a.a_offlo = offlo;
    800      1.25      fvdl 	a.a_offhi = offhi;
    801      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    802      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    803      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_fsync), &a));
    804      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    805      1.72        ad 	return error;
    806      1.23   thorpej }
    807       1.1       cgd 
    808      1.31  jdolecek const int vop_seek_vp_offsets[] = {
    809       1.1       cgd 	VOPARG_OFFSETOF(struct vop_seek_args,a_vp),
    810       1.1       cgd 	VDESC_NO_OFFSET
    811       1.1       cgd };
    812      1.33  jdolecek const struct vnodeop_desc vop_seek_desc = {
    813      1.67     pooka 	VOP_SEEK_DESCOFFSET,
    814       1.1       cgd 	"vop_seek",
    815       1.1       cgd 	0,
    816       1.1       cgd 	vop_seek_vp_offsets,
    817       1.1       cgd 	VDESC_NO_OFFSET,
    818       1.1       cgd 	VOPARG_OFFSETOF(struct vop_seek_args, a_cred),
    819       1.1       cgd 	VDESC_NO_OFFSET,
    820       1.1       cgd 	NULL,
    821       1.1       cgd };
    822      1.23   thorpej int
    823      1.60   thorpej VOP_SEEK(struct vnode *vp,
    824      1.60   thorpej     off_t oldoff,
    825      1.60   thorpej     off_t newoff,
    826      1.65      elad     kauth_cred_t cred)
    827      1.23   thorpej {
    828      1.72        ad 	int error;
    829      1.72        ad 	bool mpsafe;
    830      1.23   thorpej 	struct vop_seek_args a;
    831      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    832      1.50   thorpej #endif
    833      1.23   thorpej 	a.a_desc = VDESC(vop_seek);
    834      1.23   thorpej 	a.a_vp = vp;
    835      1.23   thorpej 	a.a_oldoff = oldoff;
    836      1.23   thorpej 	a.a_newoff = newoff;
    837      1.23   thorpej 	a.a_cred = cred;
    838      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
    839      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    840      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_seek), &a));
    841      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    842      1.72        ad 	return error;
    843      1.23   thorpej }
    844       1.1       cgd 
    845      1.31  jdolecek const int vop_remove_vp_offsets[] = {
    846       1.1       cgd 	VOPARG_OFFSETOF(struct vop_remove_args,a_dvp),
    847       1.1       cgd 	VOPARG_OFFSETOF(struct vop_remove_args,a_vp),
    848       1.1       cgd 	VDESC_NO_OFFSET
    849       1.1       cgd };
    850      1.33  jdolecek const struct vnodeop_desc vop_remove_desc = {
    851      1.67     pooka 	VOP_REMOVE_DESCOFFSET,
    852       1.1       cgd 	"vop_remove",
    853      1.17  wrstuden 	0 | VDESC_VP0_WILLPUT | VDESC_VP1_WILLPUT,
    854       1.1       cgd 	vop_remove_vp_offsets,
    855       1.1       cgd 	VDESC_NO_OFFSET,
    856       1.1       cgd 	VDESC_NO_OFFSET,
    857       1.1       cgd 	VOPARG_OFFSETOF(struct vop_remove_args, a_cnp),
    858       1.1       cgd 	NULL,
    859       1.1       cgd };
    860      1.23   thorpej int
    861      1.60   thorpej VOP_REMOVE(struct vnode *dvp,
    862      1.60   thorpej     struct vnode *vp,
    863      1.60   thorpej     struct componentname *cnp)
    864      1.23   thorpej {
    865      1.72        ad 	int error;
    866      1.72        ad 	bool mpsafe;
    867      1.23   thorpej 	struct vop_remove_args a;
    868      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    869      1.50   thorpej 	int islocked_dvp;
    870      1.50   thorpej 	int islocked_vp;
    871      1.50   thorpej #endif
    872      1.23   thorpej 	a.a_desc = VDESC(vop_remove);
    873      1.23   thorpej 	a.a_dvp = dvp;
    874      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    875      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
    876      1.50   thorpej 	if (islocked_dvp != 1)
    877      1.50   thorpej 		panic("vop_remove: dvp: locked %d, expected %d", islocked_dvp, 1);
    878      1.50   thorpej #endif
    879      1.23   thorpej 	a.a_vp = vp;
    880      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    881      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
    882      1.50   thorpej 	if (islocked_vp != 1)
    883      1.50   thorpej 		panic("vop_remove: vp: locked %d, expected %d", islocked_vp, 1);
    884      1.50   thorpej #endif
    885      1.23   thorpej 	a.a_cnp = cnp;
    886      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
    887      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    888      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_remove), &a));
    889      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    890      1.72        ad 	return error;
    891      1.23   thorpej }
    892       1.1       cgd 
    893      1.31  jdolecek const int vop_link_vp_offsets[] = {
    894       1.1       cgd 	VOPARG_OFFSETOF(struct vop_link_args,a_dvp),
    895       1.1       cgd 	VOPARG_OFFSETOF(struct vop_link_args,a_vp),
    896       1.1       cgd 	VDESC_NO_OFFSET
    897       1.1       cgd };
    898      1.33  jdolecek const struct vnodeop_desc vop_link_desc = {
    899      1.67     pooka 	VOP_LINK_DESCOFFSET,
    900       1.1       cgd 	"vop_link",
    901      1.17  wrstuden 	0 | VDESC_VP0_WILLPUT,
    902       1.1       cgd 	vop_link_vp_offsets,
    903       1.1       cgd 	VDESC_NO_OFFSET,
    904       1.1       cgd 	VDESC_NO_OFFSET,
    905       1.1       cgd 	VOPARG_OFFSETOF(struct vop_link_args, a_cnp),
    906       1.1       cgd 	NULL,
    907       1.1       cgd };
    908      1.23   thorpej int
    909      1.60   thorpej VOP_LINK(struct vnode *dvp,
    910      1.60   thorpej     struct vnode *vp,
    911      1.60   thorpej     struct componentname *cnp)
    912      1.23   thorpej {
    913      1.72        ad 	int error;
    914      1.72        ad 	bool mpsafe;
    915      1.23   thorpej 	struct vop_link_args a;
    916      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    917      1.50   thorpej 	int islocked_dvp;
    918      1.50   thorpej 	int islocked_vp;
    919      1.50   thorpej #endif
    920      1.23   thorpej 	a.a_desc = VDESC(vop_link);
    921      1.23   thorpej 	a.a_dvp = dvp;
    922      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    923      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
    924      1.50   thorpej 	if (islocked_dvp != 1)
    925      1.50   thorpej 		panic("vop_link: dvp: locked %d, expected %d", islocked_dvp, 1);
    926      1.50   thorpej #endif
    927      1.23   thorpej 	a.a_vp = vp;
    928      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    929      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
    930      1.50   thorpej 	if (islocked_vp != 0)
    931      1.50   thorpej 		panic("vop_link: vp: locked %d, expected %d", islocked_vp, 0);
    932      1.50   thorpej #endif
    933      1.23   thorpej 	a.a_cnp = cnp;
    934      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
    935      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    936      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_link), &a));
    937      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
    938      1.72        ad 	return error;
    939      1.23   thorpej }
    940       1.1       cgd 
    941      1.31  jdolecek const int vop_rename_vp_offsets[] = {
    942       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rename_args,a_fdvp),
    943       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rename_args,a_fvp),
    944       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rename_args,a_tdvp),
    945       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rename_args,a_tvp),
    946       1.1       cgd 	VDESC_NO_OFFSET
    947       1.1       cgd };
    948      1.33  jdolecek const struct vnodeop_desc vop_rename_desc = {
    949      1.67     pooka 	VOP_RENAME_DESCOFFSET,
    950       1.1       cgd 	"vop_rename",
    951      1.42  jdolecek 	0 | VDESC_VP0_WILLRELE | VDESC_VP1_WILLRELE | VDESC_VP2_WILLPUT | VDESC_VP3_WILLPUT,
    952       1.1       cgd 	vop_rename_vp_offsets,
    953       1.1       cgd 	VDESC_NO_OFFSET,
    954       1.1       cgd 	VDESC_NO_OFFSET,
    955       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rename_args, a_fcnp),
    956       1.1       cgd 	NULL,
    957       1.1       cgd };
    958      1.23   thorpej int
    959      1.60   thorpej VOP_RENAME(struct vnode *fdvp,
    960      1.60   thorpej     struct vnode *fvp,
    961      1.60   thorpej     struct componentname *fcnp,
    962      1.60   thorpej     struct vnode *tdvp,
    963      1.60   thorpej     struct vnode *tvp,
    964      1.60   thorpej     struct componentname *tcnp)
    965      1.23   thorpej {
    966      1.72        ad 	int error;
    967      1.72        ad 	bool mpsafe;
    968      1.23   thorpej 	struct vop_rename_args a;
    969      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    970      1.50   thorpej 	int islocked_fdvp;
    971      1.50   thorpej 	int islocked_fvp;
    972      1.50   thorpej 	int islocked_tdvp;
    973      1.50   thorpej #endif
    974      1.23   thorpej 	a.a_desc = VDESC(vop_rename);
    975      1.23   thorpej 	a.a_fdvp = fdvp;
    976      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    977      1.71        ad 	islocked_fdvp = (fdvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(fdvp) == LK_EXCLUSIVE) : 0;
    978      1.50   thorpej 	if (islocked_fdvp != 0)
    979      1.50   thorpej 		panic("vop_rename: fdvp: locked %d, expected %d", islocked_fdvp, 0);
    980      1.50   thorpej #endif
    981      1.23   thorpej 	a.a_fvp = fvp;
    982      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    983      1.71        ad 	islocked_fvp = (fvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(fvp) == LK_EXCLUSIVE) : 0;
    984      1.50   thorpej 	if (islocked_fvp != 0)
    985      1.50   thorpej 		panic("vop_rename: fvp: locked %d, expected %d", islocked_fvp, 0);
    986      1.50   thorpej #endif
    987      1.23   thorpej 	a.a_fcnp = fcnp;
    988      1.23   thorpej 	a.a_tdvp = tdvp;
    989      1.50   thorpej #ifdef VNODE_LOCKDEBUG
    990      1.71        ad 	islocked_tdvp = (tdvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(tdvp) == LK_EXCLUSIVE) : 1;
    991      1.50   thorpej 	if (islocked_tdvp != 1)
    992      1.50   thorpej 		panic("vop_rename: tdvp: locked %d, expected %d", islocked_tdvp, 1);
    993      1.50   thorpej #endif
    994      1.23   thorpej 	a.a_tvp = tvp;
    995      1.23   thorpej 	a.a_tcnp = tcnp;
    996      1.72        ad 	mpsafe = (fdvp->v_vflag & VV_MPSAFE);
    997      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
    998      1.72        ad 	error = (VCALL(fdvp, VOFFSET(vop_rename), &a));
    999      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1000      1.72        ad 	return error;
   1001      1.23   thorpej }
   1002       1.1       cgd 
   1003      1.31  jdolecek const int vop_mkdir_vp_offsets[] = {
   1004       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mkdir_args,a_dvp),
   1005       1.1       cgd 	VDESC_NO_OFFSET
   1006       1.1       cgd };
   1007      1.33  jdolecek const struct vnodeop_desc vop_mkdir_desc = {
   1008      1.67     pooka 	VOP_MKDIR_DESCOFFSET,
   1009       1.1       cgd 	"vop_mkdir",
   1010      1.17  wrstuden 	0 | VDESC_VP0_WILLPUT,
   1011       1.1       cgd 	vop_mkdir_vp_offsets,
   1012       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mkdir_args, a_vpp),
   1013       1.1       cgd 	VDESC_NO_OFFSET,
   1014       1.1       cgd 	VOPARG_OFFSETOF(struct vop_mkdir_args, a_cnp),
   1015       1.1       cgd 	NULL,
   1016       1.1       cgd };
   1017      1.23   thorpej int
   1018      1.60   thorpej VOP_MKDIR(struct vnode *dvp,
   1019      1.60   thorpej     struct vnode **vpp,
   1020      1.60   thorpej     struct componentname *cnp,
   1021      1.60   thorpej     struct vattr *vap)
   1022      1.23   thorpej {
   1023      1.72        ad 	int error;
   1024      1.72        ad 	bool mpsafe;
   1025      1.23   thorpej 	struct vop_mkdir_args a;
   1026      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1027      1.50   thorpej 	int islocked_dvp;
   1028      1.50   thorpej #endif
   1029      1.23   thorpej 	a.a_desc = VDESC(vop_mkdir);
   1030      1.23   thorpej 	a.a_dvp = dvp;
   1031      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1032      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
   1033      1.50   thorpej 	if (islocked_dvp != 1)
   1034      1.50   thorpej 		panic("vop_mkdir: dvp: locked %d, expected %d", islocked_dvp, 1);
   1035      1.50   thorpej #endif
   1036      1.23   thorpej 	a.a_vpp = vpp;
   1037      1.23   thorpej 	a.a_cnp = cnp;
   1038      1.23   thorpej 	a.a_vap = vap;
   1039      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
   1040      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1041      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_mkdir), &a));
   1042      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1043      1.69     pooka #ifdef DIAGNOSTIC
   1044      1.72        ad 	if (error == 0)
   1045      1.69     pooka 		KASSERT((*vpp)->v_size != VSIZENOTSET
   1046      1.69     pooka 		    && (*vpp)->v_writesize != VSIZENOTSET);
   1047      1.69     pooka #endif /* DIAGNOSTIC */
   1048      1.72        ad 	return error;
   1049      1.23   thorpej }
   1050       1.1       cgd 
   1051      1.31  jdolecek const int vop_rmdir_vp_offsets[] = {
   1052       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rmdir_args,a_dvp),
   1053       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rmdir_args,a_vp),
   1054       1.1       cgd 	VDESC_NO_OFFSET
   1055       1.1       cgd };
   1056      1.33  jdolecek const struct vnodeop_desc vop_rmdir_desc = {
   1057      1.67     pooka 	VOP_RMDIR_DESCOFFSET,
   1058       1.1       cgd 	"vop_rmdir",
   1059      1.17  wrstuden 	0 | VDESC_VP0_WILLPUT | VDESC_VP1_WILLPUT,
   1060       1.1       cgd 	vop_rmdir_vp_offsets,
   1061       1.1       cgd 	VDESC_NO_OFFSET,
   1062       1.1       cgd 	VDESC_NO_OFFSET,
   1063       1.1       cgd 	VOPARG_OFFSETOF(struct vop_rmdir_args, a_cnp),
   1064       1.1       cgd 	NULL,
   1065       1.1       cgd };
   1066      1.23   thorpej int
   1067      1.60   thorpej VOP_RMDIR(struct vnode *dvp,
   1068      1.60   thorpej     struct vnode *vp,
   1069      1.60   thorpej     struct componentname *cnp)
   1070      1.23   thorpej {
   1071      1.72        ad 	int error;
   1072      1.72        ad 	bool mpsafe;
   1073      1.23   thorpej 	struct vop_rmdir_args a;
   1074      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1075      1.50   thorpej 	int islocked_dvp;
   1076      1.50   thorpej 	int islocked_vp;
   1077      1.50   thorpej #endif
   1078      1.23   thorpej 	a.a_desc = VDESC(vop_rmdir);
   1079      1.23   thorpej 	a.a_dvp = dvp;
   1080      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1081      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
   1082      1.50   thorpej 	if (islocked_dvp != 1)
   1083      1.50   thorpej 		panic("vop_rmdir: dvp: locked %d, expected %d", islocked_dvp, 1);
   1084      1.50   thorpej #endif
   1085      1.23   thorpej 	a.a_vp = vp;
   1086      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1087      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1088      1.50   thorpej 	if (islocked_vp != 1)
   1089      1.50   thorpej 		panic("vop_rmdir: vp: locked %d, expected %d", islocked_vp, 1);
   1090      1.50   thorpej #endif
   1091      1.23   thorpej 	a.a_cnp = cnp;
   1092      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
   1093      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1094      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_rmdir), &a));
   1095      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1096      1.72        ad 	return error;
   1097      1.23   thorpej }
   1098       1.1       cgd 
   1099      1.31  jdolecek const int vop_symlink_vp_offsets[] = {
   1100       1.1       cgd 	VOPARG_OFFSETOF(struct vop_symlink_args,a_dvp),
   1101       1.1       cgd 	VDESC_NO_OFFSET
   1102       1.1       cgd };
   1103      1.33  jdolecek const struct vnodeop_desc vop_symlink_desc = {
   1104      1.67     pooka 	VOP_SYMLINK_DESCOFFSET,
   1105       1.1       cgd 	"vop_symlink",
   1106      1.37     assar 	0 | VDESC_VP0_WILLPUT,
   1107       1.1       cgd 	vop_symlink_vp_offsets,
   1108       1.1       cgd 	VOPARG_OFFSETOF(struct vop_symlink_args, a_vpp),
   1109       1.1       cgd 	VDESC_NO_OFFSET,
   1110       1.1       cgd 	VOPARG_OFFSETOF(struct vop_symlink_args, a_cnp),
   1111       1.1       cgd 	NULL,
   1112       1.1       cgd };
   1113      1.23   thorpej int
   1114      1.60   thorpej VOP_SYMLINK(struct vnode *dvp,
   1115      1.60   thorpej     struct vnode **vpp,
   1116      1.60   thorpej     struct componentname *cnp,
   1117      1.60   thorpej     struct vattr *vap,
   1118      1.60   thorpej     char *target)
   1119      1.23   thorpej {
   1120      1.72        ad 	int error;
   1121      1.72        ad 	bool mpsafe;
   1122      1.23   thorpej 	struct vop_symlink_args a;
   1123      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1124      1.50   thorpej 	int islocked_dvp;
   1125      1.50   thorpej #endif
   1126      1.23   thorpej 	a.a_desc = VDESC(vop_symlink);
   1127      1.23   thorpej 	a.a_dvp = dvp;
   1128      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1129      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
   1130      1.50   thorpej 	if (islocked_dvp != 1)
   1131      1.50   thorpej 		panic("vop_symlink: dvp: locked %d, expected %d", islocked_dvp, 1);
   1132      1.50   thorpej #endif
   1133      1.23   thorpej 	a.a_vpp = vpp;
   1134      1.23   thorpej 	a.a_cnp = cnp;
   1135      1.23   thorpej 	a.a_vap = vap;
   1136      1.23   thorpej 	a.a_target = target;
   1137      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
   1138      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1139      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_symlink), &a));
   1140      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1141      1.69     pooka #ifdef DIAGNOSTIC
   1142      1.72        ad 	if (error == 0)
   1143      1.69     pooka 		KASSERT((*vpp)->v_size != VSIZENOTSET
   1144      1.69     pooka 		    && (*vpp)->v_writesize != VSIZENOTSET);
   1145      1.69     pooka #endif /* DIAGNOSTIC */
   1146      1.72        ad 	return error;
   1147      1.23   thorpej }
   1148       1.1       cgd 
   1149      1.31  jdolecek const int vop_readdir_vp_offsets[] = {
   1150       1.1       cgd 	VOPARG_OFFSETOF(struct vop_readdir_args,a_vp),
   1151       1.1       cgd 	VDESC_NO_OFFSET
   1152       1.1       cgd };
   1153      1.33  jdolecek const struct vnodeop_desc vop_readdir_desc = {
   1154      1.67     pooka 	VOP_READDIR_DESCOFFSET,
   1155       1.1       cgd 	"vop_readdir",
   1156       1.1       cgd 	0,
   1157       1.1       cgd 	vop_readdir_vp_offsets,
   1158       1.1       cgd 	VDESC_NO_OFFSET,
   1159       1.1       cgd 	VOPARG_OFFSETOF(struct vop_readdir_args, a_cred),
   1160       1.1       cgd 	VDESC_NO_OFFSET,
   1161       1.1       cgd 	NULL,
   1162       1.1       cgd };
   1163      1.23   thorpej int
   1164      1.60   thorpej VOP_READDIR(struct vnode *vp,
   1165      1.60   thorpej     struct uio *uio,
   1166      1.65      elad     kauth_cred_t cred,
   1167      1.60   thorpej     int *eofflag,
   1168      1.60   thorpej     off_t **cookies,
   1169      1.60   thorpej     int *ncookies)
   1170      1.23   thorpej {
   1171      1.72        ad 	int error;
   1172      1.72        ad 	bool mpsafe;
   1173      1.23   thorpej 	struct vop_readdir_args a;
   1174      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1175      1.50   thorpej 	int islocked_vp;
   1176      1.50   thorpej #endif
   1177      1.23   thorpej 	a.a_desc = VDESC(vop_readdir);
   1178      1.23   thorpej 	a.a_vp = vp;
   1179      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1180      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1181      1.50   thorpej 	if (islocked_vp != 1)
   1182      1.50   thorpej 		panic("vop_readdir: vp: locked %d, expected %d", islocked_vp, 1);
   1183      1.50   thorpej #endif
   1184      1.23   thorpej 	a.a_uio = uio;
   1185      1.23   thorpej 	a.a_cred = cred;
   1186      1.23   thorpej 	a.a_eofflag = eofflag;
   1187      1.23   thorpej 	a.a_cookies = cookies;
   1188      1.23   thorpej 	a.a_ncookies = ncookies;
   1189      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1190      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1191      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_readdir), &a));
   1192      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1193      1.72        ad 	return error;
   1194      1.23   thorpej }
   1195       1.1       cgd 
   1196      1.31  jdolecek const int vop_readlink_vp_offsets[] = {
   1197       1.1       cgd 	VOPARG_OFFSETOF(struct vop_readlink_args,a_vp),
   1198       1.1       cgd 	VDESC_NO_OFFSET
   1199       1.1       cgd };
   1200      1.33  jdolecek const struct vnodeop_desc vop_readlink_desc = {
   1201      1.67     pooka 	VOP_READLINK_DESCOFFSET,
   1202       1.1       cgd 	"vop_readlink",
   1203       1.1       cgd 	0,
   1204       1.1       cgd 	vop_readlink_vp_offsets,
   1205       1.1       cgd 	VDESC_NO_OFFSET,
   1206       1.1       cgd 	VOPARG_OFFSETOF(struct vop_readlink_args, a_cred),
   1207       1.1       cgd 	VDESC_NO_OFFSET,
   1208       1.1       cgd 	NULL,
   1209       1.1       cgd };
   1210      1.23   thorpej int
   1211      1.60   thorpej VOP_READLINK(struct vnode *vp,
   1212      1.60   thorpej     struct uio *uio,
   1213      1.65      elad     kauth_cred_t cred)
   1214      1.23   thorpej {
   1215      1.72        ad 	int error;
   1216      1.72        ad 	bool mpsafe;
   1217      1.23   thorpej 	struct vop_readlink_args a;
   1218      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1219      1.50   thorpej 	int islocked_vp;
   1220      1.50   thorpej #endif
   1221      1.23   thorpej 	a.a_desc = VDESC(vop_readlink);
   1222      1.23   thorpej 	a.a_vp = vp;
   1223      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1224      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1225      1.50   thorpej 	if (islocked_vp != 1)
   1226      1.50   thorpej 		panic("vop_readlink: vp: locked %d, expected %d", islocked_vp, 1);
   1227      1.50   thorpej #endif
   1228      1.23   thorpej 	a.a_uio = uio;
   1229      1.23   thorpej 	a.a_cred = cred;
   1230      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1231      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1232      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_readlink), &a));
   1233      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1234      1.72        ad 	return error;
   1235      1.23   thorpej }
   1236       1.1       cgd 
   1237      1.31  jdolecek const int vop_abortop_vp_offsets[] = {
   1238       1.1       cgd 	VOPARG_OFFSETOF(struct vop_abortop_args,a_dvp),
   1239       1.1       cgd 	VDESC_NO_OFFSET
   1240       1.1       cgd };
   1241      1.33  jdolecek const struct vnodeop_desc vop_abortop_desc = {
   1242      1.67     pooka 	VOP_ABORTOP_DESCOFFSET,
   1243       1.1       cgd 	"vop_abortop",
   1244       1.1       cgd 	0,
   1245       1.1       cgd 	vop_abortop_vp_offsets,
   1246       1.1       cgd 	VDESC_NO_OFFSET,
   1247       1.1       cgd 	VDESC_NO_OFFSET,
   1248       1.1       cgd 	VOPARG_OFFSETOF(struct vop_abortop_args, a_cnp),
   1249       1.1       cgd 	NULL,
   1250       1.1       cgd };
   1251      1.23   thorpej int
   1252      1.60   thorpej VOP_ABORTOP(struct vnode *dvp,
   1253      1.60   thorpej     struct componentname *cnp)
   1254      1.23   thorpej {
   1255      1.72        ad 	int error;
   1256      1.72        ad 	bool mpsafe;
   1257      1.23   thorpej 	struct vop_abortop_args a;
   1258      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1259      1.50   thorpej #endif
   1260      1.23   thorpej 	a.a_desc = VDESC(vop_abortop);
   1261      1.23   thorpej 	a.a_dvp = dvp;
   1262      1.23   thorpej 	a.a_cnp = cnp;
   1263      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
   1264      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1265      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_abortop), &a));
   1266      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1267      1.72        ad 	return error;
   1268      1.23   thorpej }
   1269       1.1       cgd 
   1270      1.31  jdolecek const int vop_inactive_vp_offsets[] = {
   1271       1.1       cgd 	VOPARG_OFFSETOF(struct vop_inactive_args,a_vp),
   1272       1.1       cgd 	VDESC_NO_OFFSET
   1273       1.1       cgd };
   1274      1.33  jdolecek const struct vnodeop_desc vop_inactive_desc = {
   1275      1.67     pooka 	VOP_INACTIVE_DESCOFFSET,
   1276       1.1       cgd 	"vop_inactive",
   1277      1.17  wrstuden 	0 | VDESC_VP0_WILLUNLOCK,
   1278       1.1       cgd 	vop_inactive_vp_offsets,
   1279       1.1       cgd 	VDESC_NO_OFFSET,
   1280       1.1       cgd 	VDESC_NO_OFFSET,
   1281       1.1       cgd 	VDESC_NO_OFFSET,
   1282       1.1       cgd 	NULL,
   1283       1.1       cgd };
   1284      1.23   thorpej int
   1285      1.75        ad VOP_INACTIVE(struct vnode *vp,
   1286      1.75        ad     bool *recycle)
   1287      1.23   thorpej {
   1288      1.72        ad 	int error;
   1289      1.72        ad 	bool mpsafe;
   1290      1.23   thorpej 	struct vop_inactive_args a;
   1291      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1292      1.50   thorpej 	int islocked_vp;
   1293      1.50   thorpej #endif
   1294      1.23   thorpej 	a.a_desc = VDESC(vop_inactive);
   1295      1.23   thorpej 	a.a_vp = vp;
   1296      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1297      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1298      1.50   thorpej 	if (islocked_vp != 1)
   1299      1.50   thorpej 		panic("vop_inactive: vp: locked %d, expected %d", islocked_vp, 1);
   1300      1.50   thorpej #endif
   1301      1.75        ad 	a.a_recycle = recycle;
   1302      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1303      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1304      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_inactive), &a));
   1305      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1306      1.72        ad 	return error;
   1307      1.23   thorpej }
   1308       1.1       cgd 
   1309      1.31  jdolecek const int vop_reclaim_vp_offsets[] = {
   1310       1.1       cgd 	VOPARG_OFFSETOF(struct vop_reclaim_args,a_vp),
   1311       1.1       cgd 	VDESC_NO_OFFSET
   1312       1.1       cgd };
   1313      1.33  jdolecek const struct vnodeop_desc vop_reclaim_desc = {
   1314      1.67     pooka 	VOP_RECLAIM_DESCOFFSET,
   1315       1.1       cgd 	"vop_reclaim",
   1316       1.1       cgd 	0,
   1317       1.1       cgd 	vop_reclaim_vp_offsets,
   1318       1.1       cgd 	VDESC_NO_OFFSET,
   1319       1.1       cgd 	VDESC_NO_OFFSET,
   1320       1.1       cgd 	VDESC_NO_OFFSET,
   1321       1.1       cgd 	NULL,
   1322       1.1       cgd };
   1323      1.23   thorpej int
   1324      1.73     pooka VOP_RECLAIM(struct vnode *vp)
   1325      1.23   thorpej {
   1326      1.72        ad 	int error;
   1327      1.72        ad 	bool mpsafe;
   1328      1.23   thorpej 	struct vop_reclaim_args a;
   1329      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1330      1.50   thorpej 	int islocked_vp;
   1331      1.50   thorpej #endif
   1332      1.23   thorpej 	a.a_desc = VDESC(vop_reclaim);
   1333      1.23   thorpej 	a.a_vp = vp;
   1334      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1335      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
   1336      1.50   thorpej 	if (islocked_vp != 0)
   1337      1.50   thorpej 		panic("vop_reclaim: vp: locked %d, expected %d", islocked_vp, 0);
   1338      1.50   thorpej #endif
   1339      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1340      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1341      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_reclaim), &a));
   1342      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1343      1.72        ad 	return error;
   1344      1.23   thorpej }
   1345       1.1       cgd 
   1346      1.31  jdolecek const int vop_lock_vp_offsets[] = {
   1347       1.1       cgd 	VOPARG_OFFSETOF(struct vop_lock_args,a_vp),
   1348       1.1       cgd 	VDESC_NO_OFFSET
   1349       1.1       cgd };
   1350      1.33  jdolecek const struct vnodeop_desc vop_lock_desc = {
   1351      1.67     pooka 	VOP_LOCK_DESCOFFSET,
   1352       1.1       cgd 	"vop_lock",
   1353       1.1       cgd 	0,
   1354       1.1       cgd 	vop_lock_vp_offsets,
   1355       1.1       cgd 	VDESC_NO_OFFSET,
   1356       1.1       cgd 	VDESC_NO_OFFSET,
   1357       1.1       cgd 	VDESC_NO_OFFSET,
   1358       1.1       cgd 	NULL,
   1359       1.1       cgd };
   1360      1.23   thorpej int
   1361      1.60   thorpej VOP_LOCK(struct vnode *vp,
   1362      1.60   thorpej     int flags)
   1363      1.23   thorpej {
   1364      1.72        ad 	int error;
   1365      1.72        ad 	bool mpsafe;
   1366      1.23   thorpej 	struct vop_lock_args a;
   1367      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1368      1.50   thorpej 	int islocked_vp;
   1369      1.50   thorpej #endif
   1370      1.23   thorpej 	a.a_desc = VDESC(vop_lock);
   1371      1.23   thorpej 	a.a_vp = vp;
   1372      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1373      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
   1374      1.50   thorpej 	if (islocked_vp != 0)
   1375      1.50   thorpej 		panic("vop_lock: vp: locked %d, expected %d", islocked_vp, 0);
   1376      1.50   thorpej #endif
   1377      1.23   thorpej 	a.a_flags = flags;
   1378      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1379      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1380      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_lock), &a));
   1381      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1382      1.72        ad 	return error;
   1383      1.23   thorpej }
   1384       1.1       cgd 
   1385      1.31  jdolecek const int vop_unlock_vp_offsets[] = {
   1386       1.1       cgd 	VOPARG_OFFSETOF(struct vop_unlock_args,a_vp),
   1387       1.1       cgd 	VDESC_NO_OFFSET
   1388       1.1       cgd };
   1389      1.33  jdolecek const struct vnodeop_desc vop_unlock_desc = {
   1390      1.67     pooka 	VOP_UNLOCK_DESCOFFSET,
   1391       1.1       cgd 	"vop_unlock",
   1392       1.1       cgd 	0,
   1393       1.1       cgd 	vop_unlock_vp_offsets,
   1394       1.1       cgd 	VDESC_NO_OFFSET,
   1395       1.1       cgd 	VDESC_NO_OFFSET,
   1396       1.1       cgd 	VDESC_NO_OFFSET,
   1397       1.1       cgd 	NULL,
   1398       1.1       cgd };
   1399      1.23   thorpej int
   1400      1.60   thorpej VOP_UNLOCK(struct vnode *vp,
   1401      1.60   thorpej     int flags)
   1402      1.23   thorpej {
   1403      1.72        ad 	int error;
   1404      1.72        ad 	bool mpsafe;
   1405      1.23   thorpej 	struct vop_unlock_args a;
   1406      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1407      1.50   thorpej 	int islocked_vp;
   1408      1.50   thorpej #endif
   1409      1.23   thorpej 	a.a_desc = VDESC(vop_unlock);
   1410      1.23   thorpej 	a.a_vp = vp;
   1411      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1412      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1413      1.50   thorpej 	if (islocked_vp != 1)
   1414      1.50   thorpej 		panic("vop_unlock: vp: locked %d, expected %d", islocked_vp, 1);
   1415      1.50   thorpej #endif
   1416      1.23   thorpej 	a.a_flags = flags;
   1417      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1418      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1419      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_unlock), &a));
   1420      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1421      1.72        ad 	return error;
   1422      1.23   thorpej }
   1423       1.1       cgd 
   1424      1.31  jdolecek const int vop_bmap_vp_offsets[] = {
   1425       1.1       cgd 	VOPARG_OFFSETOF(struct vop_bmap_args,a_vp),
   1426       1.1       cgd 	VDESC_NO_OFFSET
   1427       1.1       cgd };
   1428      1.33  jdolecek const struct vnodeop_desc vop_bmap_desc = {
   1429      1.67     pooka 	VOP_BMAP_DESCOFFSET,
   1430       1.1       cgd 	"vop_bmap",
   1431       1.1       cgd 	0,
   1432       1.1       cgd 	vop_bmap_vp_offsets,
   1433       1.1       cgd 	VOPARG_OFFSETOF(struct vop_bmap_args, a_vpp),
   1434       1.1       cgd 	VDESC_NO_OFFSET,
   1435       1.1       cgd 	VDESC_NO_OFFSET,
   1436       1.1       cgd 	NULL,
   1437       1.1       cgd };
   1438      1.23   thorpej int
   1439      1.60   thorpej VOP_BMAP(struct vnode *vp,
   1440      1.60   thorpej     daddr_t bn,
   1441      1.60   thorpej     struct vnode **vpp,
   1442      1.60   thorpej     daddr_t *bnp,
   1443      1.60   thorpej     int *runp)
   1444      1.23   thorpej {
   1445      1.72        ad 	int error;
   1446      1.72        ad 	bool mpsafe;
   1447      1.23   thorpej 	struct vop_bmap_args a;
   1448      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1449      1.50   thorpej #endif
   1450      1.23   thorpej 	a.a_desc = VDESC(vop_bmap);
   1451      1.23   thorpej 	a.a_vp = vp;
   1452      1.23   thorpej 	a.a_bn = bn;
   1453      1.23   thorpej 	a.a_vpp = vpp;
   1454      1.23   thorpej 	a.a_bnp = bnp;
   1455      1.23   thorpej 	a.a_runp = runp;
   1456      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1457      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1458      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_bmap), &a));
   1459      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1460      1.72        ad 	return error;
   1461      1.23   thorpej }
   1462       1.1       cgd 
   1463      1.46   hannken const int vop_strategy_vp_offsets[] = {
   1464      1.46   hannken 	VOPARG_OFFSETOF(struct vop_strategy_args,a_vp),
   1465      1.46   hannken 	VDESC_NO_OFFSET
   1466      1.46   hannken };
   1467      1.46   hannken const struct vnodeop_desc vop_strategy_desc = {
   1468      1.67     pooka 	VOP_STRATEGY_DESCOFFSET,
   1469      1.46   hannken 	"vop_strategy",
   1470      1.46   hannken 	0,
   1471      1.46   hannken 	vop_strategy_vp_offsets,
   1472      1.46   hannken 	VDESC_NO_OFFSET,
   1473      1.46   hannken 	VDESC_NO_OFFSET,
   1474      1.46   hannken 	VDESC_NO_OFFSET,
   1475      1.46   hannken 	NULL,
   1476      1.46   hannken };
   1477      1.46   hannken int
   1478      1.60   thorpej VOP_STRATEGY(struct vnode *vp,
   1479      1.60   thorpej     struct buf *bp)
   1480      1.46   hannken {
   1481      1.72        ad 	int error;
   1482      1.72        ad 	bool mpsafe;
   1483      1.46   hannken 	struct vop_strategy_args a;
   1484      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1485      1.50   thorpej #endif
   1486      1.46   hannken 	a.a_desc = VDESC(vop_strategy);
   1487      1.46   hannken 	a.a_vp = vp;
   1488      1.46   hannken 	a.a_bp = bp;
   1489      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1490      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1491      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_strategy), &a));
   1492      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1493      1.72        ad 	return error;
   1494      1.46   hannken }
   1495      1.46   hannken 
   1496      1.31  jdolecek const int vop_print_vp_offsets[] = {
   1497       1.1       cgd 	VOPARG_OFFSETOF(struct vop_print_args,a_vp),
   1498       1.1       cgd 	VDESC_NO_OFFSET
   1499       1.1       cgd };
   1500      1.33  jdolecek const struct vnodeop_desc vop_print_desc = {
   1501      1.67     pooka 	VOP_PRINT_DESCOFFSET,
   1502       1.1       cgd 	"vop_print",
   1503       1.1       cgd 	0,
   1504       1.1       cgd 	vop_print_vp_offsets,
   1505       1.1       cgd 	VDESC_NO_OFFSET,
   1506       1.1       cgd 	VDESC_NO_OFFSET,
   1507       1.1       cgd 	VDESC_NO_OFFSET,
   1508       1.1       cgd 	NULL,
   1509       1.1       cgd };
   1510      1.23   thorpej int
   1511      1.60   thorpej VOP_PRINT(struct vnode *vp)
   1512      1.23   thorpej {
   1513      1.72        ad 	int error;
   1514      1.72        ad 	bool mpsafe;
   1515      1.23   thorpej 	struct vop_print_args a;
   1516      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1517      1.50   thorpej #endif
   1518      1.23   thorpej 	a.a_desc = VDESC(vop_print);
   1519      1.23   thorpej 	a.a_vp = vp;
   1520      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1521      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1522      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_print), &a));
   1523      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1524      1.72        ad 	return error;
   1525      1.23   thorpej }
   1526       1.1       cgd 
   1527      1.31  jdolecek const int vop_islocked_vp_offsets[] = {
   1528       1.1       cgd 	VOPARG_OFFSETOF(struct vop_islocked_args,a_vp),
   1529       1.1       cgd 	VDESC_NO_OFFSET
   1530       1.1       cgd };
   1531      1.33  jdolecek const struct vnodeop_desc vop_islocked_desc = {
   1532      1.67     pooka 	VOP_ISLOCKED_DESCOFFSET,
   1533       1.1       cgd 	"vop_islocked",
   1534       1.1       cgd 	0,
   1535       1.1       cgd 	vop_islocked_vp_offsets,
   1536       1.1       cgd 	VDESC_NO_OFFSET,
   1537       1.1       cgd 	VDESC_NO_OFFSET,
   1538       1.1       cgd 	VDESC_NO_OFFSET,
   1539       1.1       cgd 	NULL,
   1540       1.1       cgd };
   1541      1.23   thorpej int
   1542      1.60   thorpej VOP_ISLOCKED(struct vnode *vp)
   1543      1.23   thorpej {
   1544      1.72        ad 	int error;
   1545      1.72        ad 	bool mpsafe;
   1546      1.23   thorpej 	struct vop_islocked_args a;
   1547      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1548      1.50   thorpej #endif
   1549      1.23   thorpej 	a.a_desc = VDESC(vop_islocked);
   1550      1.23   thorpej 	a.a_vp = vp;
   1551      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1552      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1553      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_islocked), &a));
   1554      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1555      1.72        ad 	return error;
   1556      1.23   thorpej }
   1557       1.1       cgd 
   1558      1.31  jdolecek const int vop_pathconf_vp_offsets[] = {
   1559       1.1       cgd 	VOPARG_OFFSETOF(struct vop_pathconf_args,a_vp),
   1560       1.1       cgd 	VDESC_NO_OFFSET
   1561       1.1       cgd };
   1562      1.33  jdolecek const struct vnodeop_desc vop_pathconf_desc = {
   1563      1.67     pooka 	VOP_PATHCONF_DESCOFFSET,
   1564       1.1       cgd 	"vop_pathconf",
   1565       1.1       cgd 	0,
   1566       1.1       cgd 	vop_pathconf_vp_offsets,
   1567       1.1       cgd 	VDESC_NO_OFFSET,
   1568       1.1       cgd 	VDESC_NO_OFFSET,
   1569       1.1       cgd 	VDESC_NO_OFFSET,
   1570       1.1       cgd 	NULL,
   1571       1.1       cgd };
   1572      1.23   thorpej int
   1573      1.60   thorpej VOP_PATHCONF(struct vnode *vp,
   1574      1.60   thorpej     int name,
   1575      1.60   thorpej     register_t *retval)
   1576      1.23   thorpej {
   1577      1.72        ad 	int error;
   1578      1.72        ad 	bool mpsafe;
   1579      1.23   thorpej 	struct vop_pathconf_args a;
   1580      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1581      1.50   thorpej 	int islocked_vp;
   1582      1.50   thorpej #endif
   1583      1.23   thorpej 	a.a_desc = VDESC(vop_pathconf);
   1584      1.23   thorpej 	a.a_vp = vp;
   1585      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1586      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1587      1.50   thorpej 	if (islocked_vp != 1)
   1588      1.50   thorpej 		panic("vop_pathconf: vp: locked %d, expected %d", islocked_vp, 1);
   1589      1.50   thorpej #endif
   1590      1.23   thorpej 	a.a_name = name;
   1591      1.23   thorpej 	a.a_retval = retval;
   1592      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1593      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1594      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_pathconf), &a));
   1595      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1596      1.72        ad 	return error;
   1597      1.23   thorpej }
   1598       1.1       cgd 
   1599      1.31  jdolecek const int vop_advlock_vp_offsets[] = {
   1600       1.1       cgd 	VOPARG_OFFSETOF(struct vop_advlock_args,a_vp),
   1601       1.1       cgd 	VDESC_NO_OFFSET
   1602       1.1       cgd };
   1603      1.33  jdolecek const struct vnodeop_desc vop_advlock_desc = {
   1604      1.67     pooka 	VOP_ADVLOCK_DESCOFFSET,
   1605       1.1       cgd 	"vop_advlock",
   1606       1.1       cgd 	0,
   1607       1.1       cgd 	vop_advlock_vp_offsets,
   1608       1.1       cgd 	VDESC_NO_OFFSET,
   1609       1.1       cgd 	VDESC_NO_OFFSET,
   1610       1.1       cgd 	VDESC_NO_OFFSET,
   1611       1.1       cgd 	NULL,
   1612       1.1       cgd };
   1613      1.23   thorpej int
   1614      1.60   thorpej VOP_ADVLOCK(struct vnode *vp,
   1615      1.60   thorpej     void *id,
   1616      1.60   thorpej     int op,
   1617      1.60   thorpej     struct flock *fl,
   1618      1.60   thorpej     int flags)
   1619      1.23   thorpej {
   1620      1.72        ad 	int error;
   1621      1.72        ad 	bool mpsafe;
   1622      1.23   thorpej 	struct vop_advlock_args a;
   1623      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1624      1.50   thorpej 	int islocked_vp;
   1625      1.50   thorpej #endif
   1626      1.23   thorpej 	a.a_desc = VDESC(vop_advlock);
   1627      1.23   thorpej 	a.a_vp = vp;
   1628      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1629      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 0;
   1630      1.50   thorpej 	if (islocked_vp != 0)
   1631      1.50   thorpej 		panic("vop_advlock: vp: locked %d, expected %d", islocked_vp, 0);
   1632      1.50   thorpej #endif
   1633      1.23   thorpej 	a.a_id = id;
   1634      1.23   thorpej 	a.a_op = op;
   1635      1.23   thorpej 	a.a_fl = fl;
   1636      1.23   thorpej 	a.a_flags = flags;
   1637      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1638      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1639      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_advlock), &a));
   1640      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1641      1.72        ad 	return error;
   1642      1.23   thorpej }
   1643       1.1       cgd 
   1644      1.31  jdolecek const int vop_whiteout_vp_offsets[] = {
   1645       1.1       cgd 	VOPARG_OFFSETOF(struct vop_whiteout_args,a_dvp),
   1646       1.1       cgd 	VDESC_NO_OFFSET
   1647       1.1       cgd };
   1648      1.33  jdolecek const struct vnodeop_desc vop_whiteout_desc = {
   1649      1.67     pooka 	VOP_WHITEOUT_DESCOFFSET,
   1650       1.1       cgd 	"vop_whiteout",
   1651       1.1       cgd 	0,
   1652       1.1       cgd 	vop_whiteout_vp_offsets,
   1653       1.1       cgd 	VDESC_NO_OFFSET,
   1654       1.1       cgd 	VDESC_NO_OFFSET,
   1655       1.1       cgd 	VOPARG_OFFSETOF(struct vop_whiteout_args, a_cnp),
   1656       1.1       cgd 	NULL,
   1657       1.1       cgd };
   1658      1.23   thorpej int
   1659      1.60   thorpej VOP_WHITEOUT(struct vnode *dvp,
   1660      1.60   thorpej     struct componentname *cnp,
   1661      1.60   thorpej     int flags)
   1662      1.23   thorpej {
   1663      1.72        ad 	int error;
   1664      1.72        ad 	bool mpsafe;
   1665      1.23   thorpej 	struct vop_whiteout_args a;
   1666      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1667      1.50   thorpej 	int islocked_dvp;
   1668      1.50   thorpej #endif
   1669      1.23   thorpej 	a.a_desc = VDESC(vop_whiteout);
   1670      1.23   thorpej 	a.a_dvp = dvp;
   1671      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1672      1.71        ad 	islocked_dvp = (dvp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(dvp) == LK_EXCLUSIVE) : 1;
   1673      1.50   thorpej 	if (islocked_dvp != 1)
   1674      1.50   thorpej 		panic("vop_whiteout: dvp: locked %d, expected %d", islocked_dvp, 1);
   1675      1.50   thorpej #endif
   1676      1.23   thorpej 	a.a_cnp = cnp;
   1677      1.23   thorpej 	a.a_flags = flags;
   1678      1.72        ad 	mpsafe = (dvp->v_vflag & VV_MPSAFE);
   1679      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1680      1.72        ad 	error = (VCALL(dvp, VOFFSET(vop_whiteout), &a));
   1681      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1682      1.72        ad 	return error;
   1683      1.23   thorpej }
   1684       1.1       cgd 
   1685      1.31  jdolecek const int vop_getpages_vp_offsets[] = {
   1686      1.26       chs 	VOPARG_OFFSETOF(struct vop_getpages_args,a_vp),
   1687      1.26       chs 	VDESC_NO_OFFSET
   1688      1.26       chs };
   1689      1.33  jdolecek const struct vnodeop_desc vop_getpages_desc = {
   1690      1.67     pooka 	VOP_GETPAGES_DESCOFFSET,
   1691      1.26       chs 	"vop_getpages",
   1692      1.26       chs 	0,
   1693      1.26       chs 	vop_getpages_vp_offsets,
   1694      1.26       chs 	VDESC_NO_OFFSET,
   1695      1.26       chs 	VDESC_NO_OFFSET,
   1696      1.26       chs 	VDESC_NO_OFFSET,
   1697      1.26       chs 	NULL,
   1698      1.26       chs };
   1699      1.26       chs int
   1700      1.60   thorpej VOP_GETPAGES(struct vnode *vp,
   1701      1.60   thorpej     voff_t offset,
   1702      1.60   thorpej     struct vm_page **m,
   1703      1.60   thorpej     int *count,
   1704      1.60   thorpej     int centeridx,
   1705      1.60   thorpej     vm_prot_t access_type,
   1706      1.60   thorpej     int advice,
   1707      1.60   thorpej     int flags)
   1708      1.26       chs {
   1709      1.72        ad 	int error;
   1710      1.72        ad 	bool mpsafe;
   1711      1.26       chs 	struct vop_getpages_args a;
   1712      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1713      1.50   thorpej #endif
   1714      1.26       chs 	a.a_desc = VDESC(vop_getpages);
   1715      1.26       chs 	a.a_vp = vp;
   1716      1.26       chs 	a.a_offset = offset;
   1717      1.26       chs 	a.a_m = m;
   1718      1.26       chs 	a.a_count = count;
   1719      1.26       chs 	a.a_centeridx = centeridx;
   1720      1.26       chs 	a.a_access_type = access_type;
   1721      1.26       chs 	a.a_advice = advice;
   1722      1.26       chs 	a.a_flags = flags;
   1723      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1724      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1725      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_getpages), &a));
   1726      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1727      1.72        ad 	return error;
   1728      1.26       chs }
   1729      1.26       chs 
   1730      1.31  jdolecek const int vop_putpages_vp_offsets[] = {
   1731      1.26       chs 	VOPARG_OFFSETOF(struct vop_putpages_args,a_vp),
   1732      1.26       chs 	VDESC_NO_OFFSET
   1733      1.26       chs };
   1734      1.33  jdolecek const struct vnodeop_desc vop_putpages_desc = {
   1735      1.67     pooka 	VOP_PUTPAGES_DESCOFFSET,
   1736      1.26       chs 	"vop_putpages",
   1737      1.26       chs 	0,
   1738      1.26       chs 	vop_putpages_vp_offsets,
   1739      1.26       chs 	VDESC_NO_OFFSET,
   1740      1.26       chs 	VDESC_NO_OFFSET,
   1741      1.26       chs 	VDESC_NO_OFFSET,
   1742      1.26       chs 	NULL,
   1743      1.26       chs };
   1744      1.26       chs int
   1745      1.60   thorpej VOP_PUTPAGES(struct vnode *vp,
   1746      1.60   thorpej     voff_t offlo,
   1747      1.60   thorpej     voff_t offhi,
   1748      1.60   thorpej     int flags)
   1749      1.26       chs {
   1750      1.72        ad 	int error;
   1751      1.72        ad 	bool mpsafe;
   1752      1.26       chs 	struct vop_putpages_args a;
   1753      1.50   thorpej #ifdef VNODE_LOCKDEBUG
   1754      1.50   thorpej #endif
   1755      1.26       chs 	a.a_desc = VDESC(vop_putpages);
   1756      1.26       chs 	a.a_vp = vp;
   1757      1.38       chs 	a.a_offlo = offlo;
   1758      1.38       chs 	a.a_offhi = offhi;
   1759      1.26       chs 	a.a_flags = flags;
   1760      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1761      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1762      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_putpages), &a));
   1763      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1764      1.72        ad 	return error;
   1765      1.26       chs }
   1766      1.26       chs 
   1767      1.51   thorpej const int vop_closeextattr_vp_offsets[] = {
   1768      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_closeextattr_args,a_vp),
   1769      1.51   thorpej 	VDESC_NO_OFFSET
   1770      1.51   thorpej };
   1771      1.51   thorpej const struct vnodeop_desc vop_closeextattr_desc = {
   1772      1.67     pooka 	VOP_CLOSEEXTATTR_DESCOFFSET,
   1773      1.51   thorpej 	"vop_closeextattr",
   1774      1.51   thorpej 	0,
   1775      1.51   thorpej 	vop_closeextattr_vp_offsets,
   1776      1.51   thorpej 	VDESC_NO_OFFSET,
   1777      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_closeextattr_args, a_cred),
   1778      1.51   thorpej 	VDESC_NO_OFFSET,
   1779      1.51   thorpej 	NULL,
   1780      1.51   thorpej };
   1781      1.51   thorpej int
   1782      1.60   thorpej VOP_CLOSEEXTATTR(struct vnode *vp,
   1783      1.60   thorpej     int commit,
   1784      1.73     pooka     kauth_cred_t cred)
   1785      1.51   thorpej {
   1786      1.72        ad 	int error;
   1787      1.72        ad 	bool mpsafe;
   1788      1.51   thorpej 	struct vop_closeextattr_args a;
   1789      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1790      1.51   thorpej 	int islocked_vp;
   1791      1.51   thorpej #endif
   1792      1.51   thorpej 	a.a_desc = VDESC(vop_closeextattr);
   1793      1.51   thorpej 	a.a_vp = vp;
   1794      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1795      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1796      1.51   thorpej 	if (islocked_vp != 1)
   1797      1.51   thorpej 		panic("vop_closeextattr: vp: locked %d, expected %d", islocked_vp, 1);
   1798      1.51   thorpej #endif
   1799      1.51   thorpej 	a.a_commit = commit;
   1800      1.51   thorpej 	a.a_cred = cred;
   1801      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1802      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1803      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_closeextattr), &a));
   1804      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1805      1.72        ad 	return error;
   1806      1.51   thorpej }
   1807      1.51   thorpej 
   1808      1.51   thorpej const int vop_getextattr_vp_offsets[] = {
   1809      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_getextattr_args,a_vp),
   1810      1.51   thorpej 	VDESC_NO_OFFSET
   1811      1.51   thorpej };
   1812      1.51   thorpej const struct vnodeop_desc vop_getextattr_desc = {
   1813      1.67     pooka 	VOP_GETEXTATTR_DESCOFFSET,
   1814      1.51   thorpej 	"vop_getextattr",
   1815      1.51   thorpej 	0,
   1816      1.51   thorpej 	vop_getextattr_vp_offsets,
   1817      1.51   thorpej 	VDESC_NO_OFFSET,
   1818      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_getextattr_args, a_cred),
   1819      1.51   thorpej 	VDESC_NO_OFFSET,
   1820      1.51   thorpej 	NULL,
   1821      1.51   thorpej };
   1822      1.51   thorpej int
   1823      1.60   thorpej VOP_GETEXTATTR(struct vnode *vp,
   1824      1.60   thorpej     int attrnamespace,
   1825      1.60   thorpej     const char *name,
   1826      1.60   thorpej     struct uio *uio,
   1827      1.60   thorpej     size_t *size,
   1828      1.73     pooka     kauth_cred_t cred)
   1829      1.51   thorpej {
   1830      1.72        ad 	int error;
   1831      1.72        ad 	bool mpsafe;
   1832      1.51   thorpej 	struct vop_getextattr_args a;
   1833      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1834      1.51   thorpej 	int islocked_vp;
   1835      1.51   thorpej #endif
   1836      1.51   thorpej 	a.a_desc = VDESC(vop_getextattr);
   1837      1.51   thorpej 	a.a_vp = vp;
   1838      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1839      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1840      1.51   thorpej 	if (islocked_vp != 1)
   1841      1.51   thorpej 		panic("vop_getextattr: vp: locked %d, expected %d", islocked_vp, 1);
   1842      1.51   thorpej #endif
   1843      1.51   thorpej 	a.a_attrnamespace = attrnamespace;
   1844      1.51   thorpej 	a.a_name = name;
   1845      1.51   thorpej 	a.a_uio = uio;
   1846      1.51   thorpej 	a.a_size = size;
   1847      1.51   thorpej 	a.a_cred = cred;
   1848      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1849      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1850      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_getextattr), &a));
   1851      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1852      1.72        ad 	return error;
   1853      1.51   thorpej }
   1854      1.51   thorpej 
   1855      1.51   thorpej const int vop_listextattr_vp_offsets[] = {
   1856      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_listextattr_args,a_vp),
   1857      1.51   thorpej 	VDESC_NO_OFFSET
   1858      1.51   thorpej };
   1859      1.51   thorpej const struct vnodeop_desc vop_listextattr_desc = {
   1860      1.67     pooka 	VOP_LISTEXTATTR_DESCOFFSET,
   1861      1.51   thorpej 	"vop_listextattr",
   1862      1.51   thorpej 	0,
   1863      1.51   thorpej 	vop_listextattr_vp_offsets,
   1864      1.51   thorpej 	VDESC_NO_OFFSET,
   1865      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_listextattr_args, a_cred),
   1866      1.51   thorpej 	VDESC_NO_OFFSET,
   1867      1.51   thorpej 	NULL,
   1868      1.51   thorpej };
   1869      1.51   thorpej int
   1870      1.60   thorpej VOP_LISTEXTATTR(struct vnode *vp,
   1871      1.60   thorpej     int attrnamespace,
   1872      1.60   thorpej     struct uio *uio,
   1873      1.60   thorpej     size_t *size,
   1874      1.73     pooka     kauth_cred_t cred)
   1875      1.51   thorpej {
   1876      1.72        ad 	int error;
   1877      1.72        ad 	bool mpsafe;
   1878      1.51   thorpej 	struct vop_listextattr_args a;
   1879      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1880      1.51   thorpej 	int islocked_vp;
   1881      1.51   thorpej #endif
   1882      1.51   thorpej 	a.a_desc = VDESC(vop_listextattr);
   1883      1.51   thorpej 	a.a_vp = vp;
   1884      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1885      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1886      1.51   thorpej 	if (islocked_vp != 1)
   1887      1.51   thorpej 		panic("vop_listextattr: vp: locked %d, expected %d", islocked_vp, 1);
   1888      1.51   thorpej #endif
   1889      1.51   thorpej 	a.a_attrnamespace = attrnamespace;
   1890      1.51   thorpej 	a.a_uio = uio;
   1891      1.51   thorpej 	a.a_size = size;
   1892      1.51   thorpej 	a.a_cred = cred;
   1893      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1894      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1895      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_listextattr), &a));
   1896      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1897      1.72        ad 	return error;
   1898      1.51   thorpej }
   1899      1.51   thorpej 
   1900      1.51   thorpej const int vop_openextattr_vp_offsets[] = {
   1901      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_openextattr_args,a_vp),
   1902      1.51   thorpej 	VDESC_NO_OFFSET
   1903      1.51   thorpej };
   1904      1.51   thorpej const struct vnodeop_desc vop_openextattr_desc = {
   1905      1.67     pooka 	VOP_OPENEXTATTR_DESCOFFSET,
   1906      1.51   thorpej 	"vop_openextattr",
   1907      1.51   thorpej 	0,
   1908      1.51   thorpej 	vop_openextattr_vp_offsets,
   1909      1.51   thorpej 	VDESC_NO_OFFSET,
   1910      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_openextattr_args, a_cred),
   1911      1.51   thorpej 	VDESC_NO_OFFSET,
   1912      1.51   thorpej 	NULL,
   1913      1.51   thorpej };
   1914      1.51   thorpej int
   1915      1.60   thorpej VOP_OPENEXTATTR(struct vnode *vp,
   1916      1.73     pooka     kauth_cred_t cred)
   1917      1.51   thorpej {
   1918      1.72        ad 	int error;
   1919      1.72        ad 	bool mpsafe;
   1920      1.51   thorpej 	struct vop_openextattr_args a;
   1921      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1922      1.51   thorpej 	int islocked_vp;
   1923      1.51   thorpej #endif
   1924      1.51   thorpej 	a.a_desc = VDESC(vop_openextattr);
   1925      1.51   thorpej 	a.a_vp = vp;
   1926      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1927      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1928      1.51   thorpej 	if (islocked_vp != 1)
   1929      1.51   thorpej 		panic("vop_openextattr: vp: locked %d, expected %d", islocked_vp, 1);
   1930      1.51   thorpej #endif
   1931      1.51   thorpej 	a.a_cred = cred;
   1932      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1933      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1934      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_openextattr), &a));
   1935      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1936      1.72        ad 	return error;
   1937      1.51   thorpej }
   1938      1.51   thorpej 
   1939      1.51   thorpej const int vop_deleteextattr_vp_offsets[] = {
   1940      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_deleteextattr_args,a_vp),
   1941      1.51   thorpej 	VDESC_NO_OFFSET
   1942      1.51   thorpej };
   1943      1.51   thorpej const struct vnodeop_desc vop_deleteextattr_desc = {
   1944      1.67     pooka 	VOP_DELETEEXTATTR_DESCOFFSET,
   1945      1.51   thorpej 	"vop_deleteextattr",
   1946      1.51   thorpej 	0,
   1947      1.51   thorpej 	vop_deleteextattr_vp_offsets,
   1948      1.51   thorpej 	VDESC_NO_OFFSET,
   1949      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_deleteextattr_args, a_cred),
   1950      1.51   thorpej 	VDESC_NO_OFFSET,
   1951      1.51   thorpej 	NULL,
   1952      1.51   thorpej };
   1953      1.51   thorpej int
   1954      1.60   thorpej VOP_DELETEEXTATTR(struct vnode *vp,
   1955      1.60   thorpej     int attrnamespace,
   1956      1.60   thorpej     const char *name,
   1957      1.73     pooka     kauth_cred_t cred)
   1958      1.51   thorpej {
   1959      1.72        ad 	int error;
   1960      1.72        ad 	bool mpsafe;
   1961      1.51   thorpej 	struct vop_deleteextattr_args a;
   1962      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1963      1.51   thorpej 	int islocked_vp;
   1964      1.51   thorpej #endif
   1965      1.51   thorpej 	a.a_desc = VDESC(vop_deleteextattr);
   1966      1.51   thorpej 	a.a_vp = vp;
   1967      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   1968      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   1969      1.51   thorpej 	if (islocked_vp != 1)
   1970      1.51   thorpej 		panic("vop_deleteextattr: vp: locked %d, expected %d", islocked_vp, 1);
   1971      1.51   thorpej #endif
   1972      1.51   thorpej 	a.a_attrnamespace = attrnamespace;
   1973      1.51   thorpej 	a.a_name = name;
   1974      1.51   thorpej 	a.a_cred = cred;
   1975      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   1976      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   1977      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_deleteextattr), &a));
   1978      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   1979      1.72        ad 	return error;
   1980      1.51   thorpej }
   1981      1.51   thorpej 
   1982      1.51   thorpej const int vop_setextattr_vp_offsets[] = {
   1983      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_setextattr_args,a_vp),
   1984      1.51   thorpej 	VDESC_NO_OFFSET
   1985      1.51   thorpej };
   1986      1.51   thorpej const struct vnodeop_desc vop_setextattr_desc = {
   1987      1.67     pooka 	VOP_SETEXTATTR_DESCOFFSET,
   1988      1.51   thorpej 	"vop_setextattr",
   1989      1.51   thorpej 	0,
   1990      1.51   thorpej 	vop_setextattr_vp_offsets,
   1991      1.51   thorpej 	VDESC_NO_OFFSET,
   1992      1.51   thorpej 	VOPARG_OFFSETOF(struct vop_setextattr_args, a_cred),
   1993      1.51   thorpej 	VDESC_NO_OFFSET,
   1994      1.51   thorpej 	NULL,
   1995      1.51   thorpej };
   1996      1.51   thorpej int
   1997      1.60   thorpej VOP_SETEXTATTR(struct vnode *vp,
   1998      1.60   thorpej     int attrnamespace,
   1999      1.60   thorpej     const char *name,
   2000      1.60   thorpej     struct uio *uio,
   2001      1.73     pooka     kauth_cred_t cred)
   2002      1.51   thorpej {
   2003      1.72        ad 	int error;
   2004      1.72        ad 	bool mpsafe;
   2005      1.51   thorpej 	struct vop_setextattr_args a;
   2006      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   2007      1.51   thorpej 	int islocked_vp;
   2008      1.51   thorpej #endif
   2009      1.51   thorpej 	a.a_desc = VDESC(vop_setextattr);
   2010      1.51   thorpej 	a.a_vp = vp;
   2011      1.51   thorpej #ifdef VNODE_LOCKDEBUG
   2012      1.71        ad 	islocked_vp = (vp->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) : 1;
   2013      1.51   thorpej 	if (islocked_vp != 1)
   2014      1.51   thorpej 		panic("vop_setextattr: vp: locked %d, expected %d", islocked_vp, 1);
   2015      1.51   thorpej #endif
   2016      1.51   thorpej 	a.a_attrnamespace = attrnamespace;
   2017      1.51   thorpej 	a.a_name = name;
   2018      1.51   thorpej 	a.a_uio = uio;
   2019      1.51   thorpej 	a.a_cred = cred;
   2020      1.72        ad 	mpsafe = (vp->v_vflag & VV_MPSAFE);
   2021      1.72        ad 	if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
   2022      1.72        ad 	error = (VCALL(vp, VOFFSET(vop_setextattr), &a));
   2023      1.72        ad 	if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
   2024      1.72        ad 	return error;
   2025      1.51   thorpej }
   2026      1.51   thorpej 
   2027       1.1       cgd /* End of special cases. */
   2028       1.1       cgd 
   2029      1.33  jdolecek const struct vnodeop_desc * const vfs_op_descs[] = {
   2030       1.1       cgd 	&vop_default_desc,	/* MUST BE FIRST */
   2031       1.1       cgd 	&vop_bwrite_desc,	/* XXX: SPECIAL CASE */
   2032       1.1       cgd 
   2033       1.1       cgd 	&vop_lookup_desc,
   2034       1.1       cgd 	&vop_create_desc,
   2035       1.1       cgd 	&vop_mknod_desc,
   2036       1.1       cgd 	&vop_open_desc,
   2037       1.1       cgd 	&vop_close_desc,
   2038       1.1       cgd 	&vop_access_desc,
   2039       1.1       cgd 	&vop_getattr_desc,
   2040       1.1       cgd 	&vop_setattr_desc,
   2041       1.1       cgd 	&vop_read_desc,
   2042       1.1       cgd 	&vop_write_desc,
   2043       1.1       cgd 	&vop_ioctl_desc,
   2044      1.18  wrstuden 	&vop_fcntl_desc,
   2045       1.3   mycroft 	&vop_poll_desc,
   2046      1.40  jdolecek 	&vop_kqfilter_desc,
   2047      1.10      fvdl 	&vop_revoke_desc,
   2048       1.1       cgd 	&vop_mmap_desc,
   2049       1.1       cgd 	&vop_fsync_desc,
   2050       1.1       cgd 	&vop_seek_desc,
   2051       1.1       cgd 	&vop_remove_desc,
   2052       1.1       cgd 	&vop_link_desc,
   2053       1.1       cgd 	&vop_rename_desc,
   2054       1.1       cgd 	&vop_mkdir_desc,
   2055       1.1       cgd 	&vop_rmdir_desc,
   2056       1.1       cgd 	&vop_symlink_desc,
   2057       1.1       cgd 	&vop_readdir_desc,
   2058       1.1       cgd 	&vop_readlink_desc,
   2059       1.1       cgd 	&vop_abortop_desc,
   2060       1.1       cgd 	&vop_inactive_desc,
   2061       1.1       cgd 	&vop_reclaim_desc,
   2062       1.1       cgd 	&vop_lock_desc,
   2063       1.1       cgd 	&vop_unlock_desc,
   2064       1.1       cgd 	&vop_bmap_desc,
   2065      1.46   hannken 	&vop_strategy_desc,
   2066       1.1       cgd 	&vop_print_desc,
   2067       1.1       cgd 	&vop_islocked_desc,
   2068       1.1       cgd 	&vop_pathconf_desc,
   2069       1.1       cgd 	&vop_advlock_desc,
   2070       1.1       cgd 	&vop_whiteout_desc,
   2071      1.26       chs 	&vop_getpages_desc,
   2072      1.26       chs 	&vop_putpages_desc,
   2073      1.51   thorpej 	&vop_closeextattr_desc,
   2074      1.51   thorpej 	&vop_getextattr_desc,
   2075      1.51   thorpej 	&vop_listextattr_desc,
   2076      1.51   thorpej 	&vop_openextattr_desc,
   2077      1.51   thorpej 	&vop_deleteextattr_desc,
   2078      1.51   thorpej 	&vop_setextattr_desc,
   2079       1.1       cgd 	NULL
   2080       1.1       cgd };
   2081       1.1       cgd 
   2082