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