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.28 2007/08/13 17:31:52 dillon Exp $
38 * The vop_ops structure vectors all access to a filesystem. It contains a
39 * fixed set of vectors.
41 * In DragonFly the ultimate goal is to thread the VFS, which means that
42 * the dispatch functions will eventually be called from the context of
43 * a management thread rather then directly called by a process. This
44 * requires us to divorce direct process dependancies (in particular ioctl
45 * and UIO's). In addition, it is our intention to implement kernel
46 * level cache management and coherency in the vop_*() interfacing
49 * The number of management threads will depend on the VFS. The idea is
50 * to give a high performance VFS such as UFS at least one thread per cpu,
51 * and a low performance VFS such as CD9660 perhaps just one thread period.
52 * Blocking issues within the management thread are up to the VFS itself,
53 * but DragonFly will introduce a layer above the VFS to handle cacheable
54 * requests without having to enter the VFS (e.g. by making attribute
55 * and VM object information a permanent fixture of the vnode structure
56 * and accessing them directly).
58 * THE VOPOPS VECTORS SHOULD NEVER BE CALLED DIRECTLY! Instead always use
59 * the kernel helper procedures vop_*() to call a vopop. The kernel
60 * helper procedure will be responsible for handling the DragonFly messaging
61 * conversion when it occurs.
64 #ifndef _SYS_VFSOPS_H_
65 #define _SYS_VFSOPS_H_
85 struct vop_generic_args {
86 struct syslink_desc *a_desc; /* command descriptor for the call */
87 struct vop_ops *a_ops; /* operations vector for the call */
91 struct vop_old_lookup_args {
92 struct vop_generic_args a_head;
95 struct componentname *a_cnp;
98 struct vop_old_create_args {
99 struct vop_generic_args a_head;
101 struct vnode **a_vpp;
102 struct componentname *a_cnp;
106 struct vop_old_whiteout_args {
107 struct vop_generic_args a_head;
109 struct componentname *a_cnp;
113 struct vop_old_mknod_args {
114 struct vop_generic_args a_head;
116 struct vnode **a_vpp;
117 struct componentname *a_cnp;
121 struct vop_open_args {
122 struct vop_generic_args a_head;
125 struct ucred *a_cred;
126 struct file *a_fp; /* optional fp for fileops override */
129 struct vop_close_args {
130 struct vop_generic_args a_head;
135 struct vop_access_args {
136 struct vop_generic_args a_head;
139 struct ucred *a_cred;
142 struct vop_getattr_args {
143 struct vop_generic_args a_head;
148 struct vop_setattr_args {
149 struct vop_generic_args a_head;
152 struct ucred *a_cred;
155 struct vop_read_args {
156 struct vop_generic_args a_head;
160 struct ucred *a_cred;
163 struct vop_write_args {
164 struct vop_generic_args a_head;
168 struct ucred *a_cred;
171 struct vop_ioctl_args {
172 struct vop_generic_args a_head;
177 struct ucred *a_cred;
180 struct vop_poll_args {
181 struct vop_generic_args a_head;
184 struct ucred *a_cred;
187 struct vop_kqfilter_args {
188 struct vop_generic_args a_head;
193 struct vop_revoke_args {
194 struct vop_generic_args a_head;
199 struct vop_mmap_args {
200 struct vop_generic_args a_head;
203 struct ucred *a_cred;
206 struct vop_fsync_args {
207 struct vop_generic_args a_head;
212 struct vop_old_remove_args {
213 struct vop_generic_args a_head;
216 struct componentname *a_cnp;
219 struct vop_old_link_args {
220 struct vop_generic_args a_head;
221 struct vnode *a_tdvp;
223 struct componentname *a_cnp;
226 struct vop_old_rename_args {
227 struct vop_generic_args a_head;
228 struct vnode *a_fdvp;
230 struct componentname *a_fcnp;
231 struct vnode *a_tdvp;
233 struct componentname *a_tcnp;
236 struct vop_old_mkdir_args {
237 struct vop_generic_args a_head;
239 struct vnode **a_vpp;
240 struct componentname *a_cnp;
244 struct vop_old_rmdir_args {
245 struct vop_generic_args a_head;
248 struct componentname *a_cnp;
251 struct vop_old_symlink_args {
252 struct vop_generic_args a_head;
254 struct vnode **a_vpp;
255 struct componentname *a_cnp;
260 struct vop_readdir_args {
261 struct vop_generic_args a_head;
264 struct ucred *a_cred;
270 struct vop_readlink_args {
271 struct vop_generic_args a_head;
274 struct ucred *a_cred;
277 struct vop_inactive_args {
278 struct vop_generic_args a_head;
282 struct vop_reclaim_args {
283 struct vop_generic_args a_head;
287 struct vop_bmap_args {
288 struct vop_generic_args a_head;
296 struct vop_strategy_args {
297 struct vop_generic_args a_head;
302 struct vop_print_args {
303 struct vop_generic_args a_head;
307 struct vop_pathconf_args {
308 struct vop_generic_args a_head;
311 register_t *a_retval;
314 struct vop_advlock_args {
315 struct vop_generic_args a_head;
323 struct vop_balloc_args {
324 struct vop_generic_args a_head;
328 struct ucred *a_cred;
333 struct vop_reallocblks_args {
334 struct vop_generic_args a_head;
336 struct cluster_save *a_buflist;
339 struct vop_getpages_args {
340 struct vop_generic_args a_head;
342 struct vm_page **a_m;
345 vm_ooffset_t a_offset;
348 struct vop_putpages_args {
349 struct vop_generic_args a_head;
351 struct vm_page **a_m;
355 vm_ooffset_t a_offset;
358 struct vop_freeblks_args {
359 struct vop_generic_args a_head;
365 struct vop_getacl_args {
366 struct vop_generic_args a_head;
370 struct ucred *a_cred;
373 struct vop_setacl_args {
374 struct vop_generic_args a_head;
378 struct ucred *a_cred;
381 struct vop_aclcheck_args {
382 struct vop_generic_args a_head;
386 struct ucred *a_cred;
389 struct vop_getextattr_args {
390 struct vop_generic_args a_head;
394 struct ucred *a_cred;
397 struct vop_setextattr_args {
398 struct vop_generic_args a_head;
402 struct ucred *a_cred;
405 struct vop_mountctl_args {
406 struct vop_generic_args a_head;
419 struct vop_nresolve_args {
420 struct vop_generic_args a_head;
421 struct nchandle *a_nch;
422 struct ucred *a_cred;
425 struct vop_nlookupdotdot_args {
426 struct vop_generic_args a_head;
428 struct vnode **a_vpp;
429 struct ucred *a_cred;
432 struct vop_ncreate_args {
433 struct vop_generic_args a_head;
434 struct nchandle *a_nch; /* locked namespace */
435 struct vnode **a_vpp; /* returned refd & locked */
436 struct ucred *a_cred;
440 struct vop_nmkdir_args {
441 struct vop_generic_args a_head;
442 struct nchandle *a_nch; /* locked namespace */
443 struct vnode **a_vpp; /* returned refd & locked */
444 struct ucred *a_cred;
448 struct vop_nmknod_args {
449 struct vop_generic_args a_head;
450 struct nchandle *a_nch;
451 struct vnode **a_vpp;
452 struct ucred *a_cred;
456 struct vop_nlink_args {
457 struct vop_generic_args a_head;
458 struct nchandle *a_nch;
460 struct ucred *a_cred;
463 struct vop_nsymlink_args {
464 struct vop_generic_args a_head;
465 struct nchandle *a_nch;
466 struct vnode **a_vpp;
467 struct ucred *a_cred;
472 struct vop_nwhiteout_args {
473 struct vop_generic_args a_head;
474 struct nchandle *a_nch;
475 struct ucred *a_cred;
479 struct vop_nremove_args {
480 struct vop_generic_args a_head;
481 struct nchandle *a_nch; /* locked namespace */
482 struct ucred *a_cred;
485 struct vop_nrmdir_args {
486 struct vop_generic_args a_head;
487 struct nchandle *a_nch; /* locked namespace */
488 struct ucred *a_cred;
491 struct vop_nrename_args {
492 struct vop_generic_args a_head;
493 struct nchandle *a_fnch; /* locked namespace / from */
494 struct nchandle *a_tnch; /* locked namespace / to */
495 struct ucred *a_cred;
499 * This structure is the post-compiled VOP operations vector. vop_ops are
500 * typically per-mount entities. The first section is used by our vop_*()
501 * function wrappers to implement hooks for per-mount management functions
502 * such as journaling and cache coherency protocols. The second section is
503 * the function dispatch for the VFSs. The functions are supposed to run
504 * in the context of the VFS's thread (if it has one) and should not be
505 * directly called from random kernel code. Note that VOCALL()s are direct
506 * calls used for chaining vop_ops structures from a VFS context.
510 struct mount *vv_mount;
513 #define vop_ops_first_field vop_default
514 int (*vop_default)(struct vop_generic_args *);
515 int (*vop_unused11)(void *);
516 int (*vop_old_lookup)(struct vop_old_lookup_args *);
517 int (*vop_unused03)(void *);
518 int (*vop_old_create)(struct vop_old_create_args *);
519 int (*vop_old_whiteout)(struct vop_old_whiteout_args *);
520 int (*vop_old_mknod)(struct vop_old_mknod_args *);
521 int (*vop_open)(struct vop_open_args *);
522 int (*vop_close)(struct vop_close_args *);
523 int (*vop_access)(struct vop_access_args *);
524 int (*vop_getattr)(struct vop_getattr_args *);
525 int (*vop_setattr)(struct vop_setattr_args *);
526 int (*vop_read)(struct vop_read_args *);
527 int (*vop_write)(struct vop_write_args *);
528 int (*vop_unused04)(void *);
529 int (*vop_ioctl)(struct vop_ioctl_args *);
530 int (*vop_poll)(struct vop_poll_args *);
531 int (*vop_kqfilter)(struct vop_kqfilter_args *);
532 int (*vop_revoke)(struct vop_revoke_args *);
533 int (*vop_mmap)(struct vop_mmap_args *);
534 int (*vop_fsync)(struct vop_fsync_args *);
535 int (*vop_old_remove)(struct vop_old_remove_args *);
536 int (*vop_old_link)(struct vop_old_link_args *);
537 int (*vop_old_rename)(struct vop_old_rename_args *);
538 int (*vop_old_mkdir)(struct vop_old_mkdir_args *);
539 int (*vop_old_rmdir)(struct vop_old_rmdir_args *);
540 int (*vop_old_symlink)(struct vop_old_symlink_args *);
541 int (*vop_readdir)(struct vop_readdir_args *);
542 int (*vop_readlink)(struct vop_readlink_args *);
543 int (*vop_inactive)(struct vop_inactive_args *);
544 int (*vop_reclaim)(struct vop_reclaim_args *);
545 int (*vop_unused09)(void *);
546 int (*vop_unused10)(void *);
547 int (*vop_bmap)(struct vop_bmap_args *);
548 int (*vop_strategy)(struct vop_strategy_args *);
549 int (*vop_print)(struct vop_print_args *);
550 int (*vop_pathconf)(struct vop_pathconf_args *);
551 int (*vop_advlock)(struct vop_advlock_args *);
552 int (*vop_balloc)(struct vop_balloc_args *);
553 int (*vop_reallocblks)(struct vop_reallocblks_args *);
554 int (*vop_getpages)(struct vop_getpages_args *);
555 int (*vop_putpages)(struct vop_putpages_args *);
556 int (*vop_freeblks)(struct vop_freeblks_args *);
557 int (*vop_unused05)(void *);
558 int (*vop_getacl)(struct vop_getacl_args *);
559 int (*vop_setacl)(struct vop_setacl_args *);
560 int (*vop_aclcheck)(struct vop_aclcheck_args *);
561 int (*vop_getextattr)(struct vop_getextattr_args *);
562 int (*vop_setextattr)(struct vop_setextattr_args *);
563 int (*vop_unused06)(void *);
564 int (*vop_unused07)(void *);
565 int (*vop_unused08)(void *);
566 int (*vop_mountctl)(struct vop_mountctl_args *);
568 int (*vop_nresolve)(struct vop_nresolve_args *);
569 int (*vop_nlookupdotdot)(struct vop_nlookupdotdot_args *);
570 int (*vop_ncreate)(struct vop_ncreate_args *);
571 int (*vop_nmkdir)(struct vop_nmkdir_args *);
572 int (*vop_nmknod)(struct vop_nmknod_args *);
573 int (*vop_nlink)(struct vop_nlink_args *);
574 int (*vop_nsymlink)(struct vop_nsymlink_args *);
575 int (*vop_nwhiteout)(struct vop_nwhiteout_args *);
576 int (*vop_nremove)(struct vop_nremove_args *);
577 int (*vop_nrmdir)(struct vop_nrmdir_args *);
578 int (*vop_nrename)(struct vop_nrename_args *);
579 #define vop_ops_last_field vop_nrename
583 * vop_mountctl() operations
585 #define VFSSET_DETACH 0
586 #define VFSSET_ATTACH 1
589 * Kernel VOP arguments union, suitable for malloc / embedding in other
590 * structures. The vop_args_union can hold any VOP call argument structure.
591 * Note that vu_head is broken out.
593 union vop_args_union {
594 struct vop_generic_args vu_head;
595 struct vop_generic_args vu_default;
596 struct vop_old_lookup_args vu_lookup;
597 struct vop_old_create_args vu_create;
598 struct vop_old_whiteout_args vu_whiteout;
599 struct vop_old_mknod_args vu_mknod;
600 struct vop_open_args vu_open;
601 struct vop_close_args vu_close;
602 struct vop_access_args vu_access;
603 struct vop_getattr_args vu_getattr;
604 struct vop_setattr_args vu_setattr;
605 struct vop_read_args vu_read;
606 struct vop_write_args vu_write;
607 struct vop_ioctl_args vu_ioctl;
608 struct vop_poll_args vu_poll;
609 struct vop_kqfilter_args vu_kqfilter;
610 struct vop_revoke_args vu_revoke;
611 struct vop_mmap_args vu_mmap;
612 struct vop_fsync_args vu_fsync;
613 struct vop_old_remove_args vu_remove;
614 struct vop_old_link_args vu_link;
615 struct vop_old_rename_args vu_rename;
616 struct vop_old_mkdir_args vu_mkdir;
617 struct vop_old_rmdir_args vu_rmdir;
618 struct vop_old_symlink_args vu_symlink;
619 struct vop_readdir_args vu_readdir;
620 struct vop_readlink_args vu_readlink;
621 struct vop_inactive_args vu_inactive;
622 struct vop_reclaim_args vu_reclaim;
623 struct vop_bmap_args vu_bmap;
624 struct vop_strategy_args vu_strategy;
625 struct vop_print_args vu_print;
626 struct vop_pathconf_args vu_pathconf;
627 struct vop_advlock_args vu_advlock;
628 struct vop_balloc_args vu_balloc;
629 struct vop_reallocblks_args vu_reallocblks;
630 struct vop_getpages_args vu_getpages;
631 struct vop_putpages_args vu_putpages;
632 struct vop_freeblks_args vu_freeblks;
633 struct vop_getacl_args vu_getacl;
634 struct vop_setacl_args vu_setacl;
635 struct vop_aclcheck_args vu_aclcheck;
636 struct vop_getextattr_args vu_getextattr;
637 struct vop_setextattr_args vu_setextattr;
638 struct vop_mountctl_args vu_mountctl;
640 struct vop_nresolve_args vu_nresolve;
641 struct vop_nlookupdotdot_args vu_nlookupdotdot;
642 struct vop_ncreate_args vu_ncreate;
643 struct vop_nmkdir_args vu_nmkdir;
644 struct vop_nmknod_args vu_nmknod;
645 struct vop_nlink_args vu_nlink;
646 struct vop_nsymlink_args vu_nsymlink;
647 struct vop_nwhiteout_args vu_nwhiteout;
648 struct vop_nremove_args vu_nremove;
649 struct vop_nrmdir_args vu_nrmdir;
650 struct vop_nrename_args vu_nrename;
656 * Kernel VOP call wrappers. These wrappers are responsible for wrapping
657 * the arguments in the appropriate VOP arguments structure, sending the
658 * message, and waiting for a reply. All kernel and VFS code should generally
659 * call these wrappers rather then attempt to call the operations vector
660 * routine directly in order to allow DragonFly to properly wrap the operation
661 * in a message and dispatch it to the correct thread.
663 int vop_old_lookup(struct vop_ops *ops, struct vnode *dvp,
664 struct vnode **vpp, struct componentname *cnp);
665 int vop_old_create(struct vop_ops *ops, struct vnode *dvp,
666 struct vnode **vpp, struct componentname *cnp,
668 int vop_old_whiteout(struct vop_ops *ops, struct vnode *dvp,
669 struct componentname *cnp, int flags);
670 int vop_old_mknod(struct vop_ops *ops, struct vnode *dvp,
671 struct vnode **vpp, struct componentname *cnp,
673 int vop_open(struct vop_ops *ops, struct vnode *vp, int mode,
674 struct ucred *cred, struct file *file);
675 int vop_close(struct vop_ops *ops, struct vnode *vp, int fflag);
676 int vop_access(struct vop_ops *ops, struct vnode *vp, int mode,
678 int vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap);
679 int vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap,
681 int vop_read(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
682 int ioflag, struct ucred *cred);
683 int vop_write(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
684 int ioflag, struct ucred *cred);
685 int vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command,
686 caddr_t data, int fflag, struct ucred *cred);
687 int vop_poll(struct vop_ops *ops, struct vnode *vp, int events,
689 int vop_kqfilter(struct vop_ops *ops, struct vnode *vp, struct knote *kn);
690 int vop_revoke(struct vop_ops *ops, struct vnode *vp, int flags);
691 int vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags,
693 int vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor);
694 int vop_old_remove(struct vop_ops *ops, struct vnode *dvp,
695 struct vnode *vp, struct componentname *cnp);
696 int vop_old_link(struct vop_ops *ops, struct vnode *tdvp,
697 struct vnode *vp, struct componentname *cnp);
698 int vop_old_rename(struct vop_ops *ops, struct vnode *fdvp,
699 struct vnode *fvp, struct componentname *fcnp,
700 struct vnode *tdvp, struct vnode *tvp,
701 struct componentname *tcnp);
702 int vop_old_mkdir(struct vop_ops *ops, struct vnode *dvp,
703 struct vnode **vpp, struct componentname *cnp,
705 int vop_old_rmdir(struct vop_ops *ops, struct vnode *dvp,
706 struct vnode *vp, struct componentname *cnp);
707 int vop_old_symlink(struct vop_ops *ops, struct vnode *dvp,
708 struct vnode **vpp, struct componentname *cnp,
709 struct vattr *vap, char *target);
710 int vop_readdir(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
711 struct ucred *cred, int *eofflag,
712 int *ncookies, u_long **cookies);
713 int vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio,
715 int vop_inactive(struct vop_ops *ops, struct vnode *vp);
716 int vop_reclaim(struct vop_ops *ops, struct vnode *vp);
717 int vop_bmap(struct vop_ops *ops, struct vnode *vp, off_t loffset,
718 off_t *doffsetp, int *runp, int *runb);
719 int vop_strategy(struct vop_ops *ops, struct vnode *vp, struct bio *bio);
720 int vop_print(struct vop_ops *ops, struct vnode *vp);
721 int vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name,
723 int vop_advlock(struct vop_ops *ops, struct vnode *vp, caddr_t id, int op,
724 struct flock *fl, int flags);
725 int vop_balloc(struct vop_ops *ops, struct vnode *vp, off_t startoffset,
726 int size, struct ucred *cred, int flags,
728 int vop_reallocblks(struct vop_ops *ops, struct vnode *vp,
729 struct cluster_save *buflist);
730 int vop_getpages(struct vop_ops *ops, struct vnode *vp, struct vm_page **m,
731 int count, int reqpage, vm_ooffset_t offset);
732 int vop_putpages(struct vop_ops *ops, struct vnode *vp, struct vm_page **m,
733 int count, int sync, int *rtvals, vm_ooffset_t offset);
734 int vop_freeblks(struct vop_ops *ops, struct vnode *vp,
735 off_t offset, int length);
736 int vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
737 struct acl *aclp, struct ucred *cred);
738 int vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
739 struct acl *aclp, struct ucred *cred);
740 int vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type,
741 struct acl *aclp, struct ucred *cred);
742 int vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name,
743 struct uio *uio, struct ucred *cred);
744 int vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name,
745 struct uio *uio, struct ucred *cred);
746 int vop_mountctl(struct vop_ops *ops, int op, struct file *fp,
747 const void *ctl, int ctllen, void *buf, int buflen, int *res);
748 int vop_nresolve(struct vop_ops *ops, struct nchandle *nch,
750 int vop_nlookupdotdot(struct vop_ops *ops, struct vnode *dvp,
751 struct vnode **vpp, struct ucred *cred);
752 int vop_ncreate(struct vop_ops *ops, struct nchandle *nch,
753 struct vnode **vpp, struct ucred *cred, struct vattr *vap);
754 int vop_nmkdir(struct vop_ops *ops, struct nchandle *nch,
755 struct vnode **vpp, struct ucred *cred, struct vattr *vap);
756 int vop_nmknod(struct vop_ops *ops, struct nchandle *nch,
757 struct vnode **vpp, struct ucred *cred, struct vattr *vap);
758 int vop_nlink(struct vop_ops *ops, struct nchandle *nch, struct vnode *vp,
760 int vop_nsymlink(struct vop_ops *ops, struct nchandle *nch,
761 struct vnode **vpp, struct ucred *cred,
762 struct vattr *vap, char *target);
763 int vop_nwhiteout(struct vop_ops *ops, struct nchandle *nch,
764 struct ucred *cred, int flags);
765 int vop_nremove(struct vop_ops *ops, struct nchandle *nch,
767 int vop_nrmdir(struct vop_ops *ops, struct nchandle *nch,
769 int vop_nrename(struct vop_ops *ops, struct nchandle *fnch,
770 struct nchandle *tnch, struct ucred *cred);
773 * Kernel VOP forwarding wrappers. These are called when a VFS such as
774 * nullfs or unionfs needs to push down into another VFS, changing the
775 * a_ops pointer and consequentially necessitating additional
778 * Note that this is different from vop_ops chaining within the same
779 * filesystem. When a filesystem chains a vop_ops it just uses VOCALLs.
781 int vop_vnoperate_ap(struct vop_generic_args *ap);
782 int vop_cache_operate_ap(struct vop_generic_args *ap);
783 int vop_journal_operate_ap(struct vop_generic_args *ap);
784 int vop_old_lookup_ap(struct vop_old_lookup_args *ap);
785 int vop_old_create_ap(struct vop_old_create_args *ap);
786 int vop_old_whiteout_ap(struct vop_old_whiteout_args *ap);
787 int vop_old_mknod_ap(struct vop_old_mknod_args *ap);
788 int vop_open_ap(struct vop_open_args *ap);
789 int vop_close_ap(struct vop_close_args *ap);
790 int vop_access_ap(struct vop_access_args *ap);
791 int vop_getattr_ap(struct vop_getattr_args *ap);
792 int vop_setattr_ap(struct vop_setattr_args *ap);
793 int vop_read_ap(struct vop_read_args *ap);
794 int vop_write_ap(struct vop_write_args *ap);
795 int vop_ioctl_ap(struct vop_ioctl_args *ap);
796 int vop_poll_ap(struct vop_poll_args *ap);
797 int vop_kqfilter_ap(struct vop_kqfilter_args *ap);
798 int vop_revoke_ap(struct vop_revoke_args *ap);
799 int vop_mmap_ap(struct vop_mmap_args *ap);
800 int vop_fsync_ap(struct vop_fsync_args *ap);
801 int vop_old_remove_ap(struct vop_old_remove_args *ap);
802 int vop_old_link_ap(struct vop_old_link_args *ap);
803 int vop_old_rename_ap(struct vop_old_rename_args *ap);
804 int vop_old_mkdir_ap(struct vop_old_mkdir_args *ap);
805 int vop_old_rmdir_ap(struct vop_old_rmdir_args *ap);
806 int vop_old_symlink_ap(struct vop_old_symlink_args *ap);
807 int vop_readdir_ap(struct vop_readdir_args *ap);
808 int vop_readlink_ap(struct vop_readlink_args *ap);
809 int vop_inactive_ap(struct vop_inactive_args *ap);
810 int vop_reclaim_ap(struct vop_reclaim_args *ap);
811 int vop_bmap_ap(struct vop_bmap_args *ap);
812 int vop_strategy_ap(struct vop_strategy_args *ap);
813 int vop_print_ap(struct vop_print_args *ap);
814 int vop_pathconf_ap(struct vop_pathconf_args *ap);
815 int vop_advlock_ap(struct vop_advlock_args *ap);
816 int vop_balloc_ap(struct vop_balloc_args *ap);
817 int vop_reallocblks_ap(struct vop_reallocblks_args *ap);
818 int vop_getpages_ap(struct vop_getpages_args *ap);
819 int vop_putpages_ap(struct vop_putpages_args *ap);
820 int vop_freeblks_ap(struct vop_freeblks_args *ap);
821 int vop_getacl_ap(struct vop_getacl_args *ap);
822 int vop_setacl_ap(struct vop_setacl_args *ap);
823 int vop_aclcheck_ap(struct vop_aclcheck_args *ap);
824 int vop_getextattr_ap(struct vop_getextattr_args *ap);
825 int vop_setextattr_ap(struct vop_setextattr_args *ap);
826 int vop_mountctl_ap(struct vop_mountctl_args *ap);
828 int vop_nresolve_ap(struct vop_nresolve_args *ap);
829 int vop_nlookupdotdot_ap(struct vop_nlookupdotdot_args *ap);
830 int vop_ncreate_ap(struct vop_ncreate_args *ap);
831 int vop_nmkdir_ap(struct vop_nmkdir_args *ap);
832 int vop_nmknod_ap(struct vop_nmknod_args *ap);
833 int vop_nlink_ap(struct vop_nlink_args *ap);
834 int vop_nsymlink_ap(struct vop_nsymlink_args *ap);
835 int vop_nwhiteout_ap(struct vop_nwhiteout_args *ap);
836 int vop_nremove_ap(struct vop_nremove_args *ap);
837 int vop_nrmdir_ap(struct vop_nrmdir_args *ap);
838 int vop_nrename_ap(struct vop_nrename_args *ap);
841 * VOP operations descriptor. This is used by the vop_ops compiler
842 * to convert VFS vector arrays (typically in vfs/blah/blah_vnops.c)
843 * into a vop_ops operations vector.
845 extern struct syslink_desc vop_default_desc;
846 extern struct syslink_desc vop_old_lookup_desc;
847 extern struct syslink_desc vop_old_create_desc;
848 extern struct syslink_desc vop_old_whiteout_desc;
849 extern struct syslink_desc vop_old_mknod_desc;
850 extern struct syslink_desc vop_open_desc;
851 extern struct syslink_desc vop_close_desc;
852 extern struct syslink_desc vop_access_desc;
853 extern struct syslink_desc vop_getattr_desc;
854 extern struct syslink_desc vop_setattr_desc;
855 extern struct syslink_desc vop_read_desc;
856 extern struct syslink_desc vop_write_desc;
857 extern struct syslink_desc vop_ioctl_desc;
858 extern struct syslink_desc vop_poll_desc;
859 extern struct syslink_desc vop_kqfilter_desc;
860 extern struct syslink_desc vop_revoke_desc;
861 extern struct syslink_desc vop_mmap_desc;
862 extern struct syslink_desc vop_fsync_desc;
863 extern struct syslink_desc vop_old_remove_desc;
864 extern struct syslink_desc vop_old_link_desc;
865 extern struct syslink_desc vop_old_rename_desc;
866 extern struct syslink_desc vop_old_mkdir_desc;
867 extern struct syslink_desc vop_old_rmdir_desc;
868 extern struct syslink_desc vop_old_symlink_desc;
869 extern struct syslink_desc vop_readdir_desc;
870 extern struct syslink_desc vop_readlink_desc;
871 extern struct syslink_desc vop_inactive_desc;
872 extern struct syslink_desc vop_reclaim_desc;
873 extern struct syslink_desc vop_bmap_desc;
874 extern struct syslink_desc vop_strategy_desc;
875 extern struct syslink_desc vop_print_desc;
876 extern struct syslink_desc vop_pathconf_desc;
877 extern struct syslink_desc vop_advlock_desc;
878 extern struct syslink_desc vop_balloc_desc;
879 extern struct syslink_desc vop_reallocblks_desc;
880 extern struct syslink_desc vop_getpages_desc;
881 extern struct syslink_desc vop_putpages_desc;
882 extern struct syslink_desc vop_freeblks_desc;
883 extern struct syslink_desc vop_getacl_desc;
884 extern struct syslink_desc vop_setacl_desc;
885 extern struct syslink_desc vop_aclcheck_desc;
886 extern struct syslink_desc vop_getextattr_desc;
887 extern struct syslink_desc vop_setextattr_desc;
888 extern struct syslink_desc vop_mountctl_desc;
890 extern struct syslink_desc vop_nresolve_desc;
891 extern struct syslink_desc vop_nlookupdotdot_desc;
892 extern struct syslink_desc vop_ncreate_desc;
893 extern struct syslink_desc vop_nmkdir_desc;
894 extern struct syslink_desc vop_nmknod_desc;
895 extern struct syslink_desc vop_nlink_desc;
896 extern struct syslink_desc vop_nsymlink_desc;
897 extern struct syslink_desc vop_nwhiteout_desc;
898 extern struct syslink_desc vop_nremove_desc;
899 extern struct syslink_desc vop_nrmdir_desc;
900 extern struct syslink_desc vop_nrename_desc;
905 * VOP_*() convenience macros extract the operations vector and make the
908 #define VOP_OPEN(vp, mode, cred, fp) \
909 vop_open(*(vp)->v_ops, vp, mode, cred, fp)
910 #define VOP_CLOSE(vp, fflag) \
911 vop_close(*(vp)->v_ops, vp, fflag)
912 #define VOP_ACCESS(vp, mode, cred) \
913 vop_access(*(vp)->v_ops, vp, mode, cred)
914 #define VOP_GETATTR(vp, vap) \
915 vop_getattr(*(vp)->v_ops, vp, vap)
916 #define VOP_SETATTR(vp, vap, cred) \
917 vop_setattr(*(vp)->v_ops, vp, vap, cred)
918 #define VOP_READ(vp, uio, ioflag, cred) \
919 vop_read(*(vp)->v_ops, vp, uio, ioflag, cred)
920 #define VOP_WRITE(vp, uio, ioflag, cred) \
921 vop_write(*(vp)->v_ops, vp, uio, ioflag, cred)
922 #define VOP_IOCTL(vp, command, data, fflag, cred) \
923 vop_ioctl(*(vp)->v_ops, vp, command, data, fflag, cred)
924 #define VOP_POLL(vp, events, cred) \
925 vop_poll(*(vp)->v_ops, vp, events, cred)
926 #define VOP_KQFILTER(vp, kn) \
927 vop_kqfilter(*(vp)->v_ops, vp, kn)
928 #define VOP_REVOKE(vp, flags) \
929 vop_revoke(*(vp)->v_ops, vp, flags)
930 #define VOP_MMAP(vp, fflags, cred) \
931 vop_mmap(*(vp)->v_ops, vp, fflags, cred)
932 #define VOP_FSYNC(vp, waitfor) \
933 vop_fsync(*(vp)->v_ops, vp, waitfor)
934 #define VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies) \
935 vop_readdir(*(vp)->v_ops, vp, uio, cred, eofflag, ncookies, cookies)
936 #define VOP_READLINK(vp, uio, cred) \
937 vop_readlink(*(vp)->v_ops, vp, uio, cred)
938 #define VOP_INACTIVE(vp) \
939 vop_inactive(*(vp)->v_ops, vp)
940 #define VOP_RECLAIM(vp) \
941 vop_reclaim(*(vp)->v_ops, vp)
942 #define VOP_BMAP(vp, loff, doffp, runp, runb) \
943 vop_bmap(*(vp)->v_ops, vp, loff, doffp, runp, runb)
944 #define VOP_PRINT(vp) \
945 vop_print(*(vp)->v_ops, vp)
946 #define VOP_PATHCONF(vp, name, retval) \
947 vop_pathconf(*(vp)->v_ops, vp, name, retval)
948 #define VOP_ADVLOCK(vp, id, op, fl, flags) \
949 vop_advlock(*(vp)->v_ops, vp, id, op, fl, flags)
950 #define VOP_BALLOC(vp, offset, size, cred, flags, bpp) \
951 vop_balloc(*(vp)->v_ops, vp, offset, size, cred, flags, bpp)
952 #define VOP_REALLOCBLKS(vp, buflist) \
953 vop_reallocblks(*(vp)->v_ops, vp, buflist)
954 #define VOP_GETPAGES(vp, m, count, reqpage, off) \
955 vop_getpages(*(vp)->v_ops, vp, m, count, reqpage, off)
956 #define VOP_PUTPAGES(vp, m, count, sync, rtvals, off) \
957 vop_putpages(*(vp)->v_ops, vp, m, count, sync, rtvals, off)
958 #define VOP_FREEBLKS(vp, offset, length) \
959 vop_freeblks(*(vp)->v_ops, vp, offset, length)
960 #define VOP_GETACL(vp, type, aclp, cred) \
961 vop_getacl(*(vp)->v_ops, vp, type, aclp, cred)
962 #define VOP_SETACL(vp, type, aclp, cred) \
963 vop_setacl(*(vp)->v_ops, vp, type, aclp, cred)
964 #define VOP_ACLCHECK(vp, type, aclp, cred) \
965 vop_aclcheck(*(vp)->v_ops, vp, type, aclp, cred)
966 #define VOP_GETEXTATTR(vp, name, uio, cred) \
967 vop_getextattr(*(vp)->v_ops, vp, name, uio, cred)
968 #define VOP_SETEXTATTR(vp, name, uio, cred) \
969 vop_setextattr(*(vp)->v_ops, vp, name, uio, cred)
970 /* no VOP_VFSSET() */
971 /* VOP_STRATEGY - does not exist, use vn_strategy() */
974 * 'OLD' VOP calls. These calls may only be made by the new API
975 * compatibility functions in kern/vfs_default.c. Attempting to
976 * call these functions directly will confuse the namecache. These
977 * calls are deprecated and being removed from the system and from
980 #define VOP_OLD_LOOKUP(dvp, vpp, cnp) \
981 vop_old_lookup(*(dvp)->v_ops, dvp, vpp, cnp)
982 #define VOP_OLD_CREATE(dvp, vpp, cnp, vap) \
983 vop_old_create(*(dvp)->v_ops, dvp, vpp, cnp, vap)
984 #define VOP_OLD_MKDIR(dvp, vpp, cnp, vap) \
985 vop_old_mkdir(*(dvp)->v_ops, dvp, vpp, cnp, vap)
986 #define VOP_OLD_MKNOD(dvp, vpp, cnp, vap) \
987 vop_old_mknod(*(dvp)->v_ops, dvp, vpp, cnp, vap)
988 #define VOP_OLD_LINK(tdvp, vp, cnp) \
989 vop_old_link(*(tdvp)->v_ops, tdvp, vp, cnp)
990 #define VOP_OLD_SYMLINK(dvp, vpp, cnp, vap, target) \
991 vop_old_symlink(*(dvp)->v_ops, dvp, vpp, cnp, vap, target)
992 #define VOP_OLD_WHITEOUT(dvp, cnp, flags) \
993 vop_old_whiteout(*(dvp)->v_ops, dvp, cnp, flags)
994 #define VOP_OLD_RENAME(fdvp, fvp, fcnp, tdvp, tvp, tcnp) \
995 vop_old_rename(*(fdvp)->v_ops, fdvp, fvp, fcnp, tdvp, tvp, tcnp)
996 #define VOP_OLD_RMDIR(dvp, vp, cnp) \
997 vop_old_rmdir(*(dvp)->v_ops, dvp, vp, cnp)
998 #define VOP_OLD_REMOVE(dvp, vp, cnp) \
999 vop_old_remove(*(dvp)->v_ops, dvp, vp, cnp)
1002 * 'NEW' VOP calls. These calls use namespaces as an operational basis
1003 * rather then vnodes and replace the OLD calls. Eventually all VFS's
1004 * will support these calls. Those that do not fall through to compatibility
1005 * code in kern/vfs_default which does the magic required to call the old
1008 #define VOP_NRESOLVE(nch, cred) \
1009 vop_nresolve((nch)->mount->mnt_vn_use_ops, nch, cred)
1010 #define VOP_NCREATE(nch, vpp, cred, vap) \
1011 vop_ncreate((nch)->mount->mnt_vn_use_ops, nch, vpp, cred, vap)
1012 #define VOP_NMKDIR(nch, vpp, cred, vap) \
1013 vop_nmkdir((nch)->mount->mnt_vn_use_ops, nch, vpp, cred, vap)
1014 #define VOP_NMKNOD(nch, vpp, cred, vap) \
1015 vop_nmknod((nch)->mount->mnt_vn_use_ops, nch, vpp, cred, vap)
1016 #define VOP_NLINK(nch, vp, cred) \
1017 vop_nlink((nch)->mount->mnt_vn_use_ops, nch, vp, cred)
1018 #define VOP_NSYMLINK(nch, vpp, cred, vap, target) \
1019 vop_nsymlink((nch)->mount->mnt_vn_use_ops, nch, vpp, cred, vap, target)
1020 #define VOP_NWHITEOUT(nch, cred, flags) \
1021 vop_nwhiteout((nch)->mount->mnt_vn_use_ops, nch, cred, flags)
1022 #define VOP_NRENAME(fnch, tnch, cred) \
1023 vop_nrename((fnch)->mount->mnt_vn_use_ops, fnch, tnch, cred)
1024 #define VOP_NRMDIR(nch, cred) \
1025 vop_nrmdir((nch)->mount->mnt_vn_use_ops, nch, cred)
1026 #define VOP_NREMOVE(nch, cred) \
1027 vop_nremove((nch)->mount->mnt_vn_use_ops, nch, cred)