]> git.saurik.com Git - apple/xnu.git/blob - bsd/vfs/vfs_support.c
xnu-517.3.7.tar.gz
[apple/xnu.git] / bsd / vfs / vfs_support.c
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright (c) 1998-1999 Apple Computer, Inc. All rights reserved.
27 *
28 * File: vfs/vfs_support.c
29 *
30 * The default VFS routines. A VFS plugin can use these
31 * functions in case it does not want to implement all. These functions
32 * take care of releasing locks and free up memory that they are
33 * supposed to.
34 *
35 * nop_* routines always return 0 [success]
36 * err_* routines always return EOPNOTSUPP
37 *
38 * This file could be auto-generated from vnode_if.src. but that needs
39 * support for freeing cnp.
40 *
41 * HISTORY
42 * 15-Jul-1998 Earsh Nandkeshwar (earsh@apple.com)
43 * Fixed up readdirattr for its existance now.
44 * 18-Aug-1998 Umesh Vaishampayan (umeshv@apple.com)
45 * Created.
46 */
47
48 #include <vfs/vfs_support.h>
49
50
51 struct vop_create_args /* {
52 struct vnode *a_dvp;
53 struct vnode **a_vpp;
54 struct componentname *a_cnp;
55 struct vattr *a_vap;
56 } */;
57
58 int
59 nop_create(struct vop_create_args *ap)
60 {
61 #if DIAGNOSTIC
62 if ((ap->a_cnp->cn_flags & HASBUF) == 0)
63 panic("nop_create: no name");
64 #endif
65 VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
66 vput(ap->a_dvp);
67 return (0);
68 }
69
70 int
71 err_create(struct vop_create_args *ap)
72 {
73 (void)nop_create(ap);
74 return (EOPNOTSUPP);
75 }
76
77
78 struct vop_whiteout_args /* {
79 struct vnode *a_dvp;
80 struct componentname *a_cnp;
81 int a_flags;
82 } */;
83
84 int
85 nop_whiteout(struct vop_whiteout_args *ap)
86 {
87 return (0);
88 }
89
90 int
91 err_whiteout(struct vop_whiteout_args *ap)
92 {
93 return (EOPNOTSUPP);
94 }
95
96
97 struct vop_mknod_args /* {
98 struct vnode *a_dvp;
99 struct vnode **a_vpp;
100 struct componentname *a_cnp;
101 struct vattr *a_vap;
102 } */;
103
104 int
105 nop_mknod(struct vop_mknod_args *ap)
106 {
107 #if DIAGNOSTIC
108 if ((ap->a_cnp->cn_flags & HASBUF) == 0)
109 panic("nop_mknod: no name");
110 #endif
111 VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
112 vput(ap->a_dvp);
113 return (0);
114 }
115
116 int
117 err_mknod(struct vop_mknod_args *ap)
118 {
119 (void)nop_mknod(ap);
120 return (EOPNOTSUPP);
121 }
122
123
124 struct vop_mkcomplex_args /* {
125 struct vnode *a_dvp,
126 struct vnode **a_vpp,
127 struct componentname *a_cnp,
128 struct vattr *a_vap,
129 u_long a_type)
130 } */;
131
132 int
133 nop_mkcomplex(struct vop_mkcomplex_args *ap)
134 {
135 #if DIAGNOSTIC
136 if ((ap->a_cnp->cn_flags & HASBUF) == 0)
137 panic("nop_mkcomplex: no name");
138 #endif
139 VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
140 vput(ap->a_dvp);
141 return (0);
142 }
143
144 int
145 err_mkcomplex(struct vop_mkcomplex_args *ap)
146 {
147 (void)nop_mkcomplex(ap);
148 return (EOPNOTSUPP);
149 }
150
151
152 struct vop_open_args /* {
153 struct vnode *a_vp;
154 int a_mode;
155 struct ucred *a_cred;
156 struct proc *a_p;
157 } */;
158
159 int
160 nop_open(struct vop_open_args *ap)
161 {
162 return (0);
163 }
164
165 int
166 err_open(struct vop_open_args *ap)
167 {
168 return (EOPNOTSUPP);
169 }
170
171
172 struct vop_close_args /* {
173 struct vnode *a_vp;
174 int a_fflag;
175 struct ucred *a_cred;
176 struct proc *a_p;
177 } */;
178
179 int
180 nop_close(struct vop_close_args *ap)
181 {
182 return (0);
183 }
184
185 int
186 err_close(struct vop_close_args *ap)
187 {
188 return (EOPNOTSUPP);
189 }
190
191
192 struct vop_access_args /* {
193 struct vnode *a_vp;
194 int a_mode;
195 struct ucred *a_cred;
196 struct proc *a_p;
197 } */;
198
199 int
200 nop_access(struct vop_access_args *ap)
201 {
202 return (0);
203 }
204
205 int
206 err_access(struct vop_access_args *ap)
207 {
208 return (EOPNOTSUPP);
209 }
210
211
212 struct vop_getattr_args /* {
213 struct vnode *a_vp;
214 struct vattr *a_vap;
215 struct ucred *a_cred;
216 struct proc *a_p;
217 } */;
218
219 int
220 nop_getattr(struct vop_getattr_args *ap)
221 {
222 return (0);
223 }
224
225 int
226 err_getattr(struct vop_getattr_args *ap)
227 {
228 return (EOPNOTSUPP);
229 }
230
231
232 struct vop_setattr_args /* {
233 struct vnode *a_vp;
234 struct vattr *a_vap;
235 struct ucred *a_cred;
236 struct proc *a_p;
237 } */;
238
239 int
240 nop_setattr(struct vop_setattr_args *ap)
241 {
242 return (0);
243 }
244
245 int
246 err_setattr(struct vop_setattr_args *ap)
247 {
248 return (EOPNOTSUPP);
249 }
250
251
252 struct vop_getattrlist_args /* {
253 struct vnode *a_vp;
254 struct attrlist *a_alist;
255 struct uio *a_uio;
256 struct ucred *a_cred;
257 struct proc *a_p;
258 } */;
259
260 int
261 nop_getattrlist(struct vop_getattrlist_args *ap)
262 {
263 return (0);
264 }
265
266 int
267 err_getattrlist(struct vop_getattrlist_args *ap)
268 {
269 return (EOPNOTSUPP);
270 }
271
272
273 struct vop_setattrlist_args /* {
274 struct vnode *a_vp;
275 struct attrlist *a_alist;
276 struct uio *a_uio;
277 struct ucred *a_cred;
278 struct proc *a_p;
279 } */;
280
281 int
282 nop_setattrlist(struct vop_setattrlist_args *ap)
283 {
284 return (0);
285 }
286
287 int
288 err_setattrlist(struct vop_setattrlist_args *ap)
289 {
290 return (EOPNOTSUPP);
291 }
292
293
294 struct vop_read_args /* {
295 struct vnode *a_vp;
296 struct uio *a_uio;
297 int a_ioflag;
298 struct ucred *a_cred;
299 } */;
300
301 int
302 nop_read(struct vop_read_args *ap)
303 {
304 return (0);
305 }
306
307 int
308 err_read(struct vop_read_args *ap)
309 {
310 return (EOPNOTSUPP);
311 }
312
313
314 struct vop_write_args /* {
315 struct vnode *a_vp;
316 struct uio *a_uio;
317 int a_ioflag;
318 struct ucred *a_cred;
319 } */;
320
321 int
322 nop_write(struct vop_write_args *ap)
323 {
324 return (0);
325 }
326
327 int
328 err_write(struct vop_write_args *ap)
329 {
330 return (EOPNOTSUPP);
331 }
332
333
334 struct vop_lease_args /* {
335 struct vnode *a_vp;
336 struct proc *a_p;
337 struct ucred *a_cred;
338 int a_flag;
339 } */;
340
341 int
342 nop_lease(struct vop_lease_args *ap)
343 {
344 return (0);
345 }
346
347 int
348 err_lease(struct vop_lease_args *ap)
349 {
350 return (EOPNOTSUPP);
351 }
352
353
354 struct vop_ioctl_args /* {
355 struct vnode *a_vp;
356 u_long a_command;
357 caddr_t a_data;
358 int a_fflag;
359 struct ucred *a_cred;
360 struct proc *a_p;
361 } */;
362
363 int
364 nop_ioctl(struct vop_ioctl_args *ap)
365 {
366 return (0);
367 }
368
369 int
370 err_ioctl(struct vop_ioctl_args *ap)
371 {
372 return (EOPNOTSUPP);
373 }
374
375
376 struct vop_select_args /* {
377 struct vnode *a_vp;
378 int a_which;
379 int a_fflags;
380 struct ucred *a_cred;
381 void *a_wql;
382 struct proc *a_p;
383 } */;
384
385 int
386 nop_select(struct vop_select_args *ap)
387 {
388 return (0);
389 }
390
391 int
392 err_select(struct vop_select_args *ap)
393 {
394 return (EOPNOTSUPP);
395 }
396
397
398 struct vop_exchange_args /* {
399 struct vnode *a_fvp;
400 struct vnode *a_tvp;
401 struct ucred *a_cred;
402 struct proc *a_p;
403 } */;
404
405 int
406 nop_exchange(struct vop_exchange_args *ap)
407 {
408 return (0);
409 }
410
411 int
412 err_exchange(struct vop_exchange_args *ap)
413 {
414 return (EOPNOTSUPP);
415 }
416
417
418 struct vop_revoke_args /* {
419 struct vnode *a_vp;
420 int a_flags;
421 } */;
422
423 int
424 nop_revoke(struct vop_revoke_args *ap)
425 {
426 return (vop_revoke(ap));
427 }
428
429 int
430 err_revoke(struct vop_revoke_args *ap)
431 {
432 (void)nop_revoke(ap);
433 return (EOPNOTSUPP);
434 }
435
436
437 struct vop_mmap_args /* {
438 struct vnode *a_vp;
439 int a_fflags;
440 struct ucred *a_cred;
441 struct proc *a_p;
442 } */;
443
444 int
445 nop_mmap(struct vop_mmap_args *ap)
446 {
447 return (0);
448 }
449
450 int
451 err_mmap(struct vop_mmap_args *ap)
452 {
453 return (EOPNOTSUPP);
454 }
455
456
457 struct vop_fsync_args /* {
458 struct vnode *a_vp;
459 struct ucred *a_cred;
460 int a_waitfor;
461 struct proc *a_p;
462 } */;
463
464 int
465 nop_fsync(struct vop_fsync_args *ap)
466 {
467 return (0);
468 }
469
470 int
471 err_fsync(struct vop_fsync_args *ap)
472 {
473 return (EOPNOTSUPP);
474 }
475
476
477 struct vop_seek_args /* {
478 struct vnode *a_vp;
479 off_t a_oldoff;
480 off_t a_newoff;
481 struct ucred *a_cred;
482 } */;
483
484 int
485 nop_seek(struct vop_seek_args *ap)
486 {
487 return (0);
488 }
489
490 int
491 err_seek(struct vop_seek_args *ap)
492 {
493 return (EOPNOTSUPP);
494 }
495
496
497 struct vop_remove_args /* {
498 struct vnode *a_dvp;
499 struct vnode *a_vp;
500 struct componentname *a_cnp;
501 } */;
502
503 int
504 nop_remove(struct vop_remove_args *ap)
505 {
506 if (ap->a_dvp == ap->a_vp)
507 vrele(ap->a_vp);
508 else
509 vput(ap->a_vp);
510 vput(ap->a_dvp);
511 return (0);
512 }
513
514 int
515 err_remove(struct vop_remove_args *ap)
516 {
517 (void)nop_remove(ap);
518 return (EOPNOTSUPP);
519 }
520
521
522 struct vop_link_args /* {
523 struct vnode *a_vp;
524 struct vnode *a_tdvp;
525 struct componentname *a_cnp;
526 } */;
527
528 int
529 nop_link(struct vop_link_args *ap)
530 {
531 #if DIAGNOSTIC
532 if ((ap->a_cnp->cn_flags & HASBUF) == 0)
533 panic("nop_link: no name");
534 #endif
535 VOP_ABORTOP(ap->a_tdvp, ap->a_cnp);
536 vput(ap->a_tdvp);
537 return (0);
538 }
539
540 int
541 err_link(struct vop_link_args *ap)
542 {
543 (void)nop_link(ap);
544 return (EOPNOTSUPP);
545 }
546
547
548 struct vop_rename_args /* {
549 struct vnode *a_fdvp;
550 struct vnode *a_fvp;
551 struct componentname *a_fcnp;
552 struct vnode *a_tdvp;
553 struct vnode *a_tvp;
554 struct componentname *a_tcnp;
555 } */;
556
557 int
558 nop_rename(struct vop_rename_args *ap)
559 {
560 #if DIAGNOSTIC
561 if ((ap->a_tcnp->cn_flags & HASBUF) == 0 ||
562 (ap->a_fcnp->cn_flags & HASBUF) == 0)
563 panic("nop_rename: no name");
564 #endif
565 VOP_ABORTOP(ap->a_tdvp, ap->a_tcnp);
566 if (ap->a_tdvp == ap->a_tvp)
567 vrele(ap->a_tdvp);
568 else
569 vput(ap->a_tdvp);
570 if (ap->a_tvp)
571 vput(ap->a_tvp);
572 VOP_ABORTOP(ap->a_fdvp, ap->a_fcnp);
573 vrele(ap->a_fdvp);
574 vrele(ap->a_fvp);
575 return (0);
576 }
577
578 int
579 err_rename(struct vop_rename_args *ap)
580 {
581 (void)nop_rename(ap);
582 return (EOPNOTSUPP);
583 }
584
585
586 struct vop_mkdir_args /* {
587 struct vnode *a_dvp;
588 struct vnode **a_vpp;
589 struct componentname *a_cnp;
590 struct vattr *a_vap;
591 } */;
592
593 int
594 nop_mkdir(struct vop_mkdir_args *ap)
595 {
596 #if DIAGNOSTIC
597 if ((ap->a_cnp->cn_flags & HASBUF) == 0)
598 panic("nop_mkdir: no name");
599 #endif
600 VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
601 vput(ap->a_dvp);
602 return (0);
603 }
604
605 int
606 err_mkdir(struct vop_mkdir_args *ap)
607 {
608 (void)nop_mkdir(ap);
609 return (EOPNOTSUPP);
610 }
611
612
613 struct vop_rmdir_args /* {
614 struct vnode *a_dvp;
615 struct vnode *a_vp;
616 struct componentname *a_cnp;
617 } */;
618
619 int
620 nop_rmdir(struct vop_rmdir_args *ap)
621 {
622 vput(ap->a_dvp);
623 vput(ap->a_vp);
624 return (0);
625 }
626
627 int
628 err_rmdir(struct vop_rmdir_args *ap)
629 {
630 (void)nop_rmdir(ap);
631 return (EOPNOTSUPP);
632 }
633
634
635 struct vop_symlink_args /* {
636 struct vnode *a_dvp;
637 struct vnode **a_vpp;
638 struct componentname *a_cnp;
639 struct vattr *a_vap;
640 char *a_target;
641 } */;
642
643 int
644 nop_symlink(struct vop_symlink_args *ap)
645 {
646 #if DIAGNOSTIC
647 if ((ap->a_cnp->cn_flags & HASBUF) == 0)
648 panic("nop_symlink: no name");
649 #endif
650 VOP_ABORTOP(ap->a_dvp, ap->a_cnp);
651 vput(ap->a_dvp);
652 return (0);
653 }
654
655 int
656 err_symlink(struct vop_symlink_args *ap)
657 {
658 (void)nop_symlink(ap);
659 return (EOPNOTSUPP);
660 }
661
662
663 struct vop_readdir_args /* {
664 struct vnode *a_vp;
665 struct uio *a_uio;
666 struct ucred *a_cred;
667 int *a_eofflag;
668 int *a_ncookies;
669 u_long **a_cookies;
670 } */;
671
672 int
673 nop_readdir(struct vop_readdir_args *ap)
674 {
675 return (0);
676 }
677
678 int
679 err_readdir(struct vop_readdir_args *ap)
680 {
681 return (EOPNOTSUPP);
682 }
683
684
685 struct vop_readdirattr_args /* {
686 struct vnode *a_vp;
687 struct attrlist *a_alist;
688 struct uio *a_uio;
689 u_long a_maxcount;
690 u_long a_options;
691 int *a_newstate;
692 int *a_eofflag;
693 u_long *a_actualcount;
694 u_long **a_cookies;
695 struct ucred *a_cred;
696 } */;
697
698 int
699 nop_readdirattr(struct vop_readdirattr_args *ap)
700 {
701 *(ap->a_actualcount) = 0;
702 *(ap->a_eofflag) = 0;
703 return (0);
704 }
705
706 int
707 err_readdirattr(struct vop_readdirattr_args *ap)
708 {
709 (void)nop_readdirattr(ap);
710 return (EOPNOTSUPP);
711 }
712
713
714 struct vop_readlink_args /* {
715 struct vnode *vp;
716 struct uio *uio;
717 struct ucred *cred;
718 } */;
719
720 int
721 nop_readlink(struct vop_readlink_args *ap)
722 {
723 return (0);
724 }
725
726 int
727 err_readlink(struct vop_readlink_args *ap)
728 {
729 return (EOPNOTSUPP);
730 }
731
732
733 struct vop_abortop_args /* {
734 struct vnode *a_dvp;
735 struct componentname *a_cnp;
736 } */;
737
738 int
739 nop_abortop(struct vop_abortop_args *ap)
740 {
741 if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) {
742 char *tmp = ap->a_cnp->cn_pnbuf;
743 ap->a_cnp->cn_pnbuf = NULL;
744 ap->a_cnp->cn_flags &= ~HASBUF;
745 FREE_ZONE(tmp, ap->a_cnp->cn_pnlen, M_NAMEI);
746 }
747
748 return (0);
749 }
750
751 int
752 err_abortop(struct vop_abortop_args *ap)
753 {
754 (void)nop_abortop(ap);
755 return (EOPNOTSUPP);
756 }
757
758
759 struct vop_inactive_args /* {
760 struct vnode *a_vp;
761 struct proc *a_p;
762 } */;
763
764 int
765 nop_inactive(struct vop_inactive_args *ap)
766 {
767 VOP_UNLOCK(ap->a_vp, 0, ap->a_p);
768 return (0);
769 }
770
771 int
772 err_inactive(struct vop_inactive_args *ap)
773 {
774 (void)nop_inactive(ap);
775 return (EOPNOTSUPP);
776 }
777
778
779 struct vop_reclaim_args /* {
780 struct vnode *a_vp;
781 struct proc *a_p;
782 } */;
783
784 int
785 nop_reclaim(struct vop_reclaim_args *ap)
786 {
787 return (0);
788 }
789
790 int
791 err_reclaim(struct vop_reclaim_args *ap)
792 {
793 return (EOPNOTSUPP);
794 }
795
796
797 struct vop_lock_args /* {
798 struct vnode *a_vp;
799 int a_flags;
800 struct proc *a_p;
801 } */;
802
803 int
804 nop_lock(struct vop_lock_args *ap)
805 {
806 return (vop_nolock(ap));
807 }
808
809 int
810 err_lock(struct vop_lock_args *ap)
811 {
812 (void)nop_lock(ap);
813 return (EOPNOTSUPP);
814 }
815
816
817 struct vop_unlock_args /* {
818 struct vnode *a_vp;
819 int a_flags;
820 struct proc *a_p;
821 } */;
822
823 int
824 nop_unlock(struct vop_unlock_args *ap)
825 {
826 return (vop_nounlock(ap));
827 }
828
829 int
830 err_unlock(struct vop_unlock_args *ap)
831 {
832 (void)nop_unlock(ap);
833 return (EOPNOTSUPP);
834 }
835
836
837 struct vop_bmap_args /* {
838 struct vnode *vp;
839 daddr_t bn;
840 struct vnode **vpp;
841 daddr_t *bnp;
842 int *runp;
843 } */;
844
845 int
846 nop_bmap(struct vop_bmap_args *ap)
847 {
848 return (0);
849 }
850
851 int
852 err_bmap(struct vop_bmap_args *ap)
853 {
854 return (EOPNOTSUPP);
855 }
856
857
858 struct vop_strategy_args /* {
859 struct buf *a_bp;
860 } */;
861
862 int
863 nop_strategy(struct vop_strategy_args *ap)
864 {
865 return (0);
866 }
867
868 int
869 err_strategy(struct vop_strategy_args *ap)
870 {
871 return (EOPNOTSUPP);
872 }
873
874
875 struct vop_print_args /* {
876 struct vnode *a_vp;
877 } */;
878
879 int
880 nop_print(struct vop_print_args *ap)
881 {
882 return (0);
883 }
884
885 int
886 err_print(struct vop_print_args *ap)
887 {
888 return (EOPNOTSUPP);
889 }
890
891
892 struct vop_islocked_args /* {
893 struct vnode *a_vp;
894 } */;
895
896 int
897 nop_islocked(struct vop_islocked_args *ap)
898 {
899 return (vop_noislocked(ap));
900 }
901
902 int
903 err_islocked(struct vop_islocked_args *ap)
904 {
905 (void)nop_islocked(ap);
906 return (EOPNOTSUPP);
907 }
908
909
910 struct vop_pathconf_args /* {
911 struct vnode *a_vp;
912 int a_name;
913 register_t *a_retval;
914 } */;
915
916 int
917 nop_pathconf(struct vop_pathconf_args *ap)
918 {
919 return (0);
920 }
921
922 int
923 err_pathconf(struct vop_pathconf_args *ap)
924 {
925 return (EOPNOTSUPP);
926 }
927
928
929 struct vop_advlock_args /* {
930 struct vnode *a_vp;
931 caddr_t a_id;
932 int a_op;
933 struct flock *a_fl;
934 int a_flags;
935 } */;
936
937 int
938 nop_advlock(struct vop_advlock_args *ap)
939 {
940 return (0);
941 }
942
943 int
944 err_advlock(struct vop_advlock_args *ap)
945 {
946 return (EOPNOTSUPP);
947 }
948
949
950 struct vop_blkatoff_args /* {
951 struct vnode *a_vp;
952 off_t a_offset;
953 char **a_res;
954 struct buf **a_bpp;
955 } */;
956
957 int
958 nop_blkatoff(struct vop_blkatoff_args *ap)
959 {
960 *ap->a_bpp = NULL;
961 return (0);
962 }
963
964 int
965 err_blkatoff(struct vop_blkatoff_args *ap)
966 {
967 (void)nop_blkatoff(ap);
968 return (EOPNOTSUPP);
969 }
970
971
972 struct vop_valloc_args /* {
973 struct vnode *a_pvp;
974 int a_mode;
975 struct ucred *a_cred;
976 struct vnode **a_vpp;
977 } */;
978
979 int
980 nop_valloc(struct vop_valloc_args *ap)
981 {
982 *ap->a_vpp = NULL;
983 return (0);
984 }
985
986 int
987 err_valloc(struct vop_valloc_args *ap)
988 {
989 (void)nop_valloc(ap);
990 return (EOPNOTSUPP);
991 }
992
993
994 struct vop_reallocblks_args /* {
995 struct vnode *a_vp;
996 struct cluster_save *a_buflist;
997 } */;
998
999 int
1000 nop_reallocblks(struct vop_reallocblks_args *ap)
1001 {
1002 return (0);
1003 }
1004
1005 int
1006 err_reallocblks(struct vop_reallocblks_args *ap)
1007 {
1008 return (EOPNOTSUPP);
1009 }
1010
1011
1012 struct vop_vfree_args /* {
1013 struct vnode *a_pvp;
1014 ino_t a_ino;
1015 int a_mode;
1016 } */;
1017
1018 int
1019 nop_vfree(struct vop_vfree_args *ap)
1020 {
1021 return (0);
1022 }
1023
1024 int
1025 err_vfree(struct vop_vfree_args *ap)
1026 {
1027 return (EOPNOTSUPP);
1028 }
1029
1030
1031 struct vop_truncate_args /* {
1032 struct vnode *a_vp;
1033 off_t a_length;
1034 int a_flags;
1035 struct ucred *a_cred;
1036 struct proc *a_p;
1037 } */;
1038
1039 int
1040 nop_truncate(struct vop_truncate_args *ap)
1041 {
1042 return (0);
1043 }
1044
1045 int
1046 err_truncate(struct vop_truncate_args *ap)
1047 {
1048 return (EOPNOTSUPP);
1049 }
1050
1051
1052 struct vop_allocate_args /* {
1053 struct vnode *a_vp;
1054 off_t a_length;
1055 u_int32_t a_flags;
1056 off_t *a_bytesallocated;
1057 off_t a_offset;
1058 struct ucred *a_cred;
1059 struct proc *a_p;
1060 } */;
1061
1062 int
1063 nop_allocate(struct vop_allocate_args *ap)
1064 {
1065 *(ap->a_bytesallocated) = 0;
1066 return (0);
1067 }
1068
1069 int
1070 err_allocate(struct vop_allocate_args *ap)
1071 {
1072 (void)nop_allocate(ap);
1073 return (EOPNOTSUPP);
1074 }
1075
1076
1077 struct vop_update_args /* {
1078 struct vnode *a_vp;
1079 struct timeval *a_access;
1080 struct timeval *a_modify;
1081 int a_waitfor;
1082 } */;
1083
1084 int
1085 nop_update(struct vop_update_args *ap)
1086 {
1087 return (0);
1088 }
1089
1090 int
1091 err_update(struct vop_update_args *ap)
1092 {
1093 return (EOPNOTSUPP);
1094 }
1095
1096
1097 struct vop_pgrd_args /* {
1098 struct vnode *a_vp;
1099 struct uio *a_uio;
1100 struct ucred *a_cred;
1101 } */;
1102
1103 int
1104 nop_pgrd(struct vop_pgrd_args *ap)
1105 {
1106 return (0);
1107 }
1108
1109 int
1110 err_pgrd(struct vop_pgrd_args *ap)
1111 {
1112 return (EOPNOTSUPP);
1113 }
1114
1115
1116 struct vop_pgwr_args /* {
1117 struct vnode *a_vp;
1118 struct uio *a_uio;
1119 struct ucred *a_cred;
1120 vm_offset_t a_offset;
1121 } */;
1122
1123 int
1124 nop_pgwr(struct vop_pgwr_args *ap)
1125 {
1126 return (0);
1127 }
1128
1129 int
1130 err_pgwr(struct vop_pgwr_args *ap)
1131 {
1132 return (EOPNOTSUPP);
1133 }
1134
1135
1136 struct vop_bwrite_args /* {
1137 struct buf *a_bp;
1138 } */;
1139
1140 int
1141 nop_bwrite(struct vop_bwrite_args *ap)
1142 {
1143 return (bwrite(ap->a_bp));
1144 }
1145
1146 int
1147 err_bwrite(struct vop_bwrite_args *ap)
1148 {
1149 return (EOPNOTSUPP);
1150 }
1151
1152
1153 struct vop_pagein_args /* {
1154 struct vnode *a_vp,
1155 upl_t a_pl,
1156 vm_offset_t a_pl_offset,
1157 off_t a_foffset,
1158 size_t a_size,
1159 struct ucred *a_cred,
1160 int a_flags
1161 } */;
1162
1163 int
1164 nop_pagein(struct vop_pagein_args *ap)
1165 {
1166 ubc_upl_abort(ap->a_pl, UPL_ABORT_ERROR);
1167 return (0);
1168 }
1169
1170 int
1171 err_pagein(struct vop_pagein_args *ap)
1172 {
1173 ubc_upl_abort(ap->a_pl, UPL_ABORT_ERROR);
1174 return (EOPNOTSUPP);
1175 }
1176
1177
1178 struct vop_pageout_args /* {
1179 struct vnode *a_vp,
1180 upl_t a_pl,
1181 vm_offset_t a_pl_offset,
1182 off_t a_foffset,
1183 size_t a_size,
1184 struct ucred *a_cred,
1185 int a_flags
1186 } */;
1187
1188 int
1189 nop_pageout(struct vop_pageout_args *ap)
1190 {
1191 ubc_upl_abort(ap->a_pl, UPL_ABORT_ERROR);
1192 return (0);
1193 }
1194
1195 int
1196 err_pageout(struct vop_pageout_args *ap)
1197 {
1198 ubc_upl_abort(ap->a_pl, UPL_ABORT_ERROR);
1199 return (EOPNOTSUPP);
1200 }
1201
1202
1203 struct vop_devblocksize_args /* {
1204 struct vnode *a_vp;
1205 register_t *a_retval;
1206 } */;
1207
1208 int
1209 nop_devblocksize(struct vop_devblocksize_args *ap)
1210 {
1211 /* XXX default value because the call sites do not check error */
1212 *ap->a_retval = 512;
1213 return (0);
1214 }
1215
1216 int
1217 err_devblocksize(struct vop_devblocksize_args *ap)
1218 {
1219 (void)nop_devblocksize(ap);
1220 return (EOPNOTSUPP);
1221 }
1222
1223
1224 struct vop_searchfs /* {
1225 struct vnode *a_vp;
1226 void *a_searchparams1;
1227 void *a_searchparams2;
1228 struct attrlist *a_searchattrs;
1229 u_long a_maxmatches;
1230 struct timeval *a_timelimit;
1231 struct attrlist *a_returnattrs;
1232 u_long *a_nummatches;
1233 u_long a_scriptcode;
1234 u_long a_options;
1235 struct uio *a_uio;
1236 struct searchstate *a_searchstate;
1237 } */;
1238
1239 int
1240 nop_searchfs(struct vop_searchfs_args *ap)
1241 {
1242 *(ap->a_nummatches) = 0;
1243 return (0);
1244 }
1245
1246 int
1247 err_searchfs(struct vop_searchfs_args *ap)
1248 {
1249 (void)nop_searchfs(ap);
1250 return (EOPNOTSUPP);
1251 }
1252
1253 struct vop_copyfile_args /*{
1254 struct vnodeop_desc *a_desc;
1255 struct vnode *a_fvp;
1256 struct vnode *a_tdvp;
1257 struct vnode *a_tvp;
1258 struct componentname *a_tcnp;
1259 int a_flags;
1260 }*/;
1261
1262 int
1263 nop_copyfile(struct vop_copyfile_args *ap)
1264 {
1265 if (ap->a_tdvp == ap->a_tvp)
1266 vrele(ap->a_tdvp);
1267 else
1268 vput(ap->a_tdvp);
1269 if (ap->a_tvp)
1270 vput(ap->a_tvp);
1271 vrele(ap->a_fvp);
1272 return (0);
1273 }
1274
1275
1276 int
1277 err_copyfile(struct vop_copyfile_args *ap)
1278 {
1279 (void)nop_copyfile(ap);
1280 return (EOPNOTSUPP);
1281 }
1282
1283
1284 struct vop_blktooff_args /* {
1285 struct vnode *a_vp;
1286 daddr_t a_lblkno;
1287 off_t *a_offset;
1288 } */;
1289
1290 int
1291 nop_blktooff(struct vop_blktooff_args *ap)
1292 {
1293 *ap->a_offset = (off_t)-1; /* failure */
1294 return (0);
1295 }
1296
1297 int
1298 err_blktooff(struct vop_blktooff_args *ap)
1299 {
1300 (void)nop_blktooff(ap);
1301 return (EOPNOTSUPP);
1302 }
1303
1304 struct vop_offtoblk_args /* {
1305 struct vnode *a_vp;
1306 off_t a_offset;
1307 daddr_t *a_lblkno;
1308 } */;
1309
1310 int
1311 nop_offtoblk(struct vop_offtoblk_args *ap)
1312 {
1313 *ap->a_lblkno = (daddr_t)-1; /* failure */
1314 return (0);
1315 }
1316
1317 int
1318 err_offtoblk(struct vop_offtoblk_args *ap)
1319 {
1320 (void)nop_offtoblk(ap);
1321 return (EOPNOTSUPP);
1322 }
1323
1324 struct vop_cmap_args /* {
1325 struct vnode *a_vp;
1326 off_t a_foffset;
1327 size_t a_size;
1328 daddr_t *a_bpn;
1329 size_t *a_run;
1330 void *a_poff;
1331 } */;
1332
1333 int nop_cmap(struct vop_cmap_args *ap)
1334 {
1335 return (0);
1336 }
1337
1338 int err_cmap(struct vop_cmap_args *ap)
1339 {
1340 return (EOPNOTSUPP);
1341 }
1342