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