]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/kern/vnode_if.src
vfs: retire kern.minvnodes
[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         IN struct thread *td;
196 };
197
198
199 %% getattr      vp      L L L
200
201 vop_getattr {
202         IN struct vnode *vp;
203         OUT struct vattr *vap;
204         IN struct ucred *cred;
205 };
206
207
208 %% setattr      vp      E E E
209 %! setattr      pre     vop_setattr_pre
210 %! setattr      post    vop_setattr_post
211
212 vop_setattr {
213         IN struct vnode *vp;
214         IN struct vattr *vap;
215         IN struct ucred *cred;
216 };
217
218
219 %% mmapped      vp      L L L
220
221 vop_mmapped {
222         IN struct vnode *vp;
223 };
224
225
226 %% read         vp      L L L
227 %! read         post    vop_read_post
228
229 vop_read {
230         IN struct vnode *vp;
231         INOUT struct uio *uio;
232         IN int ioflag;
233         IN struct ucred *cred;
234 };
235
236
237 %% read_pgcache vp      - - -
238 %! read_pgcache post    vop_read_pgcache_post
239
240 vop_read_pgcache {
241         IN struct vnode *vp;
242         INOUT struct uio *uio;
243         IN int ioflag;
244         IN struct ucred *cred;
245 };
246
247
248 %% write        vp      L L L
249 %! write        pre     VOP_WRITE_PRE
250 %! write        post    VOP_WRITE_POST
251
252 vop_write {
253         IN struct vnode *vp;
254         INOUT struct uio *uio;
255         IN int ioflag;
256         IN struct ucred *cred;
257 };
258
259
260 %% ioctl        vp      U U U
261
262 vop_ioctl {
263         IN struct vnode *vp;
264         IN u_long command;
265         IN void *data;
266         IN int fflag;
267         IN struct ucred *cred;
268         IN struct thread *td;
269 };
270
271
272 %% poll         vp      U U U
273
274 vop_poll {
275         IN struct vnode *vp;
276         IN int events;
277         IN struct ucred *cred;
278         IN struct thread *td;
279 };
280
281
282 %% kqfilter     vp      U U U
283
284 vop_kqfilter {
285         IN struct vnode *vp;
286         IN struct knote *kn;
287 };
288
289
290 %% revoke       vp      L L L
291
292 vop_revoke {
293         IN struct vnode *vp;
294         IN int flags;
295 };
296
297
298 %% fsync        vp      - - -
299 %! fsync        pre     vop_fsync_debugpre
300 %! fsync        post    vop_fsync_debugpost
301
302 vop_fsync {
303         IN struct vnode *vp;
304         IN int waitfor;
305         IN struct thread *td;
306 };
307
308
309 %% remove       dvp     E E E
310 %% remove       vp      E E E
311 %! remove       pre     vop_remove_pre
312 %! remove       post    vop_remove_post
313
314 vop_remove {
315         IN struct vnode *dvp;
316         IN struct vnode *vp;
317         IN struct componentname *cnp;
318 };
319
320
321 %% link         tdvp    E E E
322 %% link         vp      E E E
323 %! link         pre     vop_link_pre
324 %! link         post    vop_link_post
325
326 vop_link {
327         IN struct vnode *tdvp;
328         IN struct vnode *vp;
329         IN struct componentname *cnp;
330 };
331
332
333 %! rename       pre     vop_rename_pre
334 %! rename       post    vop_rename_post
335
336 vop_rename {
337         IN WILLRELE struct vnode *fdvp;
338         IN WILLRELE struct vnode *fvp;
339         IN struct componentname *fcnp;
340         IN WILLRELE struct vnode *tdvp;
341         IN WILLRELE struct vnode *tvp;
342         IN struct componentname *tcnp;
343 };
344
345
346 %% mkdir        dvp     E E E
347 %% mkdir        vpp     - E -
348 %! mkdir        pre     vop_mkdir_pre
349 %! mkdir        post    vop_mkdir_post
350 %! mkdir        debugpost vop_mkdir_debugpost
351
352 vop_mkdir {
353         IN struct vnode *dvp;
354         OUT struct vnode **vpp;
355         IN struct componentname *cnp;
356         IN struct vattr *vap;
357 };
358
359
360 %% rmdir        dvp     E E E
361 %% rmdir        vp      E E E
362 %! rmdir        pre     vop_rmdir_pre
363 %! rmdir        post    vop_rmdir_post
364
365 vop_rmdir {
366         IN struct vnode *dvp;
367         IN struct vnode *vp;
368         IN struct componentname *cnp;
369 };
370
371
372 %% symlink      dvp     E E E
373 %% symlink      vpp     - E -
374 %! symlink      pre     vop_symlink_pre
375 %! symlink      post    vop_symlink_post
376
377 vop_symlink {
378         IN struct vnode *dvp;
379         OUT struct vnode **vpp;
380         IN struct componentname *cnp;
381         IN struct vattr *vap;
382         IN const char *target;
383 };
384
385
386 %% readdir      vp      L L L
387 %! readdir      post    vop_readdir_post
388
389 vop_readdir {
390         IN struct vnode *vp;
391         INOUT struct uio *uio;
392         IN struct ucred *cred;
393         INOUT int *eofflag;
394         OUT int *ncookies;
395         INOUT u_long **cookies;
396 };
397
398
399 %% readlink     vp      L L L
400
401 vop_readlink {
402         IN struct vnode *vp;
403         INOUT struct uio *uio;
404         IN struct ucred *cred;
405 };
406
407
408 %% inactive     vp      E E E
409
410 vop_inactive {
411         IN struct vnode *vp;
412 };
413
414 %! need_inactive        debugpre        vop_need_inactive_debugpre
415 %! need_inactive        debugpost       vop_need_inactive_debugpost
416
417 vop_need_inactive {
418         IN struct vnode *vp;
419 };
420
421 %% reclaim      vp      E E E
422 %! reclaim      post    vop_reclaim_post
423
424 vop_reclaim {
425         IN struct vnode *vp;
426 };
427
428
429 %! lock1        debugpre        vop_lock_debugpre
430 %! lock1        debugpost       vop_lock_debugpost
431
432 vop_lock1 {
433         IN struct vnode *vp;
434         IN int flags;
435         IN const char *file;
436         IN int line;
437 };
438
439
440 %! unlock       debugpre        vop_unlock_debugpre
441
442 vop_unlock {
443         IN struct vnode *vp;
444 };
445
446
447 %% bmap         vp      L L L
448
449 vop_bmap {
450         IN struct vnode *vp;
451         IN daddr_t bn;
452         OUT struct bufobj **bop;
453         IN daddr_t *bnp;
454         OUT int *runp;
455         OUT int *runb;
456 };
457
458
459 %% strategy     vp      L L L
460 %! strategy     debugpre        vop_strategy_debugpre
461
462 vop_strategy {
463         IN struct vnode *vp;
464         IN struct buf *bp;
465 };
466
467
468 %% getwritemount vp     = = =
469
470 vop_getwritemount {
471         IN struct vnode *vp;
472         OUT struct mount **mpp;
473 };
474
475
476 %% print        vp      - - -
477
478 vop_print {
479         IN struct vnode *vp;
480 };
481
482
483 %% pathconf     vp      L L L
484
485 vop_pathconf {
486         IN struct vnode *vp;
487         IN int name;
488         OUT long *retval;
489 };
490
491
492 %% advlock      vp      U U U
493
494 vop_advlock {
495         IN struct vnode *vp;
496         IN void *id;
497         IN int op;
498         IN struct flock *fl;
499         IN int flags;
500 };
501
502
503 %% advlockasync vp      U U U
504
505 vop_advlockasync {
506         IN struct vnode *vp;
507         IN void *id;
508         IN int op;
509         IN struct flock *fl;
510         IN int flags;
511         IN struct task *task;   
512         INOUT void **cookiep;
513 };
514
515
516 %% advlockpurge vp      E E E
517
518 vop_advlockpurge {
519         IN struct vnode *vp;
520 };
521
522
523 %% reallocblks  vp      E E E
524
525 vop_reallocblks {
526         IN struct vnode *vp;
527         IN struct cluster_save *buflist;
528 };
529
530
531 %% getpages     vp      L L L
532
533 vop_getpages {
534         IN struct vnode *vp;
535         IN vm_page_t *m;
536         IN int count;
537         IN int *rbehind;
538         IN int *rahead;
539 };
540
541
542 %% getpages_async       vp      L L L
543
544 vop_getpages_async {
545         IN struct vnode *vp;
546         IN vm_page_t *m;
547         IN int count;
548         IN int *rbehind;
549         IN int *rahead;
550         IN vop_getpages_iodone_t *iodone;
551         IN void *arg;
552 };
553
554
555 %% putpages     vp      L L L
556
557 vop_putpages {
558         IN struct vnode *vp;
559         IN vm_page_t *m;
560         IN int count;
561         IN int sync;
562         IN int *rtvals;
563 };
564
565
566 %% getacl       vp      L L L
567
568 vop_getacl {
569         IN struct vnode *vp;
570         IN acl_type_t type;
571         OUT struct acl *aclp;
572         IN struct ucred *cred;
573         IN struct thread *td;
574 };
575
576
577 %% setacl       vp      E E E
578 %! setacl       pre     vop_setacl_pre
579 %! setacl       post    vop_setacl_post
580
581 vop_setacl {
582         IN struct vnode *vp;
583         IN acl_type_t type;
584         IN struct acl *aclp;
585         IN struct ucred *cred;
586         IN struct thread *td;
587 };
588
589
590 %% aclcheck     vp      = = =
591
592 vop_aclcheck {
593         IN struct vnode *vp;
594         IN acl_type_t type;
595         IN struct acl *aclp;
596         IN struct ucred *cred;
597         IN struct thread *td;
598 };
599
600
601 %% closeextattr vp      L L L
602
603 vop_closeextattr {
604         IN struct vnode *vp;
605         IN int commit;
606         IN struct ucred *cred;
607         IN struct thread *td;
608 };
609
610
611 %% getextattr   vp      L L L
612
613 vop_getextattr {
614         IN struct vnode *vp;
615         IN int attrnamespace;
616         IN const char *name;
617         INOUT struct uio *uio;
618         OUT size_t *size;
619         IN struct ucred *cred;
620         IN struct thread *td;
621 };
622
623
624 %% listextattr  vp      L L L
625
626 vop_listextattr {
627         IN struct vnode *vp;
628         IN int attrnamespace;
629         INOUT struct uio *uio;
630         OUT size_t *size;
631         IN struct ucred *cred;
632         IN struct thread *td;
633 };
634
635
636 %% openextattr  vp      L L L
637
638 vop_openextattr {
639         IN struct vnode *vp;
640         IN struct ucred *cred;
641         IN struct thread *td;
642 };
643
644
645 %% deleteextattr        vp      E E E
646 %! deleteextattr        pre     vop_deleteextattr_pre
647 %! deleteextattr        post    vop_deleteextattr_post
648
649 vop_deleteextattr {
650         IN struct vnode *vp;
651         IN int attrnamespace;
652         IN const char *name;
653         IN struct ucred *cred;
654         IN struct thread *td;
655 };
656
657
658 %% setextattr   vp      E E E
659 %! setextattr   pre     vop_setextattr_pre
660 %! setextattr   post    vop_setextattr_post
661
662 vop_setextattr {
663         IN struct vnode *vp;
664         IN int attrnamespace;
665         IN const char *name;
666         INOUT struct uio *uio;
667         IN struct ucred *cred;
668         IN struct thread *td;
669 };
670
671
672 %% setlabel     vp      E E E
673
674 vop_setlabel {
675         IN struct vnode *vp;
676         IN struct label *label;
677         IN struct ucred *cred;
678         IN struct thread *td;
679 };
680
681
682 %% vptofh       vp      = = =
683
684 vop_vptofh {
685         IN struct vnode *vp;
686         IN struct fid *fhp;
687 };
688
689
690 %% vptocnp              vp      L L L
691 %% vptocnp              vpp     - U -
692
693 vop_vptocnp {
694         IN struct vnode *vp;
695         OUT struct vnode **vpp;
696         INOUT char *buf;
697         INOUT size_t *buflen;
698 };
699
700
701 %% allocate     vp      E E E
702
703 vop_allocate {
704         IN struct vnode *vp;
705         INOUT off_t *offset;
706         INOUT off_t *len;
707         IN int ioflag;
708         IN struct ucred *cred;
709 };
710
711
712 %% advise       vp      U U U
713
714 vop_advise {
715         IN struct vnode *vp;
716         IN off_t start;
717         IN off_t end;
718         IN int advice;
719 };
720
721
722 %% unp_bind     vp      E E E
723
724 vop_unp_bind {
725         IN struct vnode *vp;
726         IN struct unpcb *unpcb;
727 };
728
729
730 %% unp_connect  vp      L L L
731
732 vop_unp_connect {
733         IN struct vnode *vp;
734         OUT struct unpcb **unpcb;
735 };
736
737
738 %% unp_detach   vp      = = =
739
740 vop_unp_detach {
741         IN struct vnode *vp;
742 };
743
744
745 %% is_text      vp      L L L
746
747 vop_is_text {
748         IN struct vnode *vp;
749 };
750
751
752 %% set_text     vp      = = =
753
754 vop_set_text {
755         IN struct vnode *vp;
756 };
757
758
759 %% vop_unset_text       vp      L L L
760
761 vop_unset_text {
762         IN struct vnode *vp;
763 };
764
765
766 %% add_writecount       vp      L L L
767
768 vop_add_writecount {
769         IN struct vnode *vp;
770         IN int inc;
771 };
772
773
774 %% fdatasync    vp      - - -
775 %! fdatasync    pre     vop_fdatasync_debugpre
776 %! fdatasync    post    vop_fdatasync_debugpost
777
778 vop_fdatasync {
779         IN struct vnode *vp;
780         IN struct thread *td;
781 };
782
783
784 %% copy_file_range      invp    U U U
785 %% copy_file_range      outvp   U U U
786
787 vop_copy_file_range {
788         IN struct vnode *invp;
789         INOUT off_t *inoffp;
790         IN struct vnode *outvp;
791         INOUT off_t *outoffp;
792         INOUT size_t *lenp;
793         IN unsigned int flags;
794         IN struct ucred *incred;
795         IN struct ucred *outcred;
796         IN struct thread *fsizetd;
797 };
798
799
800 %% vput_pair    dvp     E - -
801
802 vop_vput_pair {
803         IN struct vnode *dvp;
804         INOUT struct vnode **vpp;
805         IN bool unlock_vp;
806 };
807
808
809 # The VOPs below are spares at the end of the table to allow new VOPs to be
810 # added in stable branches without breaking the KBI.  New VOPs in HEAD should
811 # be added above these spares.  When merging a new VOP to a stable branch,
812 # the new VOP should replace one of the spares.
813
814 vop_spare1 {
815         IN struct vnode *vp;
816 };
817
818 vop_spare2 {
819         IN struct vnode *vp;
820 };
821
822 vop_spare3 {
823         IN struct vnode *vp;
824 };
825
826 vop_spare4 {
827         IN struct vnode *vp;
828 };
829
830 vop_spare5 {
831         IN struct vnode *vp;
832 };