vnode_if.c revision 1.88 1 /* $NetBSD: vnode_if.c,v 1.88 2011/07/11 08:27:38 hannken 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.62 2011/07/11 08:23:00 hannken Exp
9 * by the script:
10 * NetBSD: vnode_if.sh,v 1.58 2011/07/11 08:23:00 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.88 2011/07/11 08:27:38 hannken 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
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_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_args, a_vpp),
102 VDESC_NO_OFFSET,
103 VOPARG_OFFSETOF(struct vop_lookup_args, a_cnp),
104 };
105 int
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_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_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 | VDESC_VP0_WILLPUT,
137 vop_create_vp_offsets,
138 VOPARG_OFFSETOF(struct vop_create_args, a_vpp),
139 VDESC_NO_OFFSET,
140 VOPARG_OFFSETOF(struct vop_create_args, a_cnp),
141 };
142 int
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_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_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 | VDESC_VP0_WILLPUT,
176 vop_mknod_vp_offsets,
177 VOPARG_OFFSETOF(struct vop_mknod_args, a_vpp),
178 VDESC_NO_OFFSET,
179 VOPARG_OFFSETOF(struct vop_mknod_args, a_cnp),
180 };
181 int
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_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
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
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
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
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
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
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
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_ioctl_vp_offsets[] = {
436 VOPARG_OFFSETOF(struct vop_ioctl_args,a_vp),
437 VDESC_NO_OFFSET
438 };
439 const struct vnodeop_desc vop_ioctl_desc = {
440 VOP_IOCTL_DESCOFFSET,
441 "vop_ioctl",
442 0,
443 vop_ioctl_vp_offsets,
444 VDESC_NO_OFFSET,
445 VOPARG_OFFSETOF(struct vop_ioctl_args, a_cred),
446 VDESC_NO_OFFSET,
447 };
448 int
449 VOP_IOCTL(struct vnode *vp,
450 u_long command,
451 void *data,
452 int fflag,
453 kauth_cred_t cred)
454 {
455 int error;
456 bool mpsafe;
457 struct vop_ioctl_args a;
458 a.a_desc = VDESC(vop_ioctl);
459 a.a_vp = vp;
460 a.a_command = command;
461 a.a_data = data;
462 a.a_fflag = fflag;
463 a.a_cred = cred;
464 mpsafe = (vp->v_vflag & VV_MPSAFE);
465 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
466 error = (VCALL(vp, VOFFSET(vop_ioctl), &a));
467 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
468 return error;
469 }
470
471 const int vop_fcntl_vp_offsets[] = {
472 VOPARG_OFFSETOF(struct vop_fcntl_args,a_vp),
473 VDESC_NO_OFFSET
474 };
475 const struct vnodeop_desc vop_fcntl_desc = {
476 VOP_FCNTL_DESCOFFSET,
477 "vop_fcntl",
478 0,
479 vop_fcntl_vp_offsets,
480 VDESC_NO_OFFSET,
481 VOPARG_OFFSETOF(struct vop_fcntl_args, a_cred),
482 VDESC_NO_OFFSET,
483 };
484 int
485 VOP_FCNTL(struct vnode *vp,
486 u_int command,
487 void *data,
488 int fflag,
489 kauth_cred_t cred)
490 {
491 int error;
492 bool mpsafe;
493 struct vop_fcntl_args a;
494 a.a_desc = VDESC(vop_fcntl);
495 a.a_vp = vp;
496 a.a_command = command;
497 a.a_data = data;
498 a.a_fflag = fflag;
499 a.a_cred = cred;
500 mpsafe = (vp->v_vflag & VV_MPSAFE);
501 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
502 error = (VCALL(vp, VOFFSET(vop_fcntl), &a));
503 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
504 return error;
505 }
506
507 const int vop_poll_vp_offsets[] = {
508 VOPARG_OFFSETOF(struct vop_poll_args,a_vp),
509 VDESC_NO_OFFSET
510 };
511 const struct vnodeop_desc vop_poll_desc = {
512 VOP_POLL_DESCOFFSET,
513 "vop_poll",
514 0,
515 vop_poll_vp_offsets,
516 VDESC_NO_OFFSET,
517 VDESC_NO_OFFSET,
518 VDESC_NO_OFFSET,
519 };
520 int
521 VOP_POLL(struct vnode *vp,
522 int events)
523 {
524 int error;
525 bool mpsafe;
526 struct vop_poll_args a;
527 a.a_desc = VDESC(vop_poll);
528 a.a_vp = vp;
529 a.a_events = events;
530 mpsafe = (vp->v_vflag & VV_MPSAFE);
531 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
532 error = (VCALL(vp, VOFFSET(vop_poll), &a));
533 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
534 return error;
535 }
536
537 const int vop_kqfilter_vp_offsets[] = {
538 VOPARG_OFFSETOF(struct vop_kqfilter_args,a_vp),
539 VDESC_NO_OFFSET
540 };
541 const struct vnodeop_desc vop_kqfilter_desc = {
542 VOP_KQFILTER_DESCOFFSET,
543 "vop_kqfilter",
544 0,
545 vop_kqfilter_vp_offsets,
546 VDESC_NO_OFFSET,
547 VDESC_NO_OFFSET,
548 VDESC_NO_OFFSET,
549 };
550 int
551 VOP_KQFILTER(struct vnode *vp,
552 struct knote *kn)
553 {
554 int error;
555 bool mpsafe;
556 struct vop_kqfilter_args a;
557 a.a_desc = VDESC(vop_kqfilter);
558 a.a_vp = vp;
559 a.a_kn = kn;
560 mpsafe = (vp->v_vflag & VV_MPSAFE);
561 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
562 error = (VCALL(vp, VOFFSET(vop_kqfilter), &a));
563 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
564 return error;
565 }
566
567 const int vop_revoke_vp_offsets[] = {
568 VOPARG_OFFSETOF(struct vop_revoke_args,a_vp),
569 VDESC_NO_OFFSET
570 };
571 const struct vnodeop_desc vop_revoke_desc = {
572 VOP_REVOKE_DESCOFFSET,
573 "vop_revoke",
574 0,
575 vop_revoke_vp_offsets,
576 VDESC_NO_OFFSET,
577 VDESC_NO_OFFSET,
578 VDESC_NO_OFFSET,
579 };
580 int
581 VOP_REVOKE(struct vnode *vp,
582 int flags)
583 {
584 int error;
585 bool mpsafe;
586 struct vop_revoke_args a;
587 a.a_desc = VDESC(vop_revoke);
588 a.a_vp = vp;
589 a.a_flags = flags;
590 mpsafe = (vp->v_vflag & VV_MPSAFE);
591 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
592 error = (VCALL(vp, VOFFSET(vop_revoke), &a));
593 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
594 return error;
595 }
596
597 const int vop_mmap_vp_offsets[] = {
598 VOPARG_OFFSETOF(struct vop_mmap_args,a_vp),
599 VDESC_NO_OFFSET
600 };
601 const struct vnodeop_desc vop_mmap_desc = {
602 VOP_MMAP_DESCOFFSET,
603 "vop_mmap",
604 0,
605 vop_mmap_vp_offsets,
606 VDESC_NO_OFFSET,
607 VOPARG_OFFSETOF(struct vop_mmap_args, a_cred),
608 VDESC_NO_OFFSET,
609 };
610 int
611 VOP_MMAP(struct vnode *vp,
612 vm_prot_t prot,
613 kauth_cred_t cred)
614 {
615 int error;
616 bool mpsafe;
617 struct vop_mmap_args a;
618 a.a_desc = VDESC(vop_mmap);
619 a.a_vp = vp;
620 a.a_prot = prot;
621 a.a_cred = cred;
622 mpsafe = (vp->v_vflag & VV_MPSAFE);
623 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
624 error = (VCALL(vp, VOFFSET(vop_mmap), &a));
625 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
626 return error;
627 }
628
629 const int vop_fsync_vp_offsets[] = {
630 VOPARG_OFFSETOF(struct vop_fsync_args,a_vp),
631 VDESC_NO_OFFSET
632 };
633 const struct vnodeop_desc vop_fsync_desc = {
634 VOP_FSYNC_DESCOFFSET,
635 "vop_fsync",
636 0,
637 vop_fsync_vp_offsets,
638 VDESC_NO_OFFSET,
639 VOPARG_OFFSETOF(struct vop_fsync_args, a_cred),
640 VDESC_NO_OFFSET,
641 };
642 int
643 VOP_FSYNC(struct vnode *vp,
644 kauth_cred_t cred,
645 int flags,
646 off_t offlo,
647 off_t offhi)
648 {
649 int error;
650 bool mpsafe;
651 struct vop_fsync_args a;
652 a.a_desc = VDESC(vop_fsync);
653 a.a_vp = vp;
654 a.a_cred = cred;
655 a.a_flags = flags;
656 a.a_offlo = offlo;
657 a.a_offhi = offhi;
658 mpsafe = (vp->v_vflag & VV_MPSAFE);
659 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
660 error = (VCALL(vp, VOFFSET(vop_fsync), &a));
661 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
662 return error;
663 }
664
665 const int vop_seek_vp_offsets[] = {
666 VOPARG_OFFSETOF(struct vop_seek_args,a_vp),
667 VDESC_NO_OFFSET
668 };
669 const struct vnodeop_desc vop_seek_desc = {
670 VOP_SEEK_DESCOFFSET,
671 "vop_seek",
672 0,
673 vop_seek_vp_offsets,
674 VDESC_NO_OFFSET,
675 VOPARG_OFFSETOF(struct vop_seek_args, a_cred),
676 VDESC_NO_OFFSET,
677 };
678 int
679 VOP_SEEK(struct vnode *vp,
680 off_t oldoff,
681 off_t newoff,
682 kauth_cred_t cred)
683 {
684 int error;
685 bool mpsafe;
686 struct vop_seek_args a;
687 a.a_desc = VDESC(vop_seek);
688 a.a_vp = vp;
689 a.a_oldoff = oldoff;
690 a.a_newoff = newoff;
691 a.a_cred = cred;
692 mpsafe = (vp->v_vflag & VV_MPSAFE);
693 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
694 error = (VCALL(vp, VOFFSET(vop_seek), &a));
695 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
696 return error;
697 }
698
699 const int vop_remove_vp_offsets[] = {
700 VOPARG_OFFSETOF(struct vop_remove_args,a_dvp),
701 VOPARG_OFFSETOF(struct vop_remove_args,a_vp),
702 VDESC_NO_OFFSET
703 };
704 const struct vnodeop_desc vop_remove_desc = {
705 VOP_REMOVE_DESCOFFSET,
706 "vop_remove",
707 0 | VDESC_VP0_WILLPUT | VDESC_VP1_WILLPUT,
708 vop_remove_vp_offsets,
709 VDESC_NO_OFFSET,
710 VDESC_NO_OFFSET,
711 VOPARG_OFFSETOF(struct vop_remove_args, a_cnp),
712 };
713 int
714 VOP_REMOVE(struct vnode *dvp,
715 struct vnode *vp,
716 struct componentname *cnp)
717 {
718 int error;
719 bool mpsafe;
720 struct vop_remove_args a;
721 a.a_desc = VDESC(vop_remove);
722 a.a_dvp = dvp;
723 a.a_vp = vp;
724 a.a_cnp = cnp;
725 mpsafe = (dvp->v_vflag & VV_MPSAFE);
726 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
727 error = (VCALL(dvp, VOFFSET(vop_remove), &a));
728 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
729 return error;
730 }
731
732 const int vop_link_vp_offsets[] = {
733 VOPARG_OFFSETOF(struct vop_link_args,a_dvp),
734 VOPARG_OFFSETOF(struct vop_link_args,a_vp),
735 VDESC_NO_OFFSET
736 };
737 const struct vnodeop_desc vop_link_desc = {
738 VOP_LINK_DESCOFFSET,
739 "vop_link",
740 0 | VDESC_VP0_WILLPUT,
741 vop_link_vp_offsets,
742 VDESC_NO_OFFSET,
743 VDESC_NO_OFFSET,
744 VOPARG_OFFSETOF(struct vop_link_args, a_cnp),
745 };
746 int
747 VOP_LINK(struct vnode *dvp,
748 struct vnode *vp,
749 struct componentname *cnp)
750 {
751 int error;
752 bool mpsafe;
753 struct vop_link_args a;
754 a.a_desc = VDESC(vop_link);
755 a.a_dvp = dvp;
756 a.a_vp = vp;
757 a.a_cnp = cnp;
758 mpsafe = (dvp->v_vflag & VV_MPSAFE);
759 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
760 error = (VCALL(dvp, VOFFSET(vop_link), &a));
761 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
762 return error;
763 }
764
765 const int vop_rename_vp_offsets[] = {
766 VOPARG_OFFSETOF(struct vop_rename_args,a_fdvp),
767 VOPARG_OFFSETOF(struct vop_rename_args,a_fvp),
768 VOPARG_OFFSETOF(struct vop_rename_args,a_tdvp),
769 VOPARG_OFFSETOF(struct vop_rename_args,a_tvp),
770 VDESC_NO_OFFSET
771 };
772 const struct vnodeop_desc vop_rename_desc = {
773 VOP_RENAME_DESCOFFSET,
774 "vop_rename",
775 0 | VDESC_VP0_WILLRELE | VDESC_VP1_WILLRELE | VDESC_VP2_WILLPUT | VDESC_VP3_WILLPUT,
776 vop_rename_vp_offsets,
777 VDESC_NO_OFFSET,
778 VDESC_NO_OFFSET,
779 VOPARG_OFFSETOF(struct vop_rename_args, a_fcnp),
780 };
781 int
782 VOP_RENAME(struct vnode *fdvp,
783 struct vnode *fvp,
784 struct componentname *fcnp,
785 struct vnode *tdvp,
786 struct vnode *tvp,
787 struct componentname *tcnp)
788 {
789 int error;
790 bool mpsafe;
791 struct vop_rename_args a;
792 a.a_desc = VDESC(vop_rename);
793 a.a_fdvp = fdvp;
794 a.a_fvp = fvp;
795 a.a_fcnp = fcnp;
796 a.a_tdvp = tdvp;
797 a.a_tvp = tvp;
798 a.a_tcnp = tcnp;
799 mpsafe = (fdvp->v_vflag & VV_MPSAFE);
800 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
801 error = (VCALL(fdvp, VOFFSET(vop_rename), &a));
802 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
803 return error;
804 }
805
806 const int vop_mkdir_vp_offsets[] = {
807 VOPARG_OFFSETOF(struct vop_mkdir_args,a_dvp),
808 VDESC_NO_OFFSET
809 };
810 const struct vnodeop_desc vop_mkdir_desc = {
811 VOP_MKDIR_DESCOFFSET,
812 "vop_mkdir",
813 0 | VDESC_VP0_WILLPUT,
814 vop_mkdir_vp_offsets,
815 VOPARG_OFFSETOF(struct vop_mkdir_args, a_vpp),
816 VDESC_NO_OFFSET,
817 VOPARG_OFFSETOF(struct vop_mkdir_args, a_cnp),
818 };
819 int
820 VOP_MKDIR(struct vnode *dvp,
821 struct vnode **vpp,
822 struct componentname *cnp,
823 struct vattr *vap)
824 {
825 int error;
826 bool mpsafe;
827 struct vop_mkdir_args a;
828 a.a_desc = VDESC(vop_mkdir);
829 a.a_dvp = dvp;
830 a.a_vpp = vpp;
831 a.a_cnp = cnp;
832 a.a_vap = vap;
833 mpsafe = (dvp->v_vflag & VV_MPSAFE);
834 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
835 error = (VCALL(dvp, VOFFSET(vop_mkdir), &a));
836 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
837 #ifdef DIAGNOSTIC
838 if (error == 0)
839 KASSERT((*vpp)->v_size != VSIZENOTSET
840 && (*vpp)->v_writesize != VSIZENOTSET);
841 #endif /* DIAGNOSTIC */
842 return error;
843 }
844
845 const int vop_rmdir_vp_offsets[] = {
846 VOPARG_OFFSETOF(struct vop_rmdir_args,a_dvp),
847 VOPARG_OFFSETOF(struct vop_rmdir_args,a_vp),
848 VDESC_NO_OFFSET
849 };
850 const struct vnodeop_desc vop_rmdir_desc = {
851 VOP_RMDIR_DESCOFFSET,
852 "vop_rmdir",
853 0 | VDESC_VP0_WILLPUT | VDESC_VP1_WILLPUT,
854 vop_rmdir_vp_offsets,
855 VDESC_NO_OFFSET,
856 VDESC_NO_OFFSET,
857 VOPARG_OFFSETOF(struct vop_rmdir_args, a_cnp),
858 };
859 int
860 VOP_RMDIR(struct vnode *dvp,
861 struct vnode *vp,
862 struct componentname *cnp)
863 {
864 int error;
865 bool mpsafe;
866 struct vop_rmdir_args a;
867 a.a_desc = VDESC(vop_rmdir);
868 a.a_dvp = dvp;
869 a.a_vp = vp;
870 a.a_cnp = cnp;
871 mpsafe = (dvp->v_vflag & VV_MPSAFE);
872 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
873 error = (VCALL(dvp, VOFFSET(vop_rmdir), &a));
874 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
875 return error;
876 }
877
878 const int vop_symlink_vp_offsets[] = {
879 VOPARG_OFFSETOF(struct vop_symlink_args,a_dvp),
880 VDESC_NO_OFFSET
881 };
882 const struct vnodeop_desc vop_symlink_desc = {
883 VOP_SYMLINK_DESCOFFSET,
884 "vop_symlink",
885 0 | VDESC_VP0_WILLPUT,
886 vop_symlink_vp_offsets,
887 VOPARG_OFFSETOF(struct vop_symlink_args, a_vpp),
888 VDESC_NO_OFFSET,
889 VOPARG_OFFSETOF(struct vop_symlink_args, a_cnp),
890 };
891 int
892 VOP_SYMLINK(struct vnode *dvp,
893 struct vnode **vpp,
894 struct componentname *cnp,
895 struct vattr *vap,
896 char *target)
897 {
898 int error;
899 bool mpsafe;
900 struct vop_symlink_args a;
901 a.a_desc = VDESC(vop_symlink);
902 a.a_dvp = dvp;
903 a.a_vpp = vpp;
904 a.a_cnp = cnp;
905 a.a_vap = vap;
906 a.a_target = target;
907 mpsafe = (dvp->v_vflag & VV_MPSAFE);
908 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
909 error = (VCALL(dvp, VOFFSET(vop_symlink), &a));
910 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
911 #ifdef DIAGNOSTIC
912 if (error == 0)
913 KASSERT((*vpp)->v_size != VSIZENOTSET
914 && (*vpp)->v_writesize != VSIZENOTSET);
915 #endif /* DIAGNOSTIC */
916 return error;
917 }
918
919 const int vop_readdir_vp_offsets[] = {
920 VOPARG_OFFSETOF(struct vop_readdir_args,a_vp),
921 VDESC_NO_OFFSET
922 };
923 const struct vnodeop_desc vop_readdir_desc = {
924 VOP_READDIR_DESCOFFSET,
925 "vop_readdir",
926 0,
927 vop_readdir_vp_offsets,
928 VDESC_NO_OFFSET,
929 VOPARG_OFFSETOF(struct vop_readdir_args, a_cred),
930 VDESC_NO_OFFSET,
931 };
932 int
933 VOP_READDIR(struct vnode *vp,
934 struct uio *uio,
935 kauth_cred_t cred,
936 int *eofflag,
937 off_t **cookies,
938 int *ncookies)
939 {
940 int error;
941 bool mpsafe;
942 struct vop_readdir_args a;
943 a.a_desc = VDESC(vop_readdir);
944 a.a_vp = vp;
945 a.a_uio = uio;
946 a.a_cred = cred;
947 a.a_eofflag = eofflag;
948 a.a_cookies = cookies;
949 a.a_ncookies = ncookies;
950 mpsafe = (vp->v_vflag & VV_MPSAFE);
951 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
952 error = (VCALL(vp, VOFFSET(vop_readdir), &a));
953 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
954 return error;
955 }
956
957 const int vop_readlink_vp_offsets[] = {
958 VOPARG_OFFSETOF(struct vop_readlink_args,a_vp),
959 VDESC_NO_OFFSET
960 };
961 const struct vnodeop_desc vop_readlink_desc = {
962 VOP_READLINK_DESCOFFSET,
963 "vop_readlink",
964 0,
965 vop_readlink_vp_offsets,
966 VDESC_NO_OFFSET,
967 VOPARG_OFFSETOF(struct vop_readlink_args, a_cred),
968 VDESC_NO_OFFSET,
969 };
970 int
971 VOP_READLINK(struct vnode *vp,
972 struct uio *uio,
973 kauth_cred_t cred)
974 {
975 int error;
976 bool mpsafe;
977 struct vop_readlink_args a;
978 a.a_desc = VDESC(vop_readlink);
979 a.a_vp = vp;
980 a.a_uio = uio;
981 a.a_cred = cred;
982 mpsafe = (vp->v_vflag & VV_MPSAFE);
983 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
984 error = (VCALL(vp, VOFFSET(vop_readlink), &a));
985 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
986 return error;
987 }
988
989 const int vop_abortop_vp_offsets[] = {
990 VOPARG_OFFSETOF(struct vop_abortop_args,a_dvp),
991 VDESC_NO_OFFSET
992 };
993 const struct vnodeop_desc vop_abortop_desc = {
994 VOP_ABORTOP_DESCOFFSET,
995 "vop_abortop",
996 0,
997 vop_abortop_vp_offsets,
998 VDESC_NO_OFFSET,
999 VDESC_NO_OFFSET,
1000 VOPARG_OFFSETOF(struct vop_abortop_args, a_cnp),
1001 };
1002 int
1003 VOP_ABORTOP(struct vnode *dvp,
1004 struct componentname *cnp)
1005 {
1006 int error;
1007 bool mpsafe;
1008 struct vop_abortop_args a;
1009 a.a_desc = VDESC(vop_abortop);
1010 a.a_dvp = dvp;
1011 a.a_cnp = cnp;
1012 mpsafe = (dvp->v_vflag & VV_MPSAFE);
1013 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1014 error = (VCALL(dvp, VOFFSET(vop_abortop), &a));
1015 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1016 return error;
1017 }
1018
1019 const int vop_inactive_vp_offsets[] = {
1020 VOPARG_OFFSETOF(struct vop_inactive_args,a_vp),
1021 VDESC_NO_OFFSET
1022 };
1023 const struct vnodeop_desc vop_inactive_desc = {
1024 VOP_INACTIVE_DESCOFFSET,
1025 "vop_inactive",
1026 0 | VDESC_VP0_WILLUNLOCK,
1027 vop_inactive_vp_offsets,
1028 VDESC_NO_OFFSET,
1029 VDESC_NO_OFFSET,
1030 VDESC_NO_OFFSET,
1031 };
1032 int
1033 VOP_INACTIVE(struct vnode *vp,
1034 bool *recycle)
1035 {
1036 int error;
1037 bool mpsafe;
1038 struct vop_inactive_args a;
1039 a.a_desc = VDESC(vop_inactive);
1040 a.a_vp = vp;
1041 a.a_recycle = recycle;
1042 mpsafe = (vp->v_vflag & VV_MPSAFE);
1043 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1044 error = (VCALL(vp, VOFFSET(vop_inactive), &a));
1045 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1046 return error;
1047 }
1048
1049 const int vop_reclaim_vp_offsets[] = {
1050 VOPARG_OFFSETOF(struct vop_reclaim_args,a_vp),
1051 VDESC_NO_OFFSET
1052 };
1053 const struct vnodeop_desc vop_reclaim_desc = {
1054 VOP_RECLAIM_DESCOFFSET,
1055 "vop_reclaim",
1056 0,
1057 vop_reclaim_vp_offsets,
1058 VDESC_NO_OFFSET,
1059 VDESC_NO_OFFSET,
1060 VDESC_NO_OFFSET,
1061 };
1062 int
1063 VOP_RECLAIM(struct vnode *vp)
1064 {
1065 int error;
1066 bool mpsafe;
1067 struct vop_reclaim_args a;
1068 a.a_desc = VDESC(vop_reclaim);
1069 a.a_vp = vp;
1070 mpsafe = (vp->v_vflag & VV_MPSAFE);
1071 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1072 error = (VCALL(vp, VOFFSET(vop_reclaim), &a));
1073 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1074 return error;
1075 }
1076
1077 const int vop_lock_vp_offsets[] = {
1078 VOPARG_OFFSETOF(struct vop_lock_args,a_vp),
1079 VDESC_NO_OFFSET
1080 };
1081 const struct vnodeop_desc vop_lock_desc = {
1082 VOP_LOCK_DESCOFFSET,
1083 "vop_lock",
1084 0,
1085 vop_lock_vp_offsets,
1086 VDESC_NO_OFFSET,
1087 VDESC_NO_OFFSET,
1088 VDESC_NO_OFFSET,
1089 };
1090 int
1091 VOP_LOCK(struct vnode *vp,
1092 int flags)
1093 {
1094 int error;
1095 bool mpsafe;
1096 struct vop_lock_args a;
1097 a.a_desc = VDESC(vop_lock);
1098 a.a_vp = vp;
1099 a.a_flags = flags;
1100 mpsafe = (vp->v_vflag & VV_MPSAFE);
1101 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1102 error = (VCALL(vp, VOFFSET(vop_lock), &a));
1103 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1104 return error;
1105 }
1106
1107 const int vop_unlock_vp_offsets[] = {
1108 VOPARG_OFFSETOF(struct vop_unlock_args,a_vp),
1109 VDESC_NO_OFFSET
1110 };
1111 const struct vnodeop_desc vop_unlock_desc = {
1112 VOP_UNLOCK_DESCOFFSET,
1113 "vop_unlock",
1114 0,
1115 vop_unlock_vp_offsets,
1116 VDESC_NO_OFFSET,
1117 VDESC_NO_OFFSET,
1118 VDESC_NO_OFFSET,
1119 };
1120 int
1121 VOP_UNLOCK(struct vnode *vp)
1122 {
1123 int error;
1124 bool mpsafe;
1125 struct vop_unlock_args a;
1126 a.a_desc = VDESC(vop_unlock);
1127 a.a_vp = vp;
1128 mpsafe = (vp->v_vflag & VV_MPSAFE);
1129 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1130 error = (VCALL(vp, VOFFSET(vop_unlock), &a));
1131 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1132 return error;
1133 }
1134
1135 const int vop_bmap_vp_offsets[] = {
1136 VOPARG_OFFSETOF(struct vop_bmap_args,a_vp),
1137 VDESC_NO_OFFSET
1138 };
1139 const struct vnodeop_desc vop_bmap_desc = {
1140 VOP_BMAP_DESCOFFSET,
1141 "vop_bmap",
1142 0,
1143 vop_bmap_vp_offsets,
1144 VOPARG_OFFSETOF(struct vop_bmap_args, a_vpp),
1145 VDESC_NO_OFFSET,
1146 VDESC_NO_OFFSET,
1147 };
1148 int
1149 VOP_BMAP(struct vnode *vp,
1150 daddr_t bn,
1151 struct vnode **vpp,
1152 daddr_t *bnp,
1153 int *runp)
1154 {
1155 int error;
1156 bool mpsafe;
1157 struct vop_bmap_args a;
1158 a.a_desc = VDESC(vop_bmap);
1159 a.a_vp = vp;
1160 a.a_bn = bn;
1161 a.a_vpp = vpp;
1162 a.a_bnp = bnp;
1163 a.a_runp = runp;
1164 mpsafe = (vp->v_vflag & VV_MPSAFE);
1165 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1166 error = (VCALL(vp, VOFFSET(vop_bmap), &a));
1167 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1168 return error;
1169 }
1170
1171 const int vop_strategy_vp_offsets[] = {
1172 VOPARG_OFFSETOF(struct vop_strategy_args,a_vp),
1173 VDESC_NO_OFFSET
1174 };
1175 const struct vnodeop_desc vop_strategy_desc = {
1176 VOP_STRATEGY_DESCOFFSET,
1177 "vop_strategy",
1178 0,
1179 vop_strategy_vp_offsets,
1180 VDESC_NO_OFFSET,
1181 VDESC_NO_OFFSET,
1182 VDESC_NO_OFFSET,
1183 };
1184 int
1185 VOP_STRATEGY(struct vnode *vp,
1186 struct buf *bp)
1187 {
1188 int error;
1189 bool mpsafe;
1190 struct vop_strategy_args a;
1191 a.a_desc = VDESC(vop_strategy);
1192 a.a_vp = vp;
1193 a.a_bp = bp;
1194 mpsafe = (vp->v_vflag & VV_MPSAFE);
1195 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1196 error = (VCALL(vp, VOFFSET(vop_strategy), &a));
1197 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1198 return error;
1199 }
1200
1201 const int vop_print_vp_offsets[] = {
1202 VOPARG_OFFSETOF(struct vop_print_args,a_vp),
1203 VDESC_NO_OFFSET
1204 };
1205 const struct vnodeop_desc vop_print_desc = {
1206 VOP_PRINT_DESCOFFSET,
1207 "vop_print",
1208 0,
1209 vop_print_vp_offsets,
1210 VDESC_NO_OFFSET,
1211 VDESC_NO_OFFSET,
1212 VDESC_NO_OFFSET,
1213 };
1214 int
1215 VOP_PRINT(struct vnode *vp)
1216 {
1217 int error;
1218 bool mpsafe;
1219 struct vop_print_args a;
1220 a.a_desc = VDESC(vop_print);
1221 a.a_vp = vp;
1222 mpsafe = (vp->v_vflag & VV_MPSAFE);
1223 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1224 error = (VCALL(vp, VOFFSET(vop_print), &a));
1225 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1226 return error;
1227 }
1228
1229 const int vop_islocked_vp_offsets[] = {
1230 VOPARG_OFFSETOF(struct vop_islocked_args,a_vp),
1231 VDESC_NO_OFFSET
1232 };
1233 const struct vnodeop_desc vop_islocked_desc = {
1234 VOP_ISLOCKED_DESCOFFSET,
1235 "vop_islocked",
1236 0,
1237 vop_islocked_vp_offsets,
1238 VDESC_NO_OFFSET,
1239 VDESC_NO_OFFSET,
1240 VDESC_NO_OFFSET,
1241 };
1242 int
1243 VOP_ISLOCKED(struct vnode *vp)
1244 {
1245 int error;
1246 bool mpsafe;
1247 struct vop_islocked_args a;
1248 a.a_desc = VDESC(vop_islocked);
1249 a.a_vp = vp;
1250 mpsafe = (vp->v_vflag & VV_MPSAFE);
1251 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1252 error = (VCALL(vp, VOFFSET(vop_islocked), &a));
1253 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1254 return error;
1255 }
1256
1257 const int vop_pathconf_vp_offsets[] = {
1258 VOPARG_OFFSETOF(struct vop_pathconf_args,a_vp),
1259 VDESC_NO_OFFSET
1260 };
1261 const struct vnodeop_desc vop_pathconf_desc = {
1262 VOP_PATHCONF_DESCOFFSET,
1263 "vop_pathconf",
1264 0,
1265 vop_pathconf_vp_offsets,
1266 VDESC_NO_OFFSET,
1267 VDESC_NO_OFFSET,
1268 VDESC_NO_OFFSET,
1269 };
1270 int
1271 VOP_PATHCONF(struct vnode *vp,
1272 int name,
1273 register_t *retval)
1274 {
1275 int error;
1276 bool mpsafe;
1277 struct vop_pathconf_args a;
1278 a.a_desc = VDESC(vop_pathconf);
1279 a.a_vp = vp;
1280 a.a_name = name;
1281 a.a_retval = retval;
1282 mpsafe = (vp->v_vflag & VV_MPSAFE);
1283 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1284 error = (VCALL(vp, VOFFSET(vop_pathconf), &a));
1285 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1286 return error;
1287 }
1288
1289 const int vop_advlock_vp_offsets[] = {
1290 VOPARG_OFFSETOF(struct vop_advlock_args,a_vp),
1291 VDESC_NO_OFFSET
1292 };
1293 const struct vnodeop_desc vop_advlock_desc = {
1294 VOP_ADVLOCK_DESCOFFSET,
1295 "vop_advlock",
1296 0,
1297 vop_advlock_vp_offsets,
1298 VDESC_NO_OFFSET,
1299 VDESC_NO_OFFSET,
1300 VDESC_NO_OFFSET,
1301 };
1302 int
1303 VOP_ADVLOCK(struct vnode *vp,
1304 void *id,
1305 int op,
1306 struct flock *fl,
1307 int flags)
1308 {
1309 int error;
1310 bool mpsafe;
1311 struct vop_advlock_args a;
1312 a.a_desc = VDESC(vop_advlock);
1313 a.a_vp = vp;
1314 a.a_id = id;
1315 a.a_op = op;
1316 a.a_fl = fl;
1317 a.a_flags = flags;
1318 mpsafe = (vp->v_vflag & VV_MPSAFE);
1319 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1320 error = (VCALL(vp, VOFFSET(vop_advlock), &a));
1321 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1322 return error;
1323 }
1324
1325 const int vop_whiteout_vp_offsets[] = {
1326 VOPARG_OFFSETOF(struct vop_whiteout_args,a_dvp),
1327 VDESC_NO_OFFSET
1328 };
1329 const struct vnodeop_desc vop_whiteout_desc = {
1330 VOP_WHITEOUT_DESCOFFSET,
1331 "vop_whiteout",
1332 0,
1333 vop_whiteout_vp_offsets,
1334 VDESC_NO_OFFSET,
1335 VDESC_NO_OFFSET,
1336 VOPARG_OFFSETOF(struct vop_whiteout_args, a_cnp),
1337 };
1338 int
1339 VOP_WHITEOUT(struct vnode *dvp,
1340 struct componentname *cnp,
1341 int flags)
1342 {
1343 int error;
1344 bool mpsafe;
1345 struct vop_whiteout_args a;
1346 a.a_desc = VDESC(vop_whiteout);
1347 a.a_dvp = dvp;
1348 a.a_cnp = cnp;
1349 a.a_flags = flags;
1350 mpsafe = (dvp->v_vflag & VV_MPSAFE);
1351 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1352 error = (VCALL(dvp, VOFFSET(vop_whiteout), &a));
1353 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1354 return error;
1355 }
1356
1357 const int vop_getpages_vp_offsets[] = {
1358 VOPARG_OFFSETOF(struct vop_getpages_args,a_vp),
1359 VDESC_NO_OFFSET
1360 };
1361 const struct vnodeop_desc vop_getpages_desc = {
1362 VOP_GETPAGES_DESCOFFSET,
1363 "vop_getpages",
1364 0,
1365 vop_getpages_vp_offsets,
1366 VDESC_NO_OFFSET,
1367 VDESC_NO_OFFSET,
1368 VDESC_NO_OFFSET,
1369 };
1370 int
1371 VOP_GETPAGES(struct vnode *vp,
1372 voff_t offset,
1373 struct vm_page **m,
1374 int *count,
1375 int centeridx,
1376 vm_prot_t access_type,
1377 int advice,
1378 int flags)
1379 {
1380 int error;
1381 bool mpsafe;
1382 struct vop_getpages_args a;
1383 a.a_desc = VDESC(vop_getpages);
1384 a.a_vp = vp;
1385 a.a_offset = offset;
1386 a.a_m = m;
1387 a.a_count = count;
1388 a.a_centeridx = centeridx;
1389 a.a_access_type = access_type;
1390 a.a_advice = advice;
1391 a.a_flags = flags;
1392 mpsafe = (vp->v_vflag & VV_MPSAFE);
1393 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1394 error = (VCALL(vp, VOFFSET(vop_getpages), &a));
1395 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1396 return error;
1397 }
1398
1399 const int vop_putpages_vp_offsets[] = {
1400 VOPARG_OFFSETOF(struct vop_putpages_args,a_vp),
1401 VDESC_NO_OFFSET
1402 };
1403 const struct vnodeop_desc vop_putpages_desc = {
1404 VOP_PUTPAGES_DESCOFFSET,
1405 "vop_putpages",
1406 0,
1407 vop_putpages_vp_offsets,
1408 VDESC_NO_OFFSET,
1409 VDESC_NO_OFFSET,
1410 VDESC_NO_OFFSET,
1411 };
1412 int
1413 VOP_PUTPAGES(struct vnode *vp,
1414 voff_t offlo,
1415 voff_t offhi,
1416 int flags)
1417 {
1418 int error;
1419 bool mpsafe;
1420 struct vop_putpages_args a;
1421 a.a_desc = VDESC(vop_putpages);
1422 a.a_vp = vp;
1423 a.a_offlo = offlo;
1424 a.a_offhi = offhi;
1425 a.a_flags = flags;
1426 mpsafe = (vp->v_vflag & VV_MPSAFE);
1427 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1428 error = (VCALL(vp, VOFFSET(vop_putpages), &a));
1429 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1430 return error;
1431 }
1432
1433 const int vop_closeextattr_vp_offsets[] = {
1434 VOPARG_OFFSETOF(struct vop_closeextattr_args,a_vp),
1435 VDESC_NO_OFFSET
1436 };
1437 const struct vnodeop_desc vop_closeextattr_desc = {
1438 VOP_CLOSEEXTATTR_DESCOFFSET,
1439 "vop_closeextattr",
1440 0,
1441 vop_closeextattr_vp_offsets,
1442 VDESC_NO_OFFSET,
1443 VOPARG_OFFSETOF(struct vop_closeextattr_args, a_cred),
1444 VDESC_NO_OFFSET,
1445 };
1446 int
1447 VOP_CLOSEEXTATTR(struct vnode *vp,
1448 int commit,
1449 kauth_cred_t cred)
1450 {
1451 int error;
1452 bool mpsafe;
1453 struct vop_closeextattr_args a;
1454 a.a_desc = VDESC(vop_closeextattr);
1455 a.a_vp = vp;
1456 a.a_commit = commit;
1457 a.a_cred = cred;
1458 mpsafe = (vp->v_vflag & VV_MPSAFE);
1459 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1460 error = (VCALL(vp, VOFFSET(vop_closeextattr), &a));
1461 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1462 return error;
1463 }
1464
1465 const int vop_getextattr_vp_offsets[] = {
1466 VOPARG_OFFSETOF(struct vop_getextattr_args,a_vp),
1467 VDESC_NO_OFFSET
1468 };
1469 const struct vnodeop_desc vop_getextattr_desc = {
1470 VOP_GETEXTATTR_DESCOFFSET,
1471 "vop_getextattr",
1472 0,
1473 vop_getextattr_vp_offsets,
1474 VDESC_NO_OFFSET,
1475 VOPARG_OFFSETOF(struct vop_getextattr_args, a_cred),
1476 VDESC_NO_OFFSET,
1477 };
1478 int
1479 VOP_GETEXTATTR(struct vnode *vp,
1480 int attrnamespace,
1481 const char *name,
1482 struct uio *uio,
1483 size_t *size,
1484 kauth_cred_t cred)
1485 {
1486 int error;
1487 bool mpsafe;
1488 struct vop_getextattr_args a;
1489 a.a_desc = VDESC(vop_getextattr);
1490 a.a_vp = vp;
1491 a.a_attrnamespace = attrnamespace;
1492 a.a_name = name;
1493 a.a_uio = uio;
1494 a.a_size = size;
1495 a.a_cred = cred;
1496 mpsafe = (vp->v_vflag & VV_MPSAFE);
1497 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1498 error = (VCALL(vp, VOFFSET(vop_getextattr), &a));
1499 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1500 return error;
1501 }
1502
1503 const int vop_listextattr_vp_offsets[] = {
1504 VOPARG_OFFSETOF(struct vop_listextattr_args,a_vp),
1505 VDESC_NO_OFFSET
1506 };
1507 const struct vnodeop_desc vop_listextattr_desc = {
1508 VOP_LISTEXTATTR_DESCOFFSET,
1509 "vop_listextattr",
1510 0,
1511 vop_listextattr_vp_offsets,
1512 VDESC_NO_OFFSET,
1513 VOPARG_OFFSETOF(struct vop_listextattr_args, a_cred),
1514 VDESC_NO_OFFSET,
1515 };
1516 int
1517 VOP_LISTEXTATTR(struct vnode *vp,
1518 int attrnamespace,
1519 struct uio *uio,
1520 size_t *size,
1521 int flag,
1522 kauth_cred_t cred)
1523 {
1524 int error;
1525 bool mpsafe;
1526 struct vop_listextattr_args a;
1527 a.a_desc = VDESC(vop_listextattr);
1528 a.a_vp = vp;
1529 a.a_attrnamespace = attrnamespace;
1530 a.a_uio = uio;
1531 a.a_size = size;
1532 a.a_flag = flag;
1533 a.a_cred = cred;
1534 mpsafe = (vp->v_vflag & VV_MPSAFE);
1535 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1536 error = (VCALL(vp, VOFFSET(vop_listextattr), &a));
1537 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1538 return error;
1539 }
1540
1541 const int vop_openextattr_vp_offsets[] = {
1542 VOPARG_OFFSETOF(struct vop_openextattr_args,a_vp),
1543 VDESC_NO_OFFSET
1544 };
1545 const struct vnodeop_desc vop_openextattr_desc = {
1546 VOP_OPENEXTATTR_DESCOFFSET,
1547 "vop_openextattr",
1548 0,
1549 vop_openextattr_vp_offsets,
1550 VDESC_NO_OFFSET,
1551 VOPARG_OFFSETOF(struct vop_openextattr_args, a_cred),
1552 VDESC_NO_OFFSET,
1553 };
1554 int
1555 VOP_OPENEXTATTR(struct vnode *vp,
1556 kauth_cred_t cred)
1557 {
1558 int error;
1559 bool mpsafe;
1560 struct vop_openextattr_args a;
1561 a.a_desc = VDESC(vop_openextattr);
1562 a.a_vp = vp;
1563 a.a_cred = cred;
1564 mpsafe = (vp->v_vflag & VV_MPSAFE);
1565 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1566 error = (VCALL(vp, VOFFSET(vop_openextattr), &a));
1567 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1568 return error;
1569 }
1570
1571 const int vop_deleteextattr_vp_offsets[] = {
1572 VOPARG_OFFSETOF(struct vop_deleteextattr_args,a_vp),
1573 VDESC_NO_OFFSET
1574 };
1575 const struct vnodeop_desc vop_deleteextattr_desc = {
1576 VOP_DELETEEXTATTR_DESCOFFSET,
1577 "vop_deleteextattr",
1578 0,
1579 vop_deleteextattr_vp_offsets,
1580 VDESC_NO_OFFSET,
1581 VOPARG_OFFSETOF(struct vop_deleteextattr_args, a_cred),
1582 VDESC_NO_OFFSET,
1583 };
1584 int
1585 VOP_DELETEEXTATTR(struct vnode *vp,
1586 int attrnamespace,
1587 const char *name,
1588 kauth_cred_t cred)
1589 {
1590 int error;
1591 bool mpsafe;
1592 struct vop_deleteextattr_args a;
1593 a.a_desc = VDESC(vop_deleteextattr);
1594 a.a_vp = vp;
1595 a.a_attrnamespace = attrnamespace;
1596 a.a_name = name;
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_deleteextattr), &a));
1601 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1602 return error;
1603 }
1604
1605 const int vop_setextattr_vp_offsets[] = {
1606 VOPARG_OFFSETOF(struct vop_setextattr_args,a_vp),
1607 VDESC_NO_OFFSET
1608 };
1609 const struct vnodeop_desc vop_setextattr_desc = {
1610 VOP_SETEXTATTR_DESCOFFSET,
1611 "vop_setextattr",
1612 0,
1613 vop_setextattr_vp_offsets,
1614 VDESC_NO_OFFSET,
1615 VOPARG_OFFSETOF(struct vop_setextattr_args, a_cred),
1616 VDESC_NO_OFFSET,
1617 };
1618 int
1619 VOP_SETEXTATTR(struct vnode *vp,
1620 int attrnamespace,
1621 const char *name,
1622 struct uio *uio,
1623 kauth_cred_t cred)
1624 {
1625 int error;
1626 bool mpsafe;
1627 struct vop_setextattr_args a;
1628 a.a_desc = VDESC(vop_setextattr);
1629 a.a_vp = vp;
1630 a.a_attrnamespace = attrnamespace;
1631 a.a_name = name;
1632 a.a_uio = uio;
1633 a.a_cred = cred;
1634 mpsafe = (vp->v_vflag & VV_MPSAFE);
1635 if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
1636 error = (VCALL(vp, VOFFSET(vop_setextattr), &a));
1637 if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
1638 return error;
1639 }
1640
1641 const struct vnodeop_desc * const vfs_op_descs[] = {
1642 &vop_default_desc, /* MUST BE FIRST */
1643
1644 &vop_bwrite_desc,
1645 &vop_lookup_desc,
1646 &vop_create_desc,
1647 &vop_mknod_desc,
1648 &vop_open_desc,
1649 &vop_close_desc,
1650 &vop_access_desc,
1651 &vop_getattr_desc,
1652 &vop_setattr_desc,
1653 &vop_read_desc,
1654 &vop_write_desc,
1655 &vop_ioctl_desc,
1656 &vop_fcntl_desc,
1657 &vop_poll_desc,
1658 &vop_kqfilter_desc,
1659 &vop_revoke_desc,
1660 &vop_mmap_desc,
1661 &vop_fsync_desc,
1662 &vop_seek_desc,
1663 &vop_remove_desc,
1664 &vop_link_desc,
1665 &vop_rename_desc,
1666 &vop_mkdir_desc,
1667 &vop_rmdir_desc,
1668 &vop_symlink_desc,
1669 &vop_readdir_desc,
1670 &vop_readlink_desc,
1671 &vop_abortop_desc,
1672 &vop_inactive_desc,
1673 &vop_reclaim_desc,
1674 &vop_lock_desc,
1675 &vop_unlock_desc,
1676 &vop_bmap_desc,
1677 &vop_strategy_desc,
1678 &vop_print_desc,
1679 &vop_islocked_desc,
1680 &vop_pathconf_desc,
1681 &vop_advlock_desc,
1682 &vop_whiteout_desc,
1683 &vop_getpages_desc,
1684 &vop_putpages_desc,
1685 &vop_closeextattr_desc,
1686 &vop_getextattr_desc,
1687 &vop_listextattr_desc,
1688 &vop_openextattr_desc,
1689 &vop_deleteextattr_desc,
1690 &vop_setextattr_desc,
1691 NULL
1692 };
1693