]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/kern/vnode_if.src
zfs: merge openzfs/zfs@4647353c8
[FreeBSD/FreeBSD.git] / sys / kern / vnode_if.src
1 #-
2 # Copyright (c) 1992, 1993
3 #       The Regents of the University of California.  All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
7 # are met:
8 # 1. Redistributions of source code must retain the above copyright
9 #    notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 #    notice, this list of conditions and the following disclaimer in the
12 #    documentation and/or other materials provided with the distribution.
13 # 3. Neither the name of the University nor the names of its contributors
14 #    may be used to endorse or promote products derived from this software
15 #    without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 # SUCH DAMAGE.
28 #
29 #       @(#)vnode_if.src        8.12 (Berkeley) 5/14/95
30 #
31
32 #
33 # Above each of the vop descriptors in lines starting with %%
34 # is a specification of the locking protocol used by each vop call.
35 # The first column is the name of the variable, the remaining three
36 # columns are in, out and error respectively.  The "in" column defines
37 # the lock state on input, the "out" column defines the state on successful
38 # return, and the "error" column defines the locking state on error exit.
39 #
40 # The locking value can take the following values:
41 # L: locked; not converted to type of lock.
42 # E: locked with exclusive lock for this process.
43 # U: unlocked.
44 # -: not applicable.  vnode does not yet (or no longer) exists.
45 # =: the same on input and output, may be either L or U.
46 #
47 # The parameter named "vpp" is assumed to be always used with double
48 # indirection (**vpp) and that name is hard-coded in vnode_if.awk !
49 #
50 # Lines starting with %! specify a pre or post-condition function
51 # to call before/after the vop call.
52 #
53 # If other such parameters are introduced, they have to be added to
54 # the AWK script at the head of the definition of "add_debug_code()".
55 #
56
57 vop_islocked {
58         IN struct vnode *vp;
59 };
60
61
62 %% lookup       dvp     L L L
63 %% lookup       vpp     - L -
64
65 # XXX - the lookup locking protocol defies simple description and depends
66 #       on the flags and operation fields in the (cnp) structure.  Note
67 #       especially that *vpp may equal dvp and both may be locked.
68
69 vop_lookup {
70         IN struct vnode *dvp;
71         INOUT struct vnode **vpp;
72         IN struct componentname *cnp;
73 };
74
75
76 %% cachedlookup dvp     L L L
77 %% cachedlookup vpp     - L -
78
79 # This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
80
81 vop_cachedlookup {
82         IN struct vnode *dvp;
83         INOUT struct vnode **vpp;
84         IN struct componentname *cnp;
85 };
86
87
88 %% create       dvp     E E E
89 %% create       vpp     - L -
90 %! create       pre     vop_create_pre
91 %! create       post    vop_create_post
92
93 vop_create {
94         IN struct vnode *dvp;
95         OUT struct vnode **vpp;
96         IN struct componentname *cnp;
97         IN struct vattr *vap;
98 };
99
100
101 %% whiteout     dvp     E E E
102 %! whiteout     pre     vop_whiteout_pre
103 %! whiteout     post    vop_whiteout_post
104
105 vop_whiteout {
106         IN struct vnode *dvp;
107         IN struct componentname *cnp;
108         IN int flags;
109 };
110
111
112 %% mknod        dvp     E E E
113 %% mknod        vpp     - L -
114 %! mknod        pre     vop_mknod_pre
115 %! mknod        post    vop_mknod_post
116
117 vop_mknod {
118         IN struct vnode *dvp;
119         OUT struct vnode **vpp;
120         IN struct componentname *cnp;
121         IN struct vattr *vap;
122 };
123
124
125 %% open         vp      L L L
126 %! open         post    vop_open_post
127
128 vop_open {
129         IN struct vnode *vp;
130         IN int mode;
131         IN struct ucred *cred;
132         IN struct thread *td;
133         IN struct file *fp;
134 };
135
136
137 %% close        vp      L L L
138 %! close        post    vop_close_post
139
140 vop_close {
141         IN struct vnode *vp;
142         IN int fflag;
143         IN struct ucred *cred;
144         IN struct thread *td;
145 };
146
147
148 %% fplookup_vexec       vp      - - -
149 %! fplookup_vexec       debugpre        vop_fplookup_vexec_debugpre
150 %! fplookup_vexec       debugpost       vop_fplookup_vexec_debugpost
151
152 vop_fplookup_vexec {
153         IN struct vnode *vp;
154         IN struct ucred *cred;
155 };
156
157
158 %% fplookup_symlink     vp      - - -
159 %! fplookup_symlink     debugpre        vop_fplookup_symlink_debugpre
160 %! fplookup_symlink     debugpost       vop_fplookup_symlink_debugpost
161
162 vop_fplookup_symlink {
163         IN struct vnode *vp;
164         IN struct cache_fpl *fpl;
165 };
166
167
168 %% access       vp      L L L
169
170 vop_access {
171         IN struct vnode *vp;
172         IN accmode_t accmode;
173         IN struct ucred *cred;
174         IN struct thread *td;
175 };
176
177
178 %% accessx      vp      L L L
179
180 vop_accessx {
181         IN struct vnode *vp;
182         IN accmode_t accmode;
183         IN struct ucred *cred;
184         IN struct thread *td;
185 };
186
187
188 %% stat vp      L L L
189
190 vop_stat {
191         IN struct vnode *vp;
192         OUT struct stat *sb;
193         IN struct ucred *active_cred;
194         IN struct ucred *file_cred;
195 };
196
197
198 %% getattr      vp      L L L
199
200 vop_getattr {
201         IN struct vnode *vp;
202         OUT struct vattr *vap;
203         IN struct ucred *cred;
204 };
205
206
207 %% setattr      vp      E E E
208 %! setattr      pre     vop_setattr_pre
209 %! setattr      post    vop_setattr_post
210
211 vop_setattr {
212         IN struct vnode *vp;
213         IN struct vattr *vap;
214         IN struct ucred *cred;
215 };
216
217
218 %% mmapped      vp      L L L
219
220 vop_mmapped {
221         IN struct vnode *vp;
222 };
223
224
225 %% read         vp      L L L
226 %! read         post    vop_read_post
227
228 vop_read {
229         IN struct vnode *vp;
230         INOUT struct uio *uio;
231         IN int ioflag;
232         IN struct ucred *cred;
233 };
234
235
236 %% read_pgcache vp      - - -
237 %! read_pgcache post    vop_read_pgcache_post
238
239 vop_read_pgcache {
240         IN struct vnode *vp;
241         INOUT struct uio *uio;
242         IN int ioflag;
243         IN struct ucred *cred;
244 };
245
246
247 %% write        vp      L L L
248 %! write        pre     VOP_WRITE_PRE
249 %! write        post    VOP_WRITE_POST
250
251 vop_write {
252         IN struct vnode *vp;
253         INOUT struct uio *uio;
254         IN int ioflag;
255         IN struct ucred *cred;
256 };
257
258
259 %% ioctl        vp      U U U
260
261 vop_ioctl {
262         IN struct vnode *vp;
263         IN u_long command;
264         IN void *data;
265         IN int fflag;
266         IN struct ucred *cred;
267         IN struct thread *td;
268 };
269
270
271 %% poll         vp      U U U
272
273 vop_poll {
274         IN struct vnode *vp;
275         IN int events;
276         IN struct ucred *cred;
277         IN struct thread *td;
278 };
279
280
281 %% kqfilter     vp      U U U
282
283 vop_kqfilter {
284         IN struct vnode *vp;
285         IN struct knote *kn;
286 };
287
288
289 %% revoke       vp      L L L
290
291 vop_revoke {
292         IN struct vnode *vp;
293         IN int flags;
294 };
295
296
297 %% fsync        vp      - - -
298 %! fsync        pre     vop_fsync_debugpre
299 %! fsync        post    vop_fsync_debugpost
300
301 vop_fsync {
302         IN struct vnode *vp;
303         IN int waitfor;
304         IN struct thread *td;
305 };
306
307
308 %% remove       dvp     E E E
309 %% remove       vp      E E E
310 %! remove       pre     vop_remove_pre
311 %! remove       post    vop_remove_post
312
313 vop_remove {
314         IN struct vnode *dvp;
315         IN struct vnode *vp;
316         IN struct componentname *cnp;
317 };
318
319
320 %% link         tdvp    E E E
321 %% link         vp      E E E
322 %! link         pre     vop_link_pre
323 %! link         post    vop_link_post
324
325 vop_link {
326         IN struct vnode *tdvp;
327         IN struct vnode *vp;
328         IN struct componentname *cnp;
329 };
330
331
332 %! rename       pre     vop_rename_pre
333 %! rename       post    vop_rename_post
334
335 vop_rename {
336         IN WILLRELE struct vnode *fdvp;
337         IN WILLRELE struct vnode *fvp;
338         IN struct componentname *fcnp;
339         IN WILLRELE struct vnode *tdvp;
340         IN WILLRELE struct vnode *tvp;
341         IN struct componentname *tcnp;
342 };
343
344
345 %% mkdir        dvp     E E E
346 %% mkdir        vpp     - E -
347 %! mkdir        pre     vop_mkdir_pre
348 %! mkdir        post    vop_mkdir_post
349 %! mkdir        debugpost vop_mkdir_debugpost
350
351 vop_mkdir {
352         IN struct vnode *dvp;
353         OUT struct vnode **vpp;
354         IN struct componentname *cnp;
355         IN struct vattr *vap;
356 };
357
358
359 %% rmdir        dvp     E E E
360 %% rmdir        vp      E E E
361 %! rmdir        pre     vop_rmdir_pre
362 %! rmdir        post    vop_rmdir_post
363
364 vop_rmdir {
365         IN struct vnode *dvp;
366         IN struct vnode *vp;
367         IN struct componentname *cnp;
368 };
369
370
371 %% symlink      dvp     E E E
372 %% symlink      vpp     - E -
373 %! symlink      pre     vop_symlink_pre
374 %! symlink      post    vop_symlink_post
375
376 vop_symlink {
377         IN struct vnode *dvp;
378         OUT struct vnode **vpp;
379         IN struct componentname *cnp;
380         IN struct vattr *vap;
381         IN const char *target;
382 };
383
384
385 %% readdir      vp      L L L
386 %! readdir      post    vop_readdir_post
387
388 vop_readdir {
389         IN struct vnode *vp;
390         INOUT struct uio *uio;
391         IN struct ucred *cred;
392         INOUT int *eofflag;
393         OUT int *ncookies;
394         INOUT uint64_t **cookies;
395 };
396
397
398 %% readlink     vp      L L L
399
400 vop_readlink {
401         IN struct vnode *vp;
402         INOUT struct uio *uio;
403         IN struct ucred *cred;
404 };
405
406
407 %% inactive     vp      E E E
408
409 vop_inactive {
410         IN struct vnode *vp;
411 };
412
413 %! need_inactive        debugpre        vop_need_inactive_debugpre
414 %! need_inactive        debugpost       vop_need_inactive_debugpost
415
416 vop_need_inactive {
417         IN struct vnode *vp;
418 };
419
420 %% reclaim      vp      E E E
421 %! reclaim      post    vop_reclaim_post
422
423 vop_reclaim {
424         IN struct vnode *vp;
425 };
426
427
428 %! lock1        debugpre        vop_lock_debugpre
429 %! lock1        debugpost       vop_lock_debugpost
430
431 vop_lock1 {
432         IN struct vnode *vp;
433         IN int flags;
434         IN const char *file;
435         IN int line;
436 };
437
438
439 %! unlock       debugpre        vop_unlock_debugpre
440
441 vop_unlock {
442         IN struct vnode *vp;
443 };
444
445
446 %% bmap         vp      L L L
447
448 vop_bmap {
449         IN struct vnode *vp;
450         IN daddr_t bn;
451         OUT struct bufobj **bop;
452         IN daddr_t *bnp;
453         OUT int *runp;
454         OUT int *runb;
455 };
456
457
458 %% strategy     vp      L L L
459 %! strategy     debugpre        vop_strategy_debugpre
460
461 vop_strategy {
462         IN struct vnode *vp;
463         IN struct buf *bp;
464 };
465
466
467 %% getwritemount vp     = = =
468
469 vop_getwritemount {
470         IN struct vnode *vp;
471         OUT struct mount **mpp;
472 };
473
474
475 %% print        vp      - - -
476
477 vop_print {
478         IN struct vnode *vp;
479 };
480
481
482 %% pathconf     vp      L L L
483
484 vop_pathconf {
485         IN struct vnode *vp;
486         IN int name;
487         OUT long *retval;
488 };
489
490
491 %% advlock      vp      U U U
492
493 vop_advlock {
494         IN struct vnode *vp;
495         IN void *id;
496         IN int op;
497         IN struct flock *fl;
498         IN int flags;
499 };
500
501
502 %% advlockasync vp      U U U
503
504 vop_advlockasync {
505         IN struct vnode *vp;
506         IN void *id;
507         IN int op;
508         IN struct flock *fl;
509         IN int flags;
510         IN struct task *task;   
511         INOUT void **cookiep;
512 };
513
514
515 %% advlockpurge vp      E E E
516
517 vop_advlockpurge {
518         IN struct vnode *vp;
519 };
520
521
522 %% reallocblks  vp      E E E
523
524 vop_reallocblks {
525         IN struct vnode *vp;
526         IN struct cluster_save *buflist;
527 };
528
529
530 %% getpages     vp      L L L
531
532 vop_getpages {
533         IN struct vnode *vp;
534         IN vm_page_t *m;
535         IN int count;
536         IN int *rbehind;
537         IN int *rahead;
538 };
539
540
541 %% getpages_async       vp      L L L
542
543 vop_getpages_async {
544         IN struct vnode *vp;
545         IN vm_page_t *m;
546         IN int count;
547         IN int *rbehind;
548         IN int *rahead;
549         IN vop_getpages_iodone_t *iodone;
550         IN void *arg;
551 };
552
553
554 %% putpages     vp      L L L
555
556 vop_putpages {
557         IN struct vnode *vp;
558         IN vm_page_t *m;
559         IN int count;
560         IN int sync;
561         IN int *rtvals;
562 };
563
564
565 %% getacl       vp      L L L
566
567 vop_getacl {
568         IN struct vnode *vp;
569         IN acl_type_t type;
570         OUT struct acl *aclp;
571         IN struct ucred *cred;
572         IN struct thread *td;
573 };
574
575
576 %% setacl       vp      E E E
577 %! setacl       pre     vop_setacl_pre
578 %! setacl       post    vop_setacl_post
579
580 vop_setacl {
581         IN struct vnode *vp;
582         IN acl_type_t type;
583         IN struct acl *aclp;
584         IN struct ucred *cred;
585         IN struct thread *td;
586 };
587
588
589 %% aclcheck     vp      = = =
590
591 vop_aclcheck {
592         IN struct vnode *vp;
593         IN acl_type_t type;
594         IN struct acl *aclp;
595         IN struct ucred *cred;
596         IN struct thread *td;
597 };
598
599
600 %% closeextattr vp      L L L
601
602 vop_closeextattr {
603         IN struct vnode *vp;
604         IN int commit;
605         IN struct ucred *cred;
606         IN struct thread *td;
607 };
608
609
610 %% getextattr   vp      L L L
611
612 vop_getextattr {
613         IN struct vnode *vp;
614         IN int attrnamespace;
615         IN const char *name;
616         INOUT struct uio *uio;
617         OUT size_t *size;
618         IN struct ucred *cred;
619         IN struct thread *td;
620 };
621
622
623 %% listextattr  vp      L L L
624
625 vop_listextattr {
626         IN struct vnode *vp;
627         IN int attrnamespace;
628         INOUT struct uio *uio;
629         OUT size_t *size;
630         IN struct ucred *cred;
631         IN struct thread *td;
632 };
633
634
635 %% openextattr  vp      L L L
636
637 vop_openextattr {
638         IN struct vnode *vp;
639         IN struct ucred *cred;
640         IN struct thread *td;
641 };
642
643
644 %% deleteextattr        vp      E E E
645 %! deleteextattr        pre     vop_deleteextattr_pre
646 %! deleteextattr        post    vop_deleteextattr_post
647
648 vop_deleteextattr {
649         IN struct vnode *vp;
650         IN int attrnamespace;
651         IN const char *name;
652         IN struct ucred *cred;
653         IN struct thread *td;
654 };
655
656
657 %% setextattr   vp      E E E
658 %! setextattr   pre     vop_setextattr_pre
659 %! setextattr   post    vop_setextattr_post
660
661 vop_setextattr {
662         IN struct vnode *vp;
663         IN int attrnamespace;
664         IN const char *name;
665         INOUT struct uio *uio;
666         IN struct ucred *cred;
667         IN struct thread *td;
668 };
669
670
671 %% setlabel     vp      E E E
672
673 vop_setlabel {
674         IN struct vnode *vp;
675         IN struct label *label;
676         IN struct ucred *cred;
677         IN struct thread *td;
678 };
679
680
681 %% vptofh       vp      = = =
682
683 vop_vptofh {
684         IN struct vnode *vp;
685         IN struct fid *fhp;
686 };
687
688
689 %% vptocnp              vp      L L L
690 %% vptocnp              vpp     - U -
691
692 vop_vptocnp {
693         IN struct vnode *vp;
694         OUT struct vnode **vpp;
695         INOUT char *buf;
696         INOUT size_t *buflen;
697 };
698
699
700 %% allocate     vp      E E E
701
702 vop_allocate {
703         IN struct vnode *vp;
704         INOUT off_t *offset;
705         INOUT off_t *len;
706         IN int ioflag;
707         IN struct ucred *cred;
708 };
709
710
711 %% advise       vp      U U U
712
713 vop_advise {
714         IN struct vnode *vp;
715         IN off_t start;
716         IN off_t end;
717         IN int advice;
718 };
719
720
721 %% unp_bind     vp      E E E
722
723 vop_unp_bind {
724         IN struct vnode *vp;
725         IN struct unpcb *unpcb;
726 };
727
728
729 %% unp_connect  vp      L L L
730
731 vop_unp_connect {
732         IN struct vnode *vp;
733         OUT struct unpcb **unpcb;
734 };
735
736
737 %% unp_detach   vp      = = =
738
739 vop_unp_detach {
740         IN struct vnode *vp;
741 };
742
743
744 %% is_text      vp      L L L
745
746 vop_is_text {
747         IN struct vnode *vp;
748 };
749
750
751 %% set_text     vp      = = =
752
753 vop_set_text {
754         IN struct vnode *vp;
755 };
756
757
758 %% vop_unset_text       vp      L L L
759
760 vop_unset_text {
761         IN struct vnode *vp;
762 };
763
764
765 %% add_writecount       vp      L L L
766
767 vop_add_writecount {
768         IN struct vnode *vp;
769         IN int inc;
770 };
771
772
773 %% fdatasync    vp      - - -
774 %! fdatasync    pre     vop_fdatasync_debugpre
775 %! fdatasync    post    vop_fdatasync_debugpost
776
777 vop_fdatasync {
778         IN struct vnode *vp;
779         IN struct thread *td;
780 };
781
782
783 %% copy_file_range      invp    U U U
784 %% copy_file_range      outvp   U U U
785
786 vop_copy_file_range {
787         IN struct vnode *invp;
788         INOUT off_t *inoffp;
789         IN struct vnode *outvp;
790         INOUT off_t *outoffp;
791         INOUT size_t *lenp;
792         IN unsigned int flags;
793         IN struct ucred *incred;
794         IN struct ucred *outcred;
795         IN struct thread *fsizetd;
796 };
797
798
799 %% vput_pair    dvp     E - -
800
801 vop_vput_pair {
802         IN struct vnode *dvp;
803         INOUT struct vnode **vpp;
804         IN bool unlock_vp;
805 };
806
807
808 %% deallocate   vp      L L L
809
810 vop_deallocate {
811         IN struct vnode *vp;
812         INOUT off_t *offset;
813         INOUT off_t *len;
814         IN int flags;
815         IN int ioflag;
816         IN struct ucred *cred;
817 };
818
819
820 # The VOPs below are spares at the end of the table to allow new VOPs to be
821 # added in stable branches without breaking the KBI.  New VOPs in HEAD should
822 # be added above these spares.  When merging a new VOP to a stable branch,
823 # the new VOP should replace one of the spares.
824
825 vop_spare1 {
826         IN struct vnode *vp;
827 };
828
829 vop_spare2 {
830         IN struct vnode *vp;
831 };
832
833 vop_spare3 {
834         IN struct vnode *vp;
835 };
836
837 vop_spare4 {
838         IN struct vnode *vp;
839 };
840
841 vop_spare5 {
842         IN struct vnode *vp;
843 };