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