Line data Source code
1 : /* $OpenBSD: vfs_vops.c,v 1.19 2018/06/21 14:17:23 visa Exp $ */
2 : /*
3 : * Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org>
4 : *
5 : * Permission to use, copy, modify, and distribute this software for any
6 : * purpose with or without fee is hereby granted, provided that the above
7 : * copyright notice and this permission notice appear in all copies.
8 : *
9 : * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 : * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 : * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 : * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 : * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 : * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 : * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 : *
17 : * Copyright (c) 1992, 1993
18 : * The Regents of the University of California. All rights reserved.
19 : *
20 : * Redistribution and use in source and binary forms, with or without
21 : * modification, are permitted provided that the following conditions
22 : * are met:
23 : * 1. Redistributions of source code must retain the above copyright
24 : * notice, this list of conditions and the following disclaimer.
25 : * 2. Redistributions in binary form must reproduce the above copyright
26 : * notice, this list of conditions and the following disclaimer in the
27 : * documentation and/or other materials provided with the distribution.
28 : * 3. Neither the name of the University nor the names of its contributors
29 : * may be used to endorse or promote products derived from this software
30 : * without specific prior written permission.
31 : *
32 : * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND
33 : * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 : * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 : * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
36 : * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 : * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 : * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 : * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40 : * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41 : * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 : * SUCH DAMAGE.
43 : */
44 :
45 : #include <sys/param.h>
46 : #include <sys/vnode.h>
47 : #include <sys/unistd.h>
48 : #include <sys/systm.h>
49 :
50 : #ifdef VFSLCKDEBUG
51 : #include <sys/systm.h> /* for panic() */
52 :
53 : #define ASSERT_VP_ISLOCKED(vp) do { \
54 : if (((vp)->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) { \
55 : VOP_PRINT(vp); \
56 : panic("vp not locked"); \
57 : } \
58 : } while (0)
59 : #else
60 : #define ASSERT_VP_ISLOCKED(vp) /* nothing */
61 : #endif
62 :
63 : int
64 0 : VOP_ISLOCKED(struct vnode *vp)
65 : {
66 0 : struct vop_islocked_args a;
67 0 : a.a_vp = vp;
68 :
69 0 : if (vp->v_op->vop_islocked == NULL)
70 0 : return (EOPNOTSUPP);
71 :
72 0 : return ((vp->v_op->vop_islocked)(&a));
73 0 : }
74 :
75 : int
76 0 : VOP_LOOKUP(struct vnode *dvp, struct vnode **vpp,
77 : struct componentname *cnp)
78 : {
79 : int r;
80 0 : struct vop_lookup_args a;
81 0 : a.a_dvp = dvp;
82 0 : a.a_vpp = vpp;
83 0 : a.a_cnp = cnp;
84 :
85 0 : if (dvp->v_op->vop_lookup == NULL)
86 0 : return (EOPNOTSUPP);
87 :
88 0 : dvp->v_inflight++;
89 0 : r = (dvp->v_op->vop_lookup)(&a);
90 0 : dvp->v_inflight--;
91 0 : return r;
92 0 : }
93 :
94 : int
95 0 : VOP_CREATE(struct vnode *dvp, struct vnode **vpp,
96 : struct componentname *cnp, struct vattr *vap)
97 : {
98 : int r;
99 0 : struct vop_create_args a;
100 0 : a.a_dvp = dvp;
101 0 : a.a_vpp = vpp;
102 0 : a.a_cnp = cnp;
103 0 : a.a_vap = vap;
104 :
105 : ASSERT_VP_ISLOCKED(dvp);
106 :
107 0 : if (dvp->v_op->vop_create == NULL)
108 0 : return (EOPNOTSUPP);
109 :
110 0 : dvp->v_inflight++;
111 0 : r = (dvp->v_op->vop_create)(&a);
112 0 : dvp->v_inflight--;
113 0 : return r;
114 0 : }
115 :
116 : int
117 0 : VOP_MKNOD(struct vnode *dvp, struct vnode **vpp,
118 : struct componentname *cnp, struct vattr *vap)
119 : {
120 : int r;
121 0 : struct vop_mknod_args a;
122 0 : a.a_dvp = dvp;
123 0 : a.a_vpp = vpp;
124 0 : a.a_cnp = cnp;
125 0 : a.a_vap = vap;
126 :
127 : ASSERT_VP_ISLOCKED(dvp);
128 :
129 0 : if (dvp->v_op->vop_mknod == NULL)
130 0 : return (EOPNOTSUPP);
131 :
132 0 : dvp->v_inflight++;
133 0 : r = (dvp->v_op->vop_mknod)(&a);
134 0 : dvp->v_inflight--;
135 0 : return r;
136 0 : }
137 :
138 : int
139 0 : VOP_OPEN(struct vnode *vp, int mode, struct ucred *cred, struct proc *p)
140 : {
141 : int r;
142 0 : struct vop_open_args a;
143 0 : a.a_vp = vp;
144 0 : a.a_mode = mode;
145 0 : a.a_cred = cred;
146 0 : a.a_p = p;
147 :
148 0 : if (vp->v_op->vop_open == NULL)
149 0 : return (EOPNOTSUPP);
150 :
151 0 : vp->v_inflight++;
152 0 : r = (vp->v_op->vop_open)(&a);
153 0 : vp->v_inflight--;
154 0 : return r;
155 0 : }
156 :
157 : int
158 0 : VOP_CLOSE(struct vnode *vp, int fflag, struct ucred *cred, struct proc *p)
159 : {
160 : int r;
161 0 : struct vop_close_args a;
162 0 : a.a_vp = vp;
163 0 : a.a_fflag = fflag;
164 0 : a.a_cred = cred;
165 0 : a.a_p = p;
166 :
167 : ASSERT_VP_ISLOCKED(vp);
168 :
169 0 : if (vp->v_op->vop_close == NULL)
170 0 : return (EOPNOTSUPP);
171 :
172 0 : vp->v_inflight++;
173 0 : r = (vp->v_op->vop_close)(&a);
174 0 : vp->v_inflight--;
175 0 : return r;
176 0 : }
177 :
178 : int
179 0 : VOP_ACCESS(struct vnode *vp, int mode, struct ucred *cred, struct proc *p)
180 : {
181 0 : struct vop_access_args a;
182 0 : a.a_vp = vp;
183 0 : a.a_mode = mode;
184 0 : a.a_cred = cred;
185 0 : a.a_p = p;
186 :
187 : ASSERT_VP_ISLOCKED(vp);
188 :
189 0 : if (vp->v_op->vop_access == NULL)
190 0 : return (EOPNOTSUPP);
191 :
192 0 : return ((vp->v_op->vop_access)(&a));
193 0 : }
194 :
195 : int
196 0 : VOP_GETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred,
197 : struct proc *p)
198 : {
199 0 : struct vop_getattr_args a;
200 0 : a.a_vp = vp;
201 0 : a.a_vap = vap;
202 0 : a.a_cred = cred;
203 0 : a.a_p = p;
204 :
205 0 : if (vp->v_op->vop_getattr == NULL)
206 0 : return (EOPNOTSUPP);
207 :
208 0 : return ((vp->v_op->vop_getattr)(&a));
209 0 : }
210 :
211 : int
212 0 : VOP_SETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred,
213 : struct proc *p)
214 : {
215 : int r;
216 0 : struct vop_setattr_args a;
217 0 : a.a_vp = vp;
218 0 : a.a_vap = vap;
219 0 : a.a_cred = cred;
220 0 : a.a_p = p;
221 :
222 : ASSERT_VP_ISLOCKED(vp);
223 :
224 0 : if (vp->v_op->vop_setattr == NULL)
225 0 : return (EOPNOTSUPP);
226 :
227 0 : vp->v_inflight++;
228 0 : r = (vp->v_op->vop_setattr)(&a);
229 0 : vp->v_inflight--;
230 0 : return r;
231 0 : }
232 :
233 : int
234 0 : VOP_READ(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
235 : {
236 0 : struct vop_read_args a;
237 0 : a.a_vp = vp;
238 0 : a.a_uio = uio;
239 0 : a.a_ioflag = ioflag;
240 0 : a.a_cred = cred;
241 :
242 : ASSERT_VP_ISLOCKED(vp);
243 :
244 0 : if (vp->v_op->vop_read == NULL)
245 0 : return (EOPNOTSUPP);
246 :
247 0 : return ((vp->v_op->vop_read)(&a));
248 0 : }
249 :
250 : int
251 0 : VOP_WRITE(struct vnode *vp, struct uio *uio, int ioflag,
252 : struct ucred *cred)
253 : {
254 : int r;
255 0 : struct vop_write_args a;
256 0 : a.a_vp = vp;
257 0 : a.a_uio = uio;
258 0 : a.a_ioflag = ioflag;
259 0 : a.a_cred = cred;
260 :
261 : ASSERT_VP_ISLOCKED(vp);
262 :
263 0 : if (vp->v_op->vop_write == NULL)
264 0 : return (EOPNOTSUPP);
265 :
266 0 : vp->v_inflight++;
267 0 : r = (vp->v_op->vop_write)(&a);
268 0 : vp->v_inflight--;
269 0 : return r;
270 0 : }
271 :
272 : int
273 0 : VOP_IOCTL(struct vnode *vp, u_long command, void *data, int fflag,
274 : struct ucred *cred, struct proc *p)
275 : {
276 : int r;
277 0 : struct vop_ioctl_args a;
278 0 : a.a_vp = vp;
279 0 : a.a_command = command;
280 0 : a.a_data = data;
281 0 : a.a_fflag = fflag;
282 0 : a.a_cred = cred;
283 0 : a.a_p = p;
284 :
285 0 : if (vp->v_op->vop_ioctl == NULL)
286 0 : return (EOPNOTSUPP);
287 :
288 0 : vp->v_inflight++;
289 0 : r = (vp->v_op->vop_ioctl)(&a);
290 0 : vp->v_inflight--;
291 0 : return r;
292 0 : }
293 :
294 : int
295 0 : VOP_POLL(struct vnode *vp, int fflag, int events, struct proc *p)
296 : {
297 0 : struct vop_poll_args a;
298 0 : a.a_vp = vp;
299 0 : a.a_fflag = fflag;
300 0 : a.a_events = events;
301 0 : a.a_p = p;
302 :
303 0 : if (vp->v_op->vop_poll == NULL)
304 0 : return (EOPNOTSUPP);
305 :
306 0 : return ((vp->v_op->vop_poll)(&a));
307 0 : }
308 :
309 : int
310 0 : VOP_KQFILTER(struct vnode *vp, struct knote *kn)
311 : {
312 0 : struct vop_kqfilter_args a;
313 0 : a.a_vp = vp;
314 0 : a.a_kn = kn;
315 :
316 0 : if (vp->v_op->vop_kqfilter == NULL)
317 0 : return (EOPNOTSUPP);
318 :
319 0 : return ((vp->v_op->vop_kqfilter)(&a));
320 0 : }
321 :
322 : int
323 0 : VOP_REVOKE(struct vnode *vp, int flags)
324 : {
325 0 : struct vop_revoke_args a;
326 0 : a.a_vp = vp;
327 0 : a.a_flags = flags;
328 :
329 0 : if (vp->v_op->vop_revoke == NULL)
330 0 : return (EOPNOTSUPP);
331 :
332 0 : return ((vp->v_op->vop_revoke)(&a));
333 0 : }
334 :
335 : int
336 0 : VOP_FSYNC(struct vnode *vp, struct ucred *cred, int waitfor,
337 : struct proc *p)
338 : {
339 : int r;
340 0 : struct vop_fsync_args a;
341 0 : a.a_vp = vp;
342 0 : a.a_cred = cred;
343 0 : a.a_waitfor = waitfor;
344 0 : a.a_p = p;
345 :
346 : ASSERT_VP_ISLOCKED(vp);
347 :
348 0 : if (vp->v_op->vop_fsync == NULL)
349 0 : return (EOPNOTSUPP);
350 :
351 0 : vp->v_inflight++;
352 0 : r = (vp->v_op->vop_fsync)(&a);
353 0 : vp->v_inflight--;
354 0 : return r;
355 0 : }
356 :
357 : int
358 0 : VOP_REMOVE(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
359 : {
360 : int r;
361 0 : struct vop_remove_args a;
362 0 : a.a_dvp = dvp;
363 0 : a.a_vp = vp;
364 0 : a.a_cnp = cnp;
365 :
366 : ASSERT_VP_ISLOCKED(dvp);
367 : ASSERT_VP_ISLOCKED(vp);
368 :
369 0 : if (dvp->v_op->vop_remove == NULL)
370 0 : return (EOPNOTSUPP);
371 :
372 0 : dvp->v_inflight++;
373 0 : r = (dvp->v_op->vop_remove)(&a);
374 0 : dvp->v_inflight--;
375 0 : return r;
376 0 : }
377 :
378 : int
379 0 : VOP_LINK(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
380 : {
381 : int r;
382 0 : struct vop_link_args a;
383 0 : a.a_dvp = dvp;
384 0 : a.a_vp = vp;
385 0 : a.a_cnp = cnp;
386 :
387 : ASSERT_VP_ISLOCKED(dvp);
388 :
389 0 : if (dvp->v_op->vop_link == NULL)
390 0 : return (EOPNOTSUPP);
391 :
392 0 : dvp->v_inflight++;
393 0 : vp->v_inflight++;
394 0 : r = (dvp->v_op->vop_link)(&a);
395 0 : dvp->v_inflight--;
396 0 : vp->v_inflight--;
397 0 : return r;
398 0 : }
399 :
400 : int
401 0 : VOP_RENAME(struct vnode *fdvp, struct vnode *fvp,
402 : struct componentname *fcnp, struct vnode *tdvp, struct vnode *tvp,
403 : struct componentname *tcnp)
404 : {
405 : int r;
406 0 : struct vop_rename_args a;
407 0 : a.a_fdvp = fdvp;
408 0 : a.a_fvp = fvp;
409 0 : a.a_fcnp = fcnp;
410 0 : a.a_tdvp = tdvp;
411 0 : a.a_tvp = tvp;
412 0 : a.a_tcnp = tcnp;
413 :
414 : ASSERT_VP_ISLOCKED(tdvp);
415 :
416 0 : if (fdvp->v_op->vop_rename == NULL)
417 0 : return (EOPNOTSUPP);
418 :
419 0 : fdvp->v_inflight++;
420 0 : tdvp->v_inflight++;
421 0 : r = (fdvp->v_op->vop_rename)(&a);
422 0 : fdvp->v_inflight--;
423 0 : tdvp->v_inflight--;
424 0 : return r;
425 0 : }
426 :
427 : int
428 0 : VOP_MKDIR(struct vnode *dvp, struct vnode **vpp,
429 : struct componentname *cnp, struct vattr *vap)
430 : {
431 : int r;
432 0 : struct vop_mkdir_args a;
433 0 : a.a_dvp = dvp;
434 0 : a.a_vpp = vpp;
435 0 : a.a_cnp = cnp;
436 0 : a.a_vap = vap;
437 :
438 : ASSERT_VP_ISLOCKED(dvp);
439 :
440 0 : if (dvp->v_op->vop_mkdir == NULL)
441 0 : return (EOPNOTSUPP);
442 :
443 0 : dvp->v_inflight++;
444 0 : r = (dvp->v_op->vop_mkdir)(&a);
445 0 : dvp->v_inflight--;
446 0 : return r;
447 0 : }
448 :
449 : int
450 0 : VOP_RMDIR(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
451 : {
452 : int r;
453 0 : struct vop_rmdir_args a;
454 0 : a.a_dvp = dvp;
455 0 : a.a_vp = vp;
456 0 : a.a_cnp = cnp;
457 :
458 : ASSERT_VP_ISLOCKED(dvp);
459 : ASSERT_VP_ISLOCKED(vp);
460 :
461 0 : KASSERT(dvp != vp);
462 :
463 0 : if (dvp->v_op->vop_rmdir == NULL)
464 0 : return (EOPNOTSUPP);
465 :
466 0 : dvp->v_inflight++;
467 0 : vp->v_inflight++;
468 0 : r = (dvp->v_op->vop_rmdir)(&a);
469 0 : dvp->v_inflight--;
470 0 : vp->v_inflight--;
471 0 : return r;
472 0 : }
473 :
474 : int
475 0 : VOP_SYMLINK(struct vnode *dvp, struct vnode **vpp,
476 : struct componentname *cnp, struct vattr *vap, char *target)
477 : {
478 : int r;
479 0 : struct vop_symlink_args a;
480 0 : a.a_dvp = dvp;
481 0 : a.a_vpp = vpp;
482 0 : a.a_cnp = cnp;
483 0 : a.a_vap = vap;
484 0 : a.a_target = target;
485 :
486 : ASSERT_VP_ISLOCKED(dvp);
487 :
488 0 : if (dvp->v_op->vop_symlink == NULL)
489 0 : return (EOPNOTSUPP);
490 :
491 0 : dvp->v_inflight++;
492 0 : r = (dvp->v_op->vop_symlink)(&a);
493 0 : dvp->v_inflight--;
494 0 : return r;
495 0 : }
496 :
497 : int
498 0 : VOP_READDIR(struct vnode *vp, struct uio *uio, struct ucred *cred,
499 : int *eofflag)
500 : {
501 : int r;
502 0 : struct vop_readdir_args a;
503 0 : a.a_vp = vp;
504 0 : a.a_uio = uio;
505 0 : a.a_cred = cred;
506 0 : a.a_eofflag = eofflag;
507 :
508 : ASSERT_VP_ISLOCKED(vp);
509 :
510 0 : if (vp->v_op->vop_readdir == NULL)
511 0 : return (EOPNOTSUPP);
512 :
513 0 : vp->v_inflight++;
514 0 : r = (vp->v_op->vop_readdir)(&a);
515 0 : vp->v_inflight--;
516 0 : return r;
517 0 : }
518 :
519 : int
520 0 : VOP_READLINK(struct vnode *vp, struct uio *uio, struct ucred *cred)
521 : {
522 : int r;
523 0 : struct vop_readlink_args a;
524 0 : a.a_vp = vp;
525 0 : a.a_uio = uio;
526 0 : a.a_cred = cred;
527 :
528 : ASSERT_VP_ISLOCKED(vp);
529 :
530 0 : if (vp->v_op->vop_readlink == NULL)
531 0 : return (EOPNOTSUPP);
532 :
533 0 : vp->v_inflight++;
534 0 : r = (vp->v_op->vop_readlink)(&a);
535 0 : vp->v_inflight--;
536 0 : return r;
537 0 : }
538 :
539 : int
540 0 : VOP_ABORTOP(struct vnode *dvp, struct componentname *cnp)
541 : {
542 : int r;
543 0 : struct vop_abortop_args a;
544 0 : a.a_dvp = dvp;
545 0 : a.a_cnp = cnp;
546 :
547 0 : if (dvp->v_op->vop_abortop == NULL)
548 0 : return (EOPNOTSUPP);
549 :
550 0 : dvp->v_inflight++;
551 0 : r = (dvp->v_op->vop_abortop)(&a);
552 0 : dvp->v_inflight--;
553 0 : return r;
554 0 : }
555 :
556 : int
557 0 : VOP_INACTIVE(struct vnode *vp, struct proc *p)
558 : {
559 0 : struct vop_inactive_args a;
560 0 : a.a_vp = vp;
561 0 : a.a_p = p;
562 :
563 : ASSERT_VP_ISLOCKED(vp);
564 :
565 0 : if (vp->v_op->vop_inactive == NULL)
566 0 : return (EOPNOTSUPP);
567 :
568 0 : return ((vp->v_op->vop_inactive)(&a));
569 0 : }
570 :
571 : int
572 0 : VOP_RECLAIM(struct vnode *vp, struct proc *p)
573 : {
574 : int r;
575 0 : struct vop_reclaim_args a;
576 0 : a.a_vp = vp;
577 0 : a.a_p = p;
578 :
579 0 : if (vp->v_op->vop_reclaim == NULL)
580 0 : return (EOPNOTSUPP);
581 :
582 0 : vp->v_inflight++;
583 0 : r = (vp->v_op->vop_reclaim)(&a);
584 0 : vp->v_inflight--;
585 0 : return r;
586 0 : }
587 :
588 : int
589 0 : VOP_LOCK(struct vnode *vp, int flags)
590 : {
591 0 : struct vop_lock_args a;
592 0 : a.a_vp = vp;
593 0 : a.a_flags = flags;
594 :
595 0 : if (vp->v_op->vop_lock == NULL)
596 0 : return (EOPNOTSUPP);
597 :
598 0 : return ((vp->v_op->vop_lock)(&a));
599 0 : }
600 :
601 : int
602 0 : VOP_UNLOCK(struct vnode *vp)
603 : {
604 : int r;
605 0 : struct vop_unlock_args a;
606 0 : a.a_vp = vp;
607 :
608 0 : if (vp->v_op->vop_unlock == NULL)
609 0 : return (EOPNOTSUPP);
610 :
611 0 : vp->v_inflight++;
612 0 : r = (vp->v_op->vop_unlock)(&a);
613 0 : vp->v_inflight--;
614 0 : return r;
615 0 : }
616 :
617 : int
618 0 : VOP_BMAP(struct vnode *vp, daddr_t bn, struct vnode **vpp,
619 : daddr_t *bnp, int *runp)
620 : {
621 0 : struct vop_bmap_args a;
622 0 : a.a_vp = vp;
623 0 : a.a_bn = bn;
624 0 : a.a_vpp = vpp;
625 0 : a.a_bnp = bnp;
626 0 : a.a_runp = runp;
627 :
628 : ASSERT_VP_ISLOCKED(vp);
629 :
630 0 : if (vp->v_op->vop_bmap == NULL)
631 0 : return (EOPNOTSUPP);
632 :
633 0 : return ((vp->v_op->vop_bmap)(&a));
634 0 : }
635 :
636 : int
637 0 : VOP_PRINT(struct vnode *vp)
638 : {
639 0 : struct vop_print_args a;
640 0 : a.a_vp = vp;
641 :
642 0 : if (vp->v_op->vop_print == NULL)
643 0 : return (EOPNOTSUPP);
644 :
645 0 : return ((vp->v_op->vop_print)(&a));
646 0 : }
647 :
648 : int
649 0 : VOP_PATHCONF(struct vnode *vp, int name, register_t *retval)
650 : {
651 0 : struct vop_pathconf_args a;
652 :
653 : /*
654 : * Handle names that are constant across filesystem
655 : */
656 0 : switch (name) {
657 : case _PC_PATH_MAX:
658 0 : *retval = PATH_MAX;
659 0 : return (0);
660 : case _PC_PIPE_BUF:
661 0 : *retval = PIPE_BUF;
662 0 : return (0);
663 : case _PC_ASYNC_IO:
664 : case _PC_PRIO_IO:
665 : case _PC_SYNC_IO:
666 0 : *retval = 0;
667 0 : return (0);
668 :
669 : }
670 :
671 0 : a.a_vp = vp;
672 0 : a.a_name = name;
673 0 : a.a_retval = retval;
674 :
675 : ASSERT_VP_ISLOCKED(vp);
676 :
677 0 : if (vp->v_op->vop_pathconf == NULL)
678 0 : return (EOPNOTSUPP);
679 :
680 0 : return ((vp->v_op->vop_pathconf)(&a));
681 0 : }
682 :
683 : int
684 0 : VOP_ADVLOCK(struct vnode *vp, void *id, int op, struct flock *fl, int flags)
685 : {
686 : int r;
687 0 : struct vop_advlock_args a;
688 0 : a.a_vp = vp;
689 0 : a.a_id = id;
690 0 : a.a_op = op;
691 0 : a.a_fl = fl;
692 0 : a.a_flags = flags;
693 :
694 0 : if (vp->v_op->vop_advlock == NULL)
695 0 : return (EOPNOTSUPP);
696 :
697 0 : vp->v_inflight++;
698 0 : r = (vp->v_op->vop_advlock)(&a);
699 0 : vp->v_inflight--;
700 0 : return r;
701 0 : }
702 :
703 : int
704 0 : VOP_STRATEGY(struct buf *bp)
705 : {
706 0 : struct vop_strategy_args a;
707 0 : a.a_bp = bp;
708 :
709 0 : if ((ISSET(bp->b_flags, B_BC)) && (!ISSET(bp->b_flags, B_DMA)))
710 0 : panic("Non dma reachable buffer passed to VOP_STRATEGY");
711 :
712 0 : if (bp->b_vp->v_op->vop_strategy == NULL)
713 0 : return (EOPNOTSUPP);
714 :
715 0 : return ((bp->b_vp->v_op->vop_strategy)(&a));
716 0 : }
717 :
718 : int
719 0 : VOP_BWRITE(struct buf *bp)
720 : {
721 0 : struct vop_bwrite_args a;
722 0 : a.a_bp = bp;
723 :
724 0 : if (bp->b_vp->v_op->vop_bwrite == NULL)
725 0 : return (EOPNOTSUPP);
726 :
727 0 : return ((bp->b_vp->v_op->vop_bwrite)(&a));
728 0 : }
|