2 * Copyright (c) 2004 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * $DragonFly: src/sys/sys/vfsops.h,v 1.22 2006/05/06 02:43:13 dillon Exp $
38 * The vop_ops structure vectors all access to a filesystem. It contains a
39 * fixed set of vectors which are 'compiled' by the vnodeopv_entry_desc
40 * array that is typically declared in "vfs/blah/blah_vnops.c".
42 * In DragonFly the ultimate goal is to thread the VFS, which means that
43 * the dispatch functions will eventually be called from the context of
44 * a management thread rather then directly called by a process. This
45 * requires us to divorce direct process dependancies (in particular ioctl
46 * and UIO's). In addition, it is our intention to implement kernel
47 * level cache management and coherency in the vop_*() interfacing
50 * The number of management threads will depend on the VFS. The idea is
51 * to give a high performance VFS such as UFS at least one thread per cpu,
52 * and a low performance VFS such as CD9660 perhaps just one thread period.
53 * Blocking issues within the management thread are up to the VFS itself,
54 * but DragonFly will introduce a layer above the VFS to handle cacheable
55 * requests without having to enter the VFS (e.g. by making attribute
56 * and VM object information a permanent fixture of the vnode structure
57 * and accessing them directly).
59 * THE VOPOPS VECTORS SHOULD NEVER BE CALLED DIRECTLY! Instead always use
60 * the kernel helper procedures vop_*() to call a vopop. The kernel
61 * helper procedure will be responsible for handling the DragonFly messaging
62 * conversion when it occurs.
65 #ifndef _SYS_VFSOPS_H_
66 #define _SYS_VFSOPS_H_
85 struct vop_generic_args {
86 struct vnodeop_desc *a_desc; /* command descriptor for the call */
87 struct vop_ops *a_ops; /* operations vector for the call */
91 struct vop_islocked_args {
92 struct vop_generic_args a_head;
97 struct vop_old_lookup_args {
98 struct vop_generic_args a_head;
100 struct vnode **a_vpp;
101 struct componentname *a_cnp;
104 struct vop_old_create_args {
105 struct vop_generic_args a_head;
107 struct vnode **a_vpp;
108 struct componentname *a_cnp;
112 struct vop_old_whiteout_args {
113 struct vop_generic_args a_head;
115 struct componentname *a_cnp;
119 struct vop_old_mknod_args {
120 struct vop_generic_args a_head;
122 struct vnode **a_vpp;
123 struct componentname *a_cnp;
127 struct vop_open_args {
128 struct vop_generic_args a_head;
131 struct ucred *a_cred;
132 struct file *a_fp; /* optional fp for fileops override */
135 struct vop_close_args {
136 struct vop_generic_args a_head;
141 struct vop_access_args {
142 struct vop_generic_args a_head;
145 struct ucred *a_cred;
148 struct vop_getattr_args {
149 struct vop_generic_args a_head;
154 struct vop_setattr_args {
155 struct vop_generic_args a_head;
158 struct ucred *a_cred;
161 struct vop_read_args {
162 struct vop_generic_args a_head;
166 struct ucred *a_cred;
169 struct vop_write_args {
170 struct vop_generic_args a_head;
174 struct ucred *a_cred;
177 struct vop_ioctl_args {
178 struct vop_generic_args a_head;
183 struct ucred *a_cred;
186 struct vop_poll_args {
187 struct vop_generic_args a_head;
190 struct ucred *a_cred;
193 struct vop_kqfilter_args {
194 struct vop_generic_args a_head;
199 struct vop_revoke_args {
200 struct vop_generic_args a_head;
205 struct vop_mmap_args {
206 struct vop_generic_args a_head;
209 struct ucred *a_cred;
212 struct vop_fsync_args {
213 struct vop_generic_args a_head;
218 struct vop_old_remove_args {
219 struct vop_generic_args a_head;
222 struct componentname *a_cnp;
225 struct vop_old_link_args {
226 struct vop_generic_args a_head;
227 struct vnode *a_tdvp;
229 struct componentname *a_cnp;
232 struct vop_old_rename_args {
233 struct vop_generic_args a_head;
234 struct vnode *a_fdvp;
236 struct componentname *a_fcnp;
237 struct vnode *a_tdvp;
239 struct componentname *a_tcnp;
242 struct vop_old_mkdir_args {
243 struct vop_generic_args a_head;
245 struct vnode **a_vpp;
246 struct componentname *a_cnp;
250 struct vop_old_rmdir_args {
251 struct vop_generic_args a_head;
254 struct componentname *a_cnp;
257 struct vop_old_symlink_args {
258 struct vop_generic_args a_head;
260 struct vnode **a_vpp;
261 struct componentname *a_cnp;
266 struct vop_readdir_args {
267 struct vop_generic_args a_head;
270 struct ucred *a_cred;
276 struct vop_readlink_args {
277 struct vop_generic_args a_head;
280 struct ucred *a_cred;
283 struct vop_inactive_args {
284 struct vop_generic_args a_head;
288 struct vop_reclaim_args {
289 struct vop_generic_args a_head;
293 struct vop_lock_args {
294 struct vop_generic_args a_head;
299 struct vop_unlock_args {
300 struct vop_generic_args a_head;
305 struct vop_bmap_args {
306 struct vop_generic_args a_head;
309 struct vnode **a_vpp;
315 struct vop_strategy_args {
316 struct vop_generic_args a_head;
321 struct vop_print_args {
322 struct vop_generic_args a_head;
326 struct vop_pathconf_args {
327 struct vop_generic_args a_head;
330 register_t *a_retval;
333 struct vop_advlock_args {
334 struct vop_generic_args a_head;
342 struct vop_balloc_args {
343 struct vop_generic_args a_head;
347 struct ucred *a_cred;
352 struct vop_reallocblks_args {
353 struct vop_generic_args a_head;
355 struct cluster_save *a_buflist;
358 struct vop_getpages_args {
359 struct vop_generic_args a_head;
361 struct vm_page **a_m;
364 vm_ooffset_t a_offset;
367 struct vop_putpages_args {
368 struct vop_generic_args a_head;
370 struct vm_page **a_m;
374 vm_ooffset_t a_offset;
377 struct vop_freeblks_args {
378 struct vop_generic_args a_head;
384 struct vop_getacl_args {
385 struct vop_generic_args a_head;
389 struct ucred *a_cred;
392 struct vop_setacl_args {
393 struct vop_generic_args a_head;
397 struct ucred *a_cred;
400 struct vop_aclcheck_args {
401 struct vop_generic_args a_head;
405 struct ucred *a_cred;
408 struct vop_getextattr_args {
409 struct vop_generic_args a_head;
413 struct ucred *a_cred;
416 struct vop_setextattr_args {
417 struct vop_generic_args a_head;
421 struct ucred *a_cred;
424 struct vop_mountctl_args {
425 struct vop_generic_args a_head;
438 struct vop_nresolve_args {
439 struct vop_generic_args a_head;
440 struct namecache *a_ncp;
441 struct ucred *a_cred;
444 struct vop_nlookupdotdot_args {
445 struct vop_generic_args a_head;
447 struct vnode **a_vpp;
448 struct ucred *a_cred;
451 struct vop_ncreate_args {
452 struct vop_generic_args a_head;
453 struct namecache *a_ncp; /* locked namespace */
454 struct vnode **a_vpp; /* returned refd & locked */
455 struct ucred *a_cred;
459 struct vop_nmkdir_args {
460 struct vop_generic_args a_head;
461 struct namecache *a_ncp; /* locked namespace */
462 struct vnode **a_vpp; /* returned refd & locked */
463 struct ucred *a_cred;
467 struct vop_nmknod_args {
468 struct vop_generic_args a_head;
469 struct namecache *a_ncp;
470 struct vnode **a_vpp;
471 struct ucred *a_cred;
475 struct vop_nlink_args {
476 struct vop_generic_args a_head;
477 struct namecache *a_ncp;
479 struct ucred *a_cred;
482 struct vop_nsymlink_args {
483 struct vop_generic_args a_head;
484 struct namecache *a_ncp;
485 struct vnode **a_vpp;
486 struct ucred *a_cred;
491 struct vop_nwhiteout_args {
492 struct vop_generic_args a_head;
493 struct namecache *a_ncp;
494 struct ucred *a_cred;
498 struct vop_nremove_args {
499 struct vop_generic_args a_head;
500 struct namecache *a_ncp; /* locked namespace */
501 struct ucred *a_cred;
504 struct vop_nrmdir_args {
505 struct vop_generic_args a_head;
506 struct namecache *a_ncp; /* locked namespace */
507 struct ucred *a_cred;
510 struct vop_nrename_args {
511 struct vop_generic_args a_head;
512 struct namecache *a_fncp; /* locked namespace / from */
513 struct namecache *a_tncp; /* locked namespace / to */
514 struct ucred *a_cred;
518 * This structure is the post-compiled VOP operations vector. vop_ops are
519 * typically per-mount entities. The first section is used by our vop_*()
520 * function wrappers to implement hooks for per-mount management functions
521 * such as journaling and cache coherency protocols. The second section is
522 * the function dispatch for the VFSs. The functions are supposed to run
523 * in the context of the VFS's thread (if it has one) and should not be
524 * directly called from random kernel code. Note that VOCALL()s are direct
525 * calls used for chaining vop_ops structures from a VFS context.
528 struct vop_ops *vv_new; /* vfs_recalc_vnodeops() only */
529 struct mount *vv_mount;
531 int vv_flags; /* see VVF_* flags below */
536 int vv_reserved[62]; /* (temporary) reduce recompile pain */
538 #define vop_ops_first_field vop_default
539 int (*vop_default)(struct vop_generic_args *);
540 int (*vop_islocked)(struct vop_islocked_args *);
541 int (*vop_old_lookup)(struct vop_old_lookup_args *);
542 int (*vop_unused03)(void *);
543 int (*vop_old_create)(struct vop_old_create_args *);
544 int (*vop_old_whiteout)(struct vop_old_whiteout_args *);
545 int (*vop_old_mknod)(struct vop_old_mknod_args *);
546 int (*vop_open)(struct vop_open_args *);
547 int (*vop_close)(struct vop_close_args *);
548 int (*vop_access)(struct vop_access_args *);
549 int (*vop_getattr)(struct vop_getattr_args *);
550 int (*vop_setattr)(struct vop_setattr_args *);
551 int (*vop_read)(struct vop_read_args *);
552 int (*vop_write)(struct vop_write_args *);
553 int (*vop_unused04)(void *);
554 int (*vop_ioctl)(struct vop_ioctl_args *);
555 int (*vop_poll)(struct vop_poll_args *);
556 int (*vop_kqfilter)(struct vop_kqfilter_args *);
557 int (*vop_revoke)(struct vop_revoke_args *);
558 int (*vop_mmap)(struct vop_mmap_args *);
559 int (*vop_fsync)(struct vop_fsync_args *);
560 int (*vop_old_remove)(struct vop_old_remove_args *);
561 int (*vop_old_link)(struct vop_old_link_args *);
562 int (*vop_old_rename)(struct vop_old_rename_args *);
563 int (*vop_old_mkdir)(struct vop_old_mkdir_args *);
564 int (*vop_old_rmdir)(struct vop_old_rmdir_args *);
565 int (*vop_old_symlink)(struct vop_old_symlink_args *);
566 int (*vop_readdir)(struct vop_readdir_args *);
567 int (*vop_readlink)(struct vop_readlink_args *);
568 int (*vop_inactive)(struct vop_inactive_args *);
569 int (*vop_reclaim)(struct vop_reclaim_args *);
570 int (*vop_lock)(struct vop_lock_args *);
571 int (*vop_unlock)(struct vop_unlock_args *);
572 int (*vop_bmap)(struct vop_bmap_args *);
573 int (*vop_strategy)(struct vop_strategy_args *);
574 int (*vop_print)(struct vop_print_args *);
575 int (*vop_pathconf)(struct vop_pathconf_args *);
576 int (*vop_advlock)(struct vop_advlock_args *);
577 int (*vop_balloc)(struct vop_balloc_args *);
578 int (*vop_reallocblks)(struct vop_reallocblks_args *);
579 int (*vop_getpages)(struct vop_getpages_args *);
580 int (*vop_putpages)(struct vop_putpages_args *);
581 int (*vop_freeblks)(struct vop_freeblks_args *);
582 int (*vop_unused05)(void *);
583 int (*vop_getacl)(struct vop_getacl_args *);
584 int (*vop_setacl)(struct vop_setacl_args *);
585 int (*vop_aclcheck)(struct vop_aclcheck_args *);
586 int (*vop_getextattr)(struct vop_getextattr_args *);
587 int (*vop_setextattr)(struct vop_setextattr_args *);
588 int (*vop_unused06)(void *);
589 int (*vop_unused07)(void *);
590 int (*vop_unused08)(void *);
591 int (*vop_mountctl)(struct vop_mountctl_args *);
593 int (*vop_nresolve)(struct vop_nresolve_args *);
594 int (*vop_nlookupdotdot)(struct vop_nlookupdotdot_args *);
595 int (*vop_ncreate)(struct vop_ncreate_args *);
596 int (*vop_nmkdir)(struct vop_nmkdir_args *);
597 int (*vop_nmknod)(struct vop_nmknod_args *);
598 int (*vop_nlink)(struct vop_nlink_args *);
599 int (*vop_nsymlink)(struct vop_nsymlink_args *);
600 int (*vop_nwhiteout)(struct vop_nwhiteout_args *);
601 int (*vop_nremove)(struct vop_nremove_args *);
602 int (*vop_nrmdir)(struct vop_nrmdir_args *);
603 int (*vop_nrename)(struct vop_nrename_args *);
604 #define vop_ops_last_field vop_nrename
607 #define VVF_JOURNAL_LAYER 0x0001
608 #define VVF_COHERENCY_LAYER 0x0002
609 #define VVF_SUPPORTS_FSMID 0x0004
610 #define VVF_UNUSED_08 0x0008
611 #define VVF_NOATIME 0x0010 /* FUTURE */
612 #define VVF_RDONLY 0x0020 /* FUTURE */
613 #define VVF_NOCLUSTER 0x0040 /* FUTURE */
614 #define VVF_SUIDDIR 0x0080 /* FUTURE */
617 * vop_mountctl() operations
619 #define VFSSET_DETACH 0
620 #define VFSSET_ATTACH 1
623 * Kernel VOP arguments union, suitable for malloc / embedding in other
624 * structures. The vop_args_union can hold any VOP call argument structure.
625 * Note that vu_head is broken out.
627 union vop_args_union {
628 struct vop_generic_args vu_head;
629 struct vop_generic_args vu_default;
630 struct vop_islocked_args vu_islocked;
631 struct vop_old_lookup_args vu_lookup;
632 struct vop_old_create_args vu_create;
633 struct vop_old_whiteout_args vu_whiteout;
634 struct vop_old_mknod_args vu_mknod;
635 struct vop_open_args vu_open;
636 struct vop_close_args vu_close;
637 struct vop_access_args vu_access;
638 struct vop_getattr_args vu_getattr;
639 struct vop_setattr_args vu_setattr;
640 struct vop_read_args vu_read;
641 struct vop_write_args vu_write;
642 struct vop_ioctl_args vu_ioctl;
643 struct vop_poll_args vu_poll;
644 struct vop_kqfilter_args vu_kqfilter;
645 struct vop_revoke_args vu_revoke;
646 struct vop_mmap_args vu_mmap;
647 struct vop_fsync_args vu_fsync;
648 struct vop_old_remove_args vu_remove;
649 struct vop_old_link_args vu_link;
650 struct vop_old_rename_args vu_rename;
651 struct vop_old_mkdir_args vu_mkdir;
652 struct vop_old_rmdir_args vu_rmdir;
653 struct vop_old_symlink_args vu_symlink;
654 struct vop_readdir_args vu_readdir;
655 struct vop_readlink_args vu_readlink;
656 struct vop_inactive_args vu_inactive;
657 struct vop_reclaim_args vu_reclaim;
658 struct vop_lock_args vu_lock;
659 struct vop_unlock_args vu_unlock;
660 struct vop_bmap_args vu_bmap;
661 struct vop_strategy_args vu_strategy;
662 struct vop_print_args vu_print;
663 struct vop_pathconf_args vu_pathconf;
664 struct vop_advlock_args vu_advlock;
665 struct vop_balloc_args vu_balloc;
666 struct vop_reallocblks_args vu_reallocblks;
667 struct vop_getpages_args vu_getpages;
668 struct vop_putpages_args vu_putpages;
669 struct vop_freeblks_args vu_freeblks;
670 struct vop_getacl_args vu_getacl;
671 struct vop_setacl_args vu_setacl;
672 struct vop_aclcheck_args vu_aclcheck;
673 struct vop_getextattr_args vu_getextattr;
674 struct vop_setextattr_args vu_setextattr;
675 struct vop_mountctl_args vu_mountctl;
677 struct vop_nresolve_args vu_nresolve;
678 struct vop_nlookupdotdot_args vu_nlookupdotdot;
679 struct vop_ncreate_args vu_ncreate;
680 struct vop_nmkdir_args vu_nmkdir;
681 struct vop_nmknod_args vu_nmknod;
682 struct vop_nlink_args vu_nlink;
683 struct vop_nsymlink_args vu_nsymlink;
684 struct vop_nwhiteout_args vu_nwhiteout;
685 struct vop_nremove_args vu_nremove;
686 struct vop_nrmdir_args vu_nrmdir;
687 struct vop_nrename_args vu_nrename;
693 * Kernel VOP call wrappers. These wrappers are responsible for wrapping
694 * the arguments in the appropriate VOP arguments structure, sending the
695 * message, and waiting for a reply. All kernel and VFS code should generally
696 * call these wrappers rather then attempt to call the operations vector
697 * routine directly in order to allow DragonFly to properly wrap the operation
698 * in a message and dispatch it to the correct thread.
700 int vop_islocked(struct vop_ops *ops, struct vnode *vp, struct thread *td);
701 int vop_old_lookup(struct vop_ops *ops, struct vnode *dvp,
702 struct vnode **vpp, struct componentname *cnp);
703 int vop_old_create(struct vop_ops *ops, struct vnode *dvp,
704 struct vnode **vpp, struct componentname *cnp,
706 int vop_old_whiteout(struct vop_ops *ops, struct vnode *dvp,
707 struct componentname *cnp, int flags);
708 int vop_old_mknod(struct vop_ops *ops, struct vnode *dvp,
709 struct vnode **vpp, struct componentname *cnp,
711 int vop_open(struct vop_ops *ops, struct vnode *vp, int mode,
712 struct ucred *cred, struct file *file);
713 int vop_close(struct vop_ops *ops, struct vnode *vp, int fflag);
714 int vop_access(struct vop_ops *ops, struct vnode *vp, int mode,
716 int vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap);
717 int vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
719 int vop_read(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
720 int ioflag, struct ucred *cred);
721 int vop_write(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
722 int ioflag, struct ucred *cred);
723 int vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command,
724 caddr_t data, int fflag, struct ucred *cred);
725 int vop_poll(struct vop_ops *ops, struct vnode *vp, int events,
727 int vop_kqfilter(struct vop_ops *ops, struct vnode *vp, struct knote *kn);
728 int vop_revoke(struct vop_ops *ops, struct vnode *vp, int flags);
729 int vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags,
731 int vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor);
732 int vop_old_remove(struct vop_ops *ops, struct vnode *dvp,
733 struct vnode *vp, struct componentname *cnp);
734 int vop_old_link(struct vop_ops *ops, struct vnode *tdvp,
735 struct vnode *vp, struct componentname *cnp);
736 int vop_old_rename(struct vop_ops *ops, struct vnode *fdvp,
737 struct vnode *fvp, struct componentname *fcnp,
738 struct vnode *tdvp, struct vnode *tvp,
739 struct componentname *tcnp);
740 int vop_old_mkdir(struct vop_ops *ops, struct vnode *dvp,
741 struct vnode **vpp, struct componentname *cnp,
743 int vop_old_rmdir(struct vop_ops *ops, struct vnode *dvp,
744 struct vnode *vp, struct componentname *cnp);
745 int vop_old_symlink(struct vop_ops *ops, struct vnode *dvp,
746 struct vnode **vpp, struct componentname *cnp,
747 struct vattr *vap, char *target);
748 int vop_readdir(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
749 struct ucred *cred, int *eofflag,
750 int *ncookies, u_long **cookies);
751 int vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
753 int vop_inactive(struct vop_ops *ops, struct vnode *vp);
754 int vop_reclaim(struct vop_ops *ops, struct vnode *vp);
755 int vop_lock(struct vop_ops *ops, struct vnode *vp, int flags);
756 int vop_unlock(struct vop_ops *ops, struct vnode *vp, int flags);
757 int vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset,
758 struct vnode **vpp, off_t *doffsetp, int *runp, int *runb);
759 int vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio);
760 int vop_print(struct vop_ops *ops, struct vnode *vp);
761 int vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name,
763 int vop_advlock(struct vop_ops *ops, struct vnode *vp, caddr_t id, int op,
764 struct flock *fl, int flags);
765 int vop_balloc(struct vop_ops *ops, struct vnode *vp, off_t startoffset,
766 int size, struct ucred *cred, int flags,
768 int vop_reallocblks(struct vop_ops *ops, struct vnode *vp,
769 struct cluster_save *buflist);
770 int vop_getpages(struct vop_ops *ops, struct vnode *vp, struct vm_page **m,
771 int count, int reqpage, vm_ooffset_t offset);
772 int vop_putpages(struct vop_ops *ops, struct vnode *vp, struct vm_page **m,
773 int count, int sync, int *rtvals, vm_ooffset_t offset);
774 int vop_freeblks(struct vop_ops *ops, struct vnode *vp,
775 off_t offset, int length);
776 int vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
777 struct acl *aclp, struct ucred *cred);
778 int vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
779 struct acl *aclp, struct ucred *cred);
780 int vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
781 struct acl *aclp, struct ucred *cred);
782 int vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name,
783 struct uio *uio, struct ucred *cred);
784 int vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name,
785 struct uio *uio, struct ucred *cred);
786 int vop_mountctl(struct vop_ops *ops, int op, struct file *fp,
787 const void *ctl, int ctllen, void *buf, int buflen, int *res);
788 int vop_nresolve(struct vop_ops *ops, struct namecache *ncp,
790 int vop_nlookupdotdot(struct vop_ops *ops, struct vnode *dvp,
791 struct vnode **vpp, struct ucred *cred);
792 int vop_ncreate(struct vop_ops *ops, struct namecache *ncp,
793 struct vnode **vpp, struct ucred *cred, struct vattr *vap);
794 int vop_nmkdir(struct vop_ops *ops, struct namecache *ncp,
795 struct vnode **vpp, struct ucred *cred, struct vattr *vap);
796 int vop_nmknod(struct vop_ops *ops, struct namecache *ncp,
797 struct vnode **vpp, struct ucred *cred, struct vattr *vap);
798 int vop_nlink(struct vop_ops *ops, struct namecache *ncp, struct vnode *vp,
800 int vop_nsymlink(struct vop_ops *ops, struct namecache *ncp,
801 struct vnode **vpp, struct ucred *cred,
802 struct vattr *vap, char *target);
803 int vop_nwhiteout(struct vop_ops *ops, struct namecache *ncp,
804 struct ucred *cred, int flags);
805 int vop_nremove(struct vop_ops *ops, struct namecache *ncp,
807 int vop_nrmdir(struct vop_ops *ops, struct namecache *ncp,
809 int vop_nrename(struct vop_ops *ops, struct namecache *fncp,
810 struct namecache *tncp, struct ucred *cred);
813 * Kernel VOP forwarding wrappers. These are called when a VFS such as
814 * nullfs or unionfs needs to push down into another VFS, changing the
815 * a_ops pointer and consequentially necessitating additional
818 * Note that this is different from vop_ops chaining within the same
819 * filesystem. When a filesystem chains a vop_ops it just uses VOCALLs.
821 int vop_vnoperate_ap(struct vop_generic_args *ap);
822 int vop_cache_operate_ap(struct vop_generic_args *ap);
823 int vop_journal_operate_ap(struct vop_generic_args *ap);
824 int vop_islocked_ap(struct vop_islocked_args *ap);
825 int vop_old_lookup_ap(struct vop_old_lookup_args *ap);
826 int vop_old_create_ap(struct vop_old_create_args *ap);
827 int vop_old_whiteout_ap(struct vop_old_whiteout_args *ap);
828 int vop_old_mknod_ap(struct vop_old_mknod_args *ap);
829 int vop_open_ap(struct vop_open_args *ap);
830 int vop_close_ap(struct vop_close_args *ap);
831 int vop_access_ap(struct vop_access_args *ap);
832 int vop_getattr_ap(struct vop_getattr_args *ap);
833 int vop_setattr_ap(struct vop_setattr_args *ap);
834 int vop_read_ap(struct vop_read_args *ap);
835 int vop_write_ap(struct vop_write_args *ap);
836 int vop_ioctl_ap(struct vop_ioctl_args *ap);
837 int vop_poll_ap(struct vop_poll_args *ap);
838 int vop_kqfilter_ap(struct vop_kqfilter_args *ap);
839 int vop_revoke_ap(struct vop_revoke_args *ap);
840 int vop_mmap_ap(struct vop_mmap_args *ap);
841 int vop_fsync_ap(struct vop_fsync_args *ap);
842 int vop_old_remove_ap(struct vop_old_remove_args *ap);
843 int vop_old_link_ap(struct vop_old_link_args *ap);
844 int vop_old_rename_ap(struct vop_old_rename_args *ap);
845 int vop_old_mkdir_ap(struct vop_old_mkdir_args *ap);
846 int vop_old_rmdir_ap(struct vop_old_rmdir_args *ap);
847 int vop_old_symlink_ap(struct vop_old_symlink_args *ap);
848 int vop_readdir_ap(struct vop_readdir_args *ap);
849 int vop_readlink_ap(struct vop_readlink_args *ap);
850 int vop_inactive_ap(struct vop_inactive_args *ap);
851 int vop_reclaim_ap(struct vop_reclaim_args *ap);
852 int vop_lock_ap(struct vop_lock_args *ap);
853 int vop_unlock_ap(struct vop_unlock_args *ap);
854 int vop_bmap_ap(struct vop_bmap_args *ap);
855 int vop_strategy_ap(struct vop_strategy_args *ap);
856 int vop_print_ap(struct vop_print_args *ap);
857 int vop_pathconf_ap(struct vop_pathconf_args *ap);
858 int vop_advlock_ap(struct vop_advlock_args *ap);
859 int vop_balloc_ap(struct vop_balloc_args *ap);
860 int vop_reallocblks_ap(struct vop_reallocblks_args *ap);
861 int vop_getpages_ap(struct vop_getpages_args *ap);
862 int vop_putpages_ap(struct vop_putpages_args *ap);
863 int vop_freeblks_ap(struct vop_freeblks_args *ap);
864 int vop_getacl_ap(struct vop_getacl_args *ap);
865 int vop_setacl_ap(struct vop_setacl_args *ap);
866 int vop_aclcheck_ap(struct vop_aclcheck_args *ap);
867 int vop_getextattr_ap(struct vop_getextattr_args *ap);
868 int vop_setextattr_ap(struct vop_setextattr_args *ap);
869 int vop_mountctl_ap(struct vop_mountctl_args *ap);
871 int vop_nresolve_ap(struct vop_nresolve_args *ap);
872 int vop_nlookupdotdot_ap(struct vop_nlookupdotdot_args *ap);
873 int vop_ncreate_ap(struct vop_ncreate_args *ap);
874 int vop_nmkdir_ap(struct vop_nmkdir_args *ap);
875 int vop_nmknod_ap(struct vop_nmknod_args *ap);
876 int vop_nlink_ap(struct vop_nlink_args *ap);
877 int vop_nsymlink_ap(struct vop_nsymlink_args *ap);
878 int vop_nwhiteout_ap(struct vop_nwhiteout_args *ap);
879 int vop_nremove_ap(struct vop_nremove_args *ap);
880 int vop_nrmdir_ap(struct vop_nrmdir_args *ap);
881 int vop_nrename_ap(struct vop_nrename_args *ap);
884 * VOP operations descriptor. This is used by the vop_ops compiler
885 * to convert VFS vector arrays (typically in vfs/blah/blah_vnops.c)
886 * into a vop_ops operations vector.
888 extern struct vnodeop_desc vop_default_desc;
889 extern struct vnodeop_desc vop_islocked_desc;
890 extern struct vnodeop_desc vop_old_lookup_desc;
891 extern struct vnodeop_desc vop_old_create_desc;
892 extern struct vnodeop_desc vop_old_whiteout_desc;
893 extern struct vnodeop_desc vop_old_mknod_desc;
894 extern struct vnodeop_desc vop_open_desc;
895 extern struct vnodeop_desc vop_close_desc;
896 extern struct vnodeop_desc vop_access_desc;
897 extern struct vnodeop_desc vop_getattr_desc;
898 extern struct vnodeop_desc vop_setattr_desc;
899 extern struct vnodeop_desc vop_read_desc;
900 extern struct vnodeop_desc vop_write_desc;
901 extern struct vnodeop_desc vop_ioctl_desc;
902 extern struct vnodeop_desc vop_poll_desc;
903 extern struct vnodeop_desc vop_kqfilter_desc;
904 extern struct vnodeop_desc vop_revoke_desc;
905 extern struct vnodeop_desc vop_mmap_desc;
906 extern struct vnodeop_desc vop_fsync_desc;
907 extern struct vnodeop_desc vop_old_remove_desc;
908 extern struct vnodeop_desc vop_old_link_desc;
909 extern struct vnodeop_desc vop_old_rename_desc;
910 extern struct vnodeop_desc vop_old_mkdir_desc;
911 extern struct vnodeop_desc vop_old_rmdir_desc;
912 extern struct vnodeop_desc vop_old_symlink_desc;
913 extern struct vnodeop_desc vop_readdir_desc;
914 extern struct vnodeop_desc vop_readlink_desc;
915 extern struct vnodeop_desc vop_inactive_desc;
916 extern struct vnodeop_desc vop_reclaim_desc;
917 extern struct vnodeop_desc vop_lock_desc;
918 extern struct vnodeop_desc vop_unlock_desc;
919 extern struct vnodeop_desc vop_bmap_desc;
920 extern struct vnodeop_desc vop_strategy_desc;
921 extern struct vnodeop_desc vop_print_desc;
922 extern struct vnodeop_desc vop_pathconf_desc;
923 extern struct vnodeop_desc vop_advlock_desc;
924 extern struct vnodeop_desc vop_balloc_desc;
925 extern struct vnodeop_desc vop_reallocblks_desc;
926 extern struct vnodeop_desc vop_getpages_desc;
927 extern struct vnodeop_desc vop_putpages_desc;
928 extern struct vnodeop_desc vop_freeblks_desc;
929 extern struct vnodeop_desc vop_getacl_desc;
930 extern struct vnodeop_desc vop_setacl_desc;
931 extern struct vnodeop_desc vop_aclcheck_desc;
932 extern struct vnodeop_desc vop_getextattr_desc;
933 extern struct vnodeop_desc vop_setextattr_desc;
934 extern struct vnodeop_desc vop_mountctl_desc;
936 extern struct vnodeop_desc vop_nresolve_desc;
937 extern struct vnodeop_desc vop_nlookupdotdot_desc;
938 extern struct vnodeop_desc vop_ncreate_desc;
939 extern struct vnodeop_desc vop_nmkdir_desc;
940 extern struct vnodeop_desc vop_nmknod_desc;
941 extern struct vnodeop_desc vop_nlink_desc;
942 extern struct vnodeop_desc vop_nsymlink_desc;
943 extern struct vnodeop_desc vop_nwhiteout_desc;
944 extern struct vnodeop_desc vop_nremove_desc;
945 extern struct vnodeop_desc vop_nrmdir_desc;
946 extern struct vnodeop_desc vop_nrename_desc;
951 * VOP_*() convenience macros extract the operations vector and make the
954 #define VOP_ISLOCKED(vp, td) \
955 vop_islocked(*(vp)->v_ops, vp, td)
956 #define VOP_OPEN(vp, mode, cred, fp) \
957 vop_open(*(vp)->v_ops, vp, mode, cred, fp)
958 #define VOP_CLOSE(vp, fflag) \
959 vop_close(*(vp)->v_ops, vp, fflag)
960 #define VOP_ACCESS(vp, mode, cred) \
961 vop_access(*(vp)->v_ops, vp, mode, cred)
962 #define VOP_GETATTR(vp, vap) \
963 vop_getattr(*(vp)->v_ops, vp, vap)
964 #define VOP_SETATTR(vp, vap, cred) \
965 vop_setattr(*(vp)->v_ops, vp, vap, cred)
966 #define VOP_READ(vp, uio, ioflag, cred) \
967 vop_read(*(vp)->v_ops, vp, uio, ioflag, cred)
968 #define VOP_WRITE(vp, uio, ioflag, cred) \
969 vop_write(*(vp)->v_ops, vp, uio, ioflag, cred)
970 #define VOP_IOCTL(vp, command, data, fflag, cred) \
971 vop_ioctl(*(vp)->v_ops, vp, command, data, fflag, cred)
972 #define VOP_POLL(vp, events, cred) \
973 vop_poll(*(vp)->v_ops, vp, events, cred)
974 #define VOP_KQFILTER(vp, kn) \
975 vop_kqfilter(*(vp)->v_ops, vp, kn)
976 #define VOP_REVOKE(vp, flags) \
977 vop_revoke(*(vp)->v_ops, vp, flags)
978 #define VOP_MMAP(vp, fflags, cred) \
979 vop_mmap(*(vp)->v_ops, vp, fflags, cred)
980 #define VOP_FSYNC(vp, waitfor) \
981 vop_fsync(*(vp)->v_ops, vp, waitfor)
982 #define VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies) \
983 vop_readdir(*(vp)->v_ops, vp, uio, cred, eofflag, ncookies, cookies)
984 #define VOP_READLINK(vp, uio, cred) \
985 vop_readlink(*(vp)->v_ops, vp, uio, cred)
986 #define VOP_INACTIVE(vp) \
987 vop_inactive(*(vp)->v_ops, vp)
988 #define VOP_RECLAIM(vp) \
989 vop_reclaim(*(vp)->v_ops, vp)
990 #define VOP_LOCK(vp, flags) \
991 vop_lock(*(vp)->v_ops, vp, flags)
992 #define VOP_UNLOCK(vp, flags) \
993 vop_unlock(*(vp)->v_ops, vp, flags)
994 #define VOP_BMAP(vp, loff, vpp, doffp, runp, runb) \
995 vop_bmap(*(vp)->v_ops, vp, loff, vpp, doffp, runp, runb)
996 #define VOP_PRINT(vp) \
997 vop_print(*(vp)->v_ops, vp)
998 #define VOP_PATHCONF(vp, name, retval) \
999 vop_pathconf(*(vp)->v_ops, vp, name, retval)
1000 #define VOP_ADVLOCK(vp, id, op, fl, flags) \
1001 vop_advlock(*(vp)->v_ops, vp, id, op, fl, flags)
1002 #define VOP_BALLOC(vp, offset, size, cred, flags, bpp) \
1003 vop_balloc(*(vp)->v_ops, vp, offset, size, cred, flags, bpp)
1004 #define VOP_REALLOCBLKS(vp, buflist) \
1005 vop_reallocblks(*(vp)->v_ops, vp, buflist)
1006 #define VOP_GETPAGES(vp, m, count, reqpage, off) \
1007 vop_getpages(*(vp)->v_ops, vp, m, count, reqpage, off)
1008 #define VOP_PUTPAGES(vp, m, count, sync, rtvals, off) \
1009 vop_putpages(*(vp)->v_ops, vp, m, count, sync, rtvals, off)
1010 #define VOP_FREEBLKS(vp, offset, length) \
1011 vop_freeblks(*(vp)->v_ops, vp, offset, length)
1012 #define VOP_GETACL(vp, type, aclp, cred) \
1013 vop_getacl(*(vp)->v_ops, vp, type, aclp, cred)
1014 #define VOP_SETACL(vp, type, aclp, cred) \
1015 vop_setacl(*(vp)->v_ops, vp, type, aclp, cred)
1016 #define VOP_ACLCHECK(vp, type, aclp, cred) \
1017 vop_aclcheck(*(vp)->v_ops, vp, type, aclp, cred)
1018 #define VOP_GETEXTATTR(vp, name, uio, cred) \
1019 vop_getextattr(*(vp)->v_ops, vp, name, uio, cred)
1020 #define VOP_SETEXTATTR(vp, name, uio, cred) \
1021 vop_setextattr(*(vp)->v_ops, vp, name, uio, cred)
1022 /* no VOP_VFSSET() */
1023 /* VOP_STRATEGY - does not exist, use vn_strategy() */
1026 * 'OLD' VOP calls. These calls may only be made by the new API
1027 * compatibility functions in kern/vfs_default.c. Attempting to
1028 * call these functions directly will confuse the namecache. These
1029 * calls are deprecated and being removed from the system and from
1032 #define VOP_OLD_LOOKUP(dvp, vpp, cnp) \
1033 vop_old_lookup(*(dvp)->v_ops, dvp, vpp, cnp)
1034 #define VOP_OLD_CREATE(dvp, vpp, cnp, vap) \
1035 vop_old_create(*(dvp)->v_ops, dvp, vpp, cnp, vap)
1036 #define VOP_OLD_MKDIR(dvp, vpp, cnp, vap) \
1037 vop_old_mkdir(*(dvp)->v_ops, dvp, vpp, cnp, vap)
1038 #define VOP_OLD_MKNOD(dvp, vpp, cnp, vap) \
1039 vop_old_mknod(*(dvp)->v_ops, dvp, vpp, cnp, vap)
1040 #define VOP_OLD_LINK(tdvp, vp, cnp) \
1041 vop_old_link(*(tdvp)->v_ops, tdvp, vp, cnp)
1042 #define VOP_OLD_SYMLINK(dvp, vpp, cnp, vap, target) \
1043 vop_old_symlink(*(dvp)->v_ops, dvp, vpp, cnp, vap, target)
1044 #define VOP_OLD_WHITEOUT(dvp, cnp, flags) \
1045 vop_old_whiteout(*(dvp)->v_ops, dvp, cnp, flags)
1046 #define VOP_OLD_RENAME(fdvp, fvp, fcnp, tdvp, tvp, tcnp) \
1047 vop_old_rename(*(fdvp)->v_ops, fdvp, fvp, fcnp, tdvp, tvp, tcnp)
1048 #define VOP_OLD_RMDIR(dvp, vp, cnp) \
1049 vop_old_rmdir(*(dvp)->v_ops, dvp, vp, cnp)
1050 #define VOP_OLD_REMOVE(dvp, vp, cnp) \
1051 vop_old_remove(*(dvp)->v_ops, dvp, vp, cnp)
1054 * 'NEW' VOP calls. These calls use namespaces as an operational basis
1055 * rather then vnodes and replace the OLD calls. Eventually all VFS's
1056 * will support these calls. Those that do not fall through to compatibility
1057 * code in kern/vfs_default which does the magic required to call the old
1060 #define VOP_NRESOLVE(ncp, cred) \
1061 vop_nresolve((ncp)->nc_mount->mnt_vn_use_ops, ncp, cred)
1062 #define VOP_NCREATE(ncp, vpp, cred, vap) \
1063 vop_ncreate((ncp)->nc_mount->mnt_vn_use_ops, ncp, vpp, cred, vap)
1064 #define VOP_NMKDIR(ncp, vpp, cred, vap) \
1065 vop_nmkdir((ncp)->nc_mount->mnt_vn_use_ops, ncp, vpp, cred, vap)
1066 #define VOP_NMKNOD(ncp, vpp, cred, vap) \
1067 vop_nmknod((ncp)->nc_mount->mnt_vn_use_ops, ncp, vpp, cred, vap)
1068 #define VOP_NLINK(ncp, vp, cred) \
1069 vop_nlink((ncp)->nc_mount->mnt_vn_use_ops, ncp, vp, cred)
1070 #define VOP_NSYMLINK(ncp, vpp, cred, vap, target) \
1071 vop_nsymlink((ncp)->nc_mount->mnt_vn_use_ops, ncp, vpp, cred, vap, target)
1072 #define VOP_NWHITEOUT(ncp, cred, flags) \
1073 vop_nwhiteout((ncp)->nc_mount->mnt_vn_use_ops, ncp, cred, flags)
1074 #define VOP_NRENAME(fncp, tncp, cred) \
1075 vop_nrename((fncp)->nc_mount->mnt_vn_use_ops, fncp, tncp, cred)
1076 #define VOP_NRMDIR(ncp, cred) \
1077 vop_nrmdir((ncp)->nc_mount->mnt_vn_use_ops, ncp, cred)
1078 #define VOP_NREMOVE(ncp, cred) \
1079 vop_nremove((ncp)->nc_mount->mnt_vn_use_ops, ncp, cred)