From 0961aa926c6a0b750bb5790c05ef9a79712bb214 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 17 Aug 2004 18:57:36 +0000 Subject: [PATCH] VFS messaging/interfacing work stage 2/99. This stage retools the vnode ops vector dispatch, making the vop_ops a per-mount structure rather then a per-filesystem structure. Filesystem mount code, typically in blah_vfsops.c, must now register various vop_ops pointers in the struct mount to compile its VOP operations set. This change will allow us to begin adding per-mount hooks to VFSes to support things like kernel-level journaling, various forms of cache coherency management, and so forth. In addition, the vop_*() calls now require a struct vop_ops pointer as the first argument instead of a vnode pointer (note: in this commit the VOP_*() macros currently just pull the vop_ops pointer from the vnode in order to call the vop_*() procedures). This change is intended to allow us to divorce ourselves from the requirement that a vnode pointer always be part of a VOP call. In particular, this will allow namespace based routines such as remove(), mkdir(), stat(), and so forth to pass namecache pointers rather then locked vnodes and is a very important precursor to the goal of using the namecache for namespace locking. --- sys/conf/kmod.mk | 22 +- .../linux/i386/linprocfs/linprocfs.h | 4 +- .../linux/i386/linprocfs/linprocfs_subr.c | 5 +- .../linux/i386/linprocfs/linprocfs_vfsops.c | 6 +- .../linux/i386/linprocfs/linprocfs_vnops.c | 8 +- sys/kern/vfs_default.c | 4 +- sys/kern/vfs_init.c | 84 +- sys/kern/vfs_subr.c | 14 +- sys/kern/vfs_syscalls.c | 17 +- sys/kern/vfs_vopops.c | 689 ++++++++++---- sys/sys/mount.h | 13 +- sys/sys/vfscache.h | 164 ++++ sys/sys/vfsops.h | 367 ++++--- sys/sys/vnode.h | 86 +- sys/sys/vopops.h | 895 ------------------ sys/vfs/coda/coda_vnops.c | 13 +- sys/vfs/coda/coda_vnops.h | 4 +- sys/vfs/deadfs/dead_vnops.c | 6 +- sys/vfs/fdesc/fdesc_vfsops.c | 6 +- sys/vfs/fdesc/fdesc_vnops.c | 11 +- sys/vfs/fifofs/fifo_vnops.c | 4 +- sys/vfs/gnu/ext2fs/ext2_extern.h | 6 +- sys/vfs/gnu/ext2fs/ext2_vfsops.c | 15 +- sys/vfs/gnu/ext2fs/ext2_vnops.c | 21 +- sys/vfs/hpfs/hpfs.h | 3 +- sys/vfs/hpfs/hpfs_vfsops.c | 7 +- sys/vfs/hpfs/hpfs_vnops.c | 10 +- sys/vfs/isofs/cd9660/cd9660_mount.h | 3 +- sys/vfs/isofs/cd9660/cd9660_vfsops.c | 19 +- sys/vfs/isofs/cd9660/cd9660_vnops.c | 20 +- sys/vfs/isofs/cd9660/iso.h | 6 +- sys/vfs/mfs/mfs_vnops.c | 9 +- sys/vfs/msdosfs/denode.h | 4 +- sys/vfs/msdosfs/msdosfs_denode.c | 4 +- sys/vfs/msdosfs/msdosfs_vfsops.c | 6 +- sys/vfs/msdosfs/msdosfs_vnops.c | 9 +- sys/vfs/nfs/nfs_node.c | 4 +- sys/vfs/nfs/nfs_subs.c | 11 +- sys/vfs/nfs/nfs_vfsops.c | 12 +- sys/vfs/nfs/nfs_vnops.c | 32 +- sys/vfs/nfs/nfsnode.h | 6 +- sys/vfs/ntfs/ntfs.h | 3 +- sys/vfs/ntfs/ntfs_vfsops.c | 9 +- sys/vfs/ntfs/ntfs_vnops.c | 65 +- sys/vfs/nullfs/null.h | 3 +- sys/vfs/nullfs/null_subr.c | 15 +- sys/vfs/nullfs/null_vfsops.c | 8 +- sys/vfs/nullfs/null_vnops.c | 22 +- sys/vfs/nwfs/nwfs_node.c | 6 +- sys/vfs/nwfs/nwfs_vfsops.c | 7 +- sys/vfs/nwfs/nwfs_vnops.c | 9 +- sys/vfs/portal/portal.h | 3 +- sys/vfs/portal/portal_vfsops.c | 9 +- sys/vfs/portal/portal_vnops.c | 10 +- sys/vfs/procfs/procfs.h | 5 +- sys/vfs/procfs/procfs_subr.c | 4 +- sys/vfs/procfs/procfs_vfsops.c | 7 +- sys/vfs/procfs/procfs_vnops.c | 8 +- sys/vfs/smbfs/smbfs_node.c | 6 +- sys/vfs/smbfs/smbfs_vfsops.c | 7 +- sys/vfs/smbfs/smbfs_vnops.c | 10 +- sys/vfs/specfs/spec_vnops.c | 7 +- sys/vfs/udf/udf_vfsops.c | 8 +- sys/vfs/udf/udf_vnops.c | 10 +- sys/vfs/ufs/ffs_extern.h | 6 +- sys/vfs/ufs/ffs_vfsops.c | 15 +- sys/vfs/ufs/ffs_vnops.c | 21 +- sys/vfs/ufs/ufs_extern.h | 5 +- sys/vfs/ufs/ufs_vnops.c | 58 +- sys/vfs/umapfs/umap.h | 3 +- sys/vfs/umapfs/umap_subr.c | 15 +- sys/vfs/umapfs/umap_vfsops.c | 5 +- sys/vfs/umapfs/umap_vnops.c | 17 +- sys/vfs/union/union.h | 3 +- sys/vfs/union/union_subr.c | 8 +- sys/vfs/union/union_vfsops.c | 10 +- sys/vfs/union/union_vnops.c | 53 +- sys/vm/vm_contig.c | 5 +- sys/vm/vm_map.c | 5 +- sys/vm/vnode_pager.c | 5 +- 80 files changed, 1372 insertions(+), 1732 deletions(-) create mode 100644 sys/sys/vfscache.h delete mode 100644 sys/sys/vopops.h diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 0059bec261..10f4f056bd 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -1,6 +1,6 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 # $FreeBSD: src/sys/conf/kmod.mk,v 1.82.2.15 2003/02/10 13:11:50 nyan Exp $ -# $DragonFly: src/sys/conf/kmod.mk,v 1.15 2004/07/21 10:45:21 joerg Exp $ +# $DragonFly: src/sys/conf/kmod.mk,v 1.16 2004/08/17 18:57:30 dillon Exp $ # # The include file handles installing Kernel Loadable Device # drivers (KLD's). @@ -241,16 +241,16 @@ ${_src}: @/tools/makeobjops.awk @/${_srcsrc} .endfor # _ext .endfor # _srcsrc -.for _ext in c h -.if ${SRCS:Mvnode_if.${_ext}} != "" -CLEANFILES+= vnode_if.${_ext} -vnode_if.${_ext}: @ -.if exists(@) -vnode_if.${_ext}: @/tools/vnode_if.awk @/kern/vnode_if.src -.endif - awk -f @/tools/vnode_if.awk -- -${_ext} @/kern/vnode_if.src -.endif -.endfor +#.for _ext in c h +#.if ${SRCS:Mvnode_if.${_ext}} != "" +#CLEANFILES+= vnode_if.${_ext} +#vnode_if.${_ext}: @ +#.if exists(@) +#vnode_if.${_ext}: @/tools/vnode_if.awk @/kern/vnode_if.src +#.endif +# awk -f @/tools/vnode_if.awk -- -${_ext} @/kern/vnode_if.src +#.endif +#.endfor regress: diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs.h b/sys/emulation/linux/i386/linprocfs/linprocfs.h index fe9a2bdb9a..e480a817d1 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs.h +++ b/sys/emulation/linux/i386/linprocfs/linprocfs.h @@ -39,7 +39,7 @@ * @(#)procfs.h 8.9 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs.h,v 1.2.2.4 2001/06/25 19:46:47 pirzyk Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs.h,v 1.7 2004/08/13 17:51:08 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs.h,v 1.8 2004/08/17 18:57:32 dillon Exp $ */ /* @@ -142,8 +142,6 @@ int linprocfs_validfile (struct proc *); #define PROCFS_LOCKED 0x01 #define PROCFS_WANT 0x02 -extern struct vop_ops *linprocfs_vnode_vops; - int linprocfs_root (struct mount *, struct vnode **); int linprocfs_rw (struct vop_read_args *); #endif /* _KERNEL */ diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c b/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c index 9ba8b179ba..871c843616 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c @@ -39,7 +39,7 @@ * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_subr.c,v 1.3.2.4 2001/06/25 19:46:47 pirzyk Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c,v 1.10 2004/08/13 17:51:08 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_subr.c,v 1.11 2004/08/17 18:57:32 dillon Exp $ */ #include @@ -47,6 +47,7 @@ #include #include #include +#include #include "linprocfs.h" static struct pfsnode *pfshead; @@ -124,7 +125,7 @@ loop: */ MALLOC(pfs, struct pfsnode *, sizeof(struct pfsnode), M_TEMP, M_WAITOK); - if ((error = getnewvnode(VT_PROCFS, mp, linprocfs_vnode_vops, vpp)) != 0) { + if ((error = getnewvnode(VT_PROCFS, mp, mp->mnt_vn_ops, vpp)) != 0) { FREE(pfs, M_TEMP); goto out; } diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_vfsops.c b/sys/emulation/linux/i386/linprocfs/linprocfs_vfsops.c index 709fc65d7d..670b3431ea 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_vfsops.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_vfsops.c @@ -39,7 +39,7 @@ * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_vfsops.c,v 1.2.2.3 2001/10/15 20:42:01 des Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vfsops.c,v 1.5 2003/08/27 06:30:04 rob Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vfsops.c,v 1.6 2004/08/17 18:57:32 dillon Exp $ */ /* @@ -55,6 +55,8 @@ #include #include "linprocfs.h" +extern struct vnodeopv_entry_desc linprocfs_vnodeop_entries[]; + static int linprocfs_mount (struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct thread *td); static int linprocfs_statfs (struct mount *mp, struct statfs *sbp, @@ -91,6 +93,8 @@ linprocfs_mount(mp, path, data, ndp, td) mp->mnt_data = 0; vfs_getnewfsid(mp); + vfs_add_vnodeops(&mp->mnt_vn_ops, linprocfs_vnodeop_entries); + (void) copyinstr(path, (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN, &size); bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c index cda57774fc..05ca045607 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c @@ -39,7 +39,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_vnops.c,v 1.3.2.5 2001/08/12 14:29:19 rwatson Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.15 2004/08/13 17:51:08 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.16 2004/08/17 18:57:32 dillon Exp $ */ /* @@ -1017,8 +1017,7 @@ atopid(b, len) /* * procfs vnode operations. */ -struct vop_ops *linprocfs_vnode_vops; -static struct vnodeopv_entry_desc linprocfs_vnodeop_entries[] = { +struct vnodeopv_entry_desc linprocfs_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) linprocfs_access }, { &vop_advlock_desc, (void *) linprocfs_badop }, @@ -1047,7 +1046,4 @@ static struct vnodeopv_entry_desc linprocfs_vnodeop_entries[] = { { &vop_ioctl_desc, (void *) linprocfs_ioctl }, { NULL, NULL } }; -static struct vnodeopv_desc linprocfs_vnodeop_opv_desc = - { &linprocfs_vnode_vops, linprocfs_vnodeop_entries }; -VNODEOP_SET(linprocfs_vnodeop_opv_desc); diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 887ed925eb..a82d1b150b 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -37,7 +37,7 @@ * * * $FreeBSD: src/sys/kern/vfs_default.c,v 1.28.2.7 2003/01/10 18:23:26 bde Exp $ - * $DragonFly: src/sys/kern/vfs_default.c,v 1.11 2004/08/13 17:51:09 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_default.c,v 1.12 2004/08/17 18:57:32 dillon Exp $ */ #include @@ -144,7 +144,7 @@ vop_null(struct vop_generic_args *ap) int vop_defaultop(struct vop_generic_args *ap) { - return (VOCALL(default_vnode_vops, ap->a_desc->vdesc_offset, ap)); + return (VOCALL(default_vnode_vops, ap)); } int diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index e9f7ff0edc..0e760a77cd 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -70,7 +70,7 @@ * * @(#)vfs_init.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/vfs_init.c,v 1.59 2002/04/30 18:44:32 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_init.c,v 1.5 2004/08/13 17:51:09 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_init.c,v 1.6 2004/08/17 18:57:32 dillon Exp $ */ /* * Manage vnode VOP operations vectors @@ -105,48 +105,66 @@ static void vfs_recalc_vnodeops(void); * Add a vnode operations (vnops) vector to the global list. */ void -vfs_add_vnodeops(const void *data) +vfs_add_vnodeops_sysinit(const void *data) +{ + const struct vnodeopv_desc *vdesc = data; + + vfs_add_vnodeops(vdesc->opv_desc_vector, vdesc->opv_desc_ops); +} + +/* + * Unlink previously added vnode operations vector. + */ +void +vfs_rm_vnodeops_sysinit(const void *data) +{ + const struct vnodeopv_desc *vdesc = data; + + vfs_rm_vnodeops(vdesc->opv_desc_vector); +} + +void +vfs_add_vnodeops(struct vop_ops **vops_pp, struct vnodeopv_entry_desc *descs) { struct vnodeopv_node *node; - struct vop_ops *vops; + struct vop_ops *ops; - node = malloc(sizeof(struct vnodeopv_node), M_VNODE, M_ZERO|M_WAITOK); - node->vdesc = data; - if ((vops = *node->vdesc->opv_desc_vector) == NULL) { - vops = malloc(sizeof(struct vop_ops), M_VNODE, M_ZERO|M_WAITOK); - *node->vdesc->opv_desc_vector = vops; + node = malloc(sizeof(*node), M_VNODE, M_ZERO|M_WAITOK); + if ((ops = *vops_pp) == NULL) { + ops = malloc(sizeof(struct vop_ops), M_VNODE, M_ZERO|M_WAITOK); + *vops_pp = ops; } - ++vops->vv_refs; + node->ops = ops; + node->descs = descs; + ++ops->vv_refs; TAILQ_INSERT_TAIL(&vnodeopv_list, node, entry); vfs_recalc_vnodeops(); } -/* - * Unlink previously added vnode operations vector. - */ void -vfs_rm_vnodeops(const void *data) +vfs_rm_vnodeops(struct vop_ops **vops_pp) { + struct vop_ops *ops = *vops_pp; struct vnodeopv_node *node; - struct vop_ops *vops; + + if (ops == NULL) + return; TAILQ_FOREACH(node, &vnodeopv_list, entry) { - if ((const void *)node->vdesc == data) + if (node->ops == ops) break; } if (node == NULL) { - printf("vfs_rm_vnodeops: unable to find vnodeopv_desc: %p\n", - data); + printf("vfs_rm_vnodeops: unable to find ops: %p\n", ops); return; } TAILQ_REMOVE(&vnodeopv_list, node, entry); - vops = *node->vdesc->opv_desc_vector; - KKASSERT(vops != NULL && vops->vv_refs > 0); - if (--vops->vv_refs == 0) { - *node->vdesc->opv_desc_vector = NULL; - free(vops, M_VNODE); - } free(node, M_VNODE); + KKASSERT(ops != NULL && ops->vv_refs > 0); + if (--ops->vv_refs == 0) { + *vops_pp = NULL; + free(ops, M_VNODE); + } vfs_recalc_vnodeops(); } @@ -158,7 +176,7 @@ vfs_recalc_vnodeops(void) { struct vnodeopv_node *node; struct vnodeopv_entry_desc *desc; - struct vop_ops *vops; + struct vop_ops *ops; struct vop_ops *vnew; int off; @@ -170,14 +188,14 @@ vfs_recalc_vnodeops(void) * to vop_eopnotsupp. */ TAILQ_FOREACH(node, &vnodeopv_list, entry) { - vops = *node->vdesc->opv_desc_vector; - if ((vnew = vops->vv_new) == NULL) { + ops = node->ops; + if ((vnew = ops->vv_new) == NULL) { vnew = malloc(sizeof(struct vop_ops), M_VNODE, M_ZERO|M_WAITOK); - vops->vv_new = vnew; + ops->vv_new = vnew; vnew->vop_default = vop_eopnotsupp; } - for (desc = node->vdesc->opv_desc_ops; desc->opve_op; ++desc) { + for (desc = node->descs; desc->opve_op; ++desc) { off = desc->opve_op->vdesc_offset; *(void **)((char *)vnew + off) = desc->opve_func; } @@ -191,21 +209,21 @@ vfs_recalc_vnodeops(void) } /* - * Copy the temporary vops into the running configuration and then + * Copy the temporary ops into the running configuration and then * delete them. */ TAILQ_FOREACH(node, &vnodeopv_list, entry) { - vops = *node->vdesc->opv_desc_vector; - if ((vnew = vops->vv_new) == NULL) + ops = node->ops; + if ((vnew = ops->vv_new) == NULL) continue; for (off = __offsetof(struct vop_ops, vop_ops_first_field); off <= __offsetof(struct vop_ops, vop_ops_last_field); off += sizeof(void **) ) { - *(void **)((char *)vops + off) = + *(void **)((char *)ops + off) = *(void **)((char *)vnew + off); } - vops->vv_new = NULL; + ops->vv_new = NULL; free(vnew, M_VNODE); } } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8d648c87f2..5904f334bf 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -37,7 +37,7 @@ * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_subr.c,v 1.36 2004/08/13 17:51:09 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_subr.c,v 1.37 2004/08/17 18:57:32 dillon Exp $ */ /* @@ -204,6 +204,7 @@ static void vfree(struct vnode *vp); static void vmaybefree(struct vnode *vp); extern int dev_ref_debug; +extern struct vnodeopv_entry_desc spec_vnodeop_entries[]; /* * NOTE: the vnode interlock must be held on call. @@ -221,7 +222,6 @@ vmaybefree(struct vnode *vp) void vntblinit(void) { - /* * Desired vnodes is a result of the physical page count * and the size of kernel's heap. It scales in proportion @@ -619,14 +619,13 @@ SYSINIT(vnlru, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &vnlru_kp) /* * Routines having to do with the management of the vnode table. */ -extern struct vop_ops *dead_vnode_vops; /* * Return the next vnode from the free list. */ int getnewvnode(enum vtagtype tag, struct mount *mp, - struct vop_ops *vops, struct vnode **vpp) + struct vop_ops *ops, struct vnode **vpp) { int s; struct thread *td = curthread; /* XXX */ @@ -802,7 +801,7 @@ getnewvnode(enum vtagtype tag, struct mount *mp, TAILQ_INIT(&vp->v_dirtyblkhd); vp->v_type = VNON; vp->v_tag = tag; - vp->v_vops = vops; + vp->v_ops = ops; *vpp = vp; vp->v_usecount = 1; vp->v_data = NULL; @@ -1992,7 +1991,7 @@ vflush_scan(struct mount *mp, struct vnode *vp, vgonel(vp, vlock, info->td); } else { vclean(vp, vlock, 0, info->td); - vp->v_vops = spec_vnode_vops; + vp->v_ops = spec_vnode_vops; insmntque(vp, (struct mount *) 0); } return(0); @@ -2094,7 +2093,7 @@ vclean(struct vnode *vp, lwkt_tokref_t vlock, int flags, struct thread *td) /* * Done with purge, notify sleepers of the grim news. */ - vp->v_vops = dead_vnode_vops; + vp->v_ops = dead_vnode_vops; vn_pollgone(vp); vp->v_tag = VT_NON; vp->v_flag &= ~VXLOCK; @@ -3088,6 +3087,7 @@ static struct vnodeopv_entry_desc sync_vnodeop_entries[] = { { &vop_islocked_desc, (void *) sync_islocked }, /* islocked */ { NULL, NULL } }; + static struct vnodeopv_desc sync_vnodeop_opv_desc = { &sync_vnode_vops, sync_vnodeop_entries }; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 1ac3bdee2e..fac313d0e7 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -37,7 +37,7 @@ * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.151.2.18 2003/04/04 20:35:58 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.37 2004/05/26 19:09:04 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.38 2004/08/17 18:57:32 dillon Exp $ */ #include @@ -249,8 +249,7 @@ mount(struct mount_args *uap) /* * Allocate and initialize the filesystem. */ - mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK); - bzero((char *)mp, (u_long)sizeof(struct mount)); + mp = malloc(sizeof(struct mount), M_MOUNT, M_ZERO|M_WAITOK); TAILQ_INIT(&mp->mnt_nvnodelist); TAILQ_INIT(&mp->mnt_reservedvnlist); mp->mnt_nvnodelistsize = 0; @@ -324,6 +323,9 @@ update: if ((error = VFS_START(mp, 0, td)) != 0) vrele(vp); } else { + vfs_rm_vnodeops(&mp->mnt_vn_ops); + vfs_rm_vnodeops(&mp->mnt_vn_spec_ops); + vfs_rm_vnodeops(&mp->mnt_vn_fifo_ops); lwkt_gettoken(&vlock, vp->v_interlock); vp->v_flag &= ~VMOUNT; lwkt_reltoken(&vlock); @@ -491,6 +493,15 @@ dounmount(struct mount *mp, int flags, struct thread *td) return (error); } TAILQ_REMOVE(&mountlist, mp, mnt_list); + + /* + * Remove any installed vnode ops here so the individual VFSs don't + * have to. + */ + vfs_rm_vnodeops(&mp->mnt_vn_ops); + vfs_rm_vnodeops(&mp->mnt_vn_spec_ops); + vfs_rm_vnodeops(&mp->mnt_vn_fifo_ops); + if ((coveredvp = mp->mnt_vnodecovered) != NULLVP) { coveredvp->v_mountedhere = NULL; vrele(coveredvp); diff --git a/sys/kern/vfs_vopops.c b/sys/kern/vfs_vopops.c index 72e4300975..7ac951df4b 100644 --- a/sys/kern/vfs_vopops.c +++ b/sys/kern/vfs_vopops.c @@ -32,7 +32,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.1 2004/08/13 17:51:09 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_vopops.c,v 1.2 2004/08/17 18:57:32 dillon Exp $ */ #include @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include @@ -231,320 +231,349 @@ VNODEOP_DESC_INIT_VP(createvobject); VNODEOP_DESC_INIT_VP(destroyvobject); VNODEOP_DESC_INIT_VP(getvobject); +/************************************************************************ + * PRIMARY HIGH LEVEL VNODE OPERATIONS CALLS * + ************************************************************************ + * + * These procedures are called directly from the kernel and/or fileops + * code to perform file/device operations on the system. + */ + int -vop_islocked(struct vnode *vp, struct thread *td) +vop_islocked(struct vop_ops *ops, struct vnode *vp, struct thread *td) { struct vop_islocked_args ap; ap.a_head.a_desc = &vop_islocked_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_td = td; - return(vp->v_vops->vop_islocked(&ap)); + return(ops->vop_islocked(&ap)); } int -vop_lookup(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct namecache **ncpp, - struct componentname *cnp) +vop_lookup(struct vop_ops *ops, struct vnode *dvp, + struct namecache *par, struct vnode **vpp, + struct namecache **ncpp, struct componentname *cnp) { struct vop_lookup_args ap; ap.a_head.a_desc = &vop_lookup_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vpp = vpp; ap.a_ncpp = ncpp; ap.a_cnp = cnp; - return(dvp->v_vops->vop_lookup(&ap)); + return(ops->vop_lookup(&ap)); } int -vop_cachedlookup(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct namecache **ncpp, - struct componentname *cnp) +vop_cachedlookup(struct vop_ops *ops, struct vnode *dvp, + struct namecache *par, struct vnode **vpp, + struct namecache **ncpp, struct componentname *cnp) { struct vop_cachedlookup_args ap; ap.a_head.a_desc = &vop_cachedlookup_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vpp = vpp; ap.a_ncpp = ncpp; ap.a_cnp = cnp; - return(dvp->v_vops->vop_cachedlookup(&ap)); + return(ops->vop_cachedlookup(&ap)); } int -vop_create(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap) +vop_create(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct vnode **vpp, struct componentname *cnp, struct vattr *vap) { struct vop_create_args ap; ap.a_head.a_desc = &vop_create_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vpp = vpp; ap.a_cnp = cnp; ap.a_vap = vap; - return(dvp->v_vops->vop_create(&ap)); + return(ops->vop_create(&ap)); } int -vop_whiteout(struct vnode *dvp, struct namecache *par, - struct componentname *cnp, int flags) +vop_whiteout(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct componentname *cnp, int flags) { struct vop_whiteout_args ap; ap.a_head.a_desc = &vop_whiteout_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_cnp = cnp; ap.a_flags = flags; - return(dvp->v_vops->vop_whiteout(&ap)); + return(ops->vop_whiteout(&ap)); } int -vop_mknod(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap) +vop_mknod(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct vnode **vpp, struct componentname *cnp, struct vattr *vap) { struct vop_mknod_args ap; ap.a_head.a_desc = &vop_mknod_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vpp = vpp; ap.a_cnp = cnp; ap.a_vap = vap; - return(dvp->v_vops->vop_mknod(&ap)); + return(ops->vop_mknod(&ap)); } int -vop_open(struct vnode *vp, int mode, struct ucred *cred, - struct thread *td) +vop_open(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred, + struct thread *td) { struct vop_open_args ap; ap.a_head.a_desc = &vop_open_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_mode = mode; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_open(&ap)); + return(ops->vop_open(&ap)); } int -vop_close(struct vnode *vp, int fflag, struct thread *td) +vop_close(struct vop_ops *ops, struct vnode *vp, int fflag, struct thread *td) { struct vop_close_args ap; ap.a_head.a_desc = &vop_close_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_fflag = fflag; ap.a_td = td; - return(vp->v_vops->vop_close(&ap)); + return(ops->vop_close(&ap)); } int -vop_access(struct vnode *vp, int mode, struct ucred *cred, - struct thread *td) +vop_access(struct vop_ops *ops, struct vnode *vp, int mode, struct ucred *cred, + struct thread *td) { struct vop_access_args ap; ap.a_head.a_desc = &vop_access_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_mode = mode; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_access(&ap)); + return(ops->vop_access(&ap)); } int -vop_getattr(struct vnode *vp, struct vattr *vap, - struct thread *td) +vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap, + struct thread *td) { struct vop_getattr_args ap; ap.a_head.a_desc = &vop_getattr_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_vap = vap; ap.a_td = td; - return(vp->v_vops->vop_getattr(&ap)); + return(ops->vop_getattr(&ap)); } int -vop_setattr(struct vnode *vp, struct vattr *vap, - struct ucred *cred, struct thread *td) +vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap, + struct ucred *cred, struct thread *td) { struct vop_setattr_args ap; ap.a_head.a_desc = &vop_setattr_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_vap = vap; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_setattr(&ap)); + return(ops->vop_setattr(&ap)); } int -vop_read(struct vnode *vp, struct uio *uio, int ioflag, - struct ucred *cred) +vop_read(struct vop_ops *ops, struct vnode *vp, struct uio *uio, int ioflag, + struct ucred *cred) { struct vop_read_args ap; ap.a_head.a_desc = &vop_read_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_uio = uio; ap.a_ioflag = ioflag; ap.a_cred = cred; - return(vp->v_vops->vop_read(&ap)); + return(ops->vop_read(&ap)); } int -vop_write(struct vnode *vp, struct uio *uio, int ioflag, - struct ucred *cred) +vop_write(struct vop_ops *ops, struct vnode *vp, struct uio *uio, int ioflag, + struct ucred *cred) { struct vop_write_args ap; ap.a_head.a_desc = &vop_write_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_uio = uio; ap.a_ioflag = ioflag; ap.a_cred = cred; - return(vp->v_vops->vop_write(&ap)); + return(ops->vop_write(&ap)); } int -vop_lease(struct vnode *vp, struct thread *td, - struct ucred *cred, int flag) +vop_lease(struct vop_ops *ops, struct vnode *vp, struct thread *td, + struct ucred *cred, int flag) { struct vop_lease_args ap; ap.a_head.a_desc = &vop_lease_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_td = td; ap.a_cred = cred; ap.a_flag = flag; - return(vp->v_vops->vop_lease(&ap)); + return(ops->vop_lease(&ap)); } int -vop_ioctl(struct vnode *vp, u_long command, caddr_t data, - int fflag, struct ucred *cred, - struct thread *td) +vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command, caddr_t data, + int fflag, struct ucred *cred, + struct thread *td) { struct vop_ioctl_args ap; ap.a_head.a_desc = &vop_ioctl_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_command = command; ap.a_data = data; ap.a_fflag = fflag; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_ioctl(&ap)); + return(ops->vop_ioctl(&ap)); } int -vop_poll(struct vnode *vp, int events, struct ucred *cred, - struct thread *td) +vop_poll(struct vop_ops *ops, struct vnode *vp, int events, struct ucred *cred, + struct thread *td) { struct vop_poll_args ap; ap.a_head.a_desc = &vop_poll_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_events = events; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_poll(&ap)); + return(ops->vop_poll(&ap)); } int -vop_kqfilter(struct vnode *vp, struct knote *kn) +vop_kqfilter(struct vop_ops *ops, struct vnode *vp, struct knote *kn) { struct vop_kqfilter_args ap; ap.a_head.a_desc = &vop_kqfilter_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_kn = kn; - return(vp->v_vops->vop_kqfilter(&ap)); + return(ops->vop_kqfilter(&ap)); } int -vop_revoke(struct vnode *vp, int flags) +vop_revoke(struct vop_ops *ops, struct vnode *vp, int flags) { struct vop_revoke_args ap; ap.a_head.a_desc = &vop_revoke_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_flags = flags; - return(vp->v_vops->vop_revoke(&ap)); + return(ops->vop_revoke(&ap)); } int -vop_mmap(struct vnode *vp, int fflags, struct ucred *cred, - struct thread *td) +vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags, struct ucred *cred, + struct thread *td) { struct vop_mmap_args ap; ap.a_head.a_desc = &vop_mmap_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_fflags = fflags; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_mmap(&ap)); + return(ops->vop_mmap(&ap)); } int -vop_fsync(struct vnode *vp, int waitfor, struct thread *td) +vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor, struct thread *td) { struct vop_fsync_args ap; ap.a_head.a_desc = &vop_fsync_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_waitfor = waitfor; ap.a_td = td; - return(vp->v_vops->vop_fsync(&ap)); + return(ops->vop_fsync(&ap)); } int -vop_remove(struct vnode *dvp, struct namecache *par, - struct vnode *vp, struct componentname *cnp) +vop_remove(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct vnode *vp, struct componentname *cnp) { struct vop_remove_args ap; ap.a_head.a_desc = &vop_remove_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vp = vp; ap.a_cnp = cnp; - return(dvp->v_vops->vop_remove(&ap)); + return(ops->vop_remove(&ap)); } int -vop_link(struct vnode *tdvp, struct namecache *par, - struct vnode *vp, struct componentname *cnp) +vop_link(struct vop_ops *ops, struct vnode *tdvp, struct namecache *par, + struct vnode *vp, struct componentname *cnp) { struct vop_link_args ap; ap.a_head.a_desc = &vop_link_desc; + ap.a_head.a_ops = ops; ap.a_tdvp = tdvp; ap.a_par = par; ap.a_vp = vp; ap.a_cnp = cnp; - return(tdvp->v_vops->vop_link(&ap)); + return(ops->vop_link(&ap)); } int -vop_rename(struct vnode *fdvp, struct namecache *fpar, - struct vnode *fvp, struct componentname *fcnp, - struct vnode *tdvp, struct namecache *tpar, - struct vnode *tvp, struct componentname *tcnp) +vop_rename(struct vop_ops *ops, struct vnode *fdvp, struct namecache *fpar, + struct vnode *fvp, struct componentname *fcnp, + struct vnode *tdvp, struct namecache *tpar, + struct vnode *tvp, struct componentname *tcnp) { struct vop_rename_args ap; ap.a_head.a_desc = &vop_rename_desc; + ap.a_head.a_ops = ops; ap.a_fdvp = fdvp; ap.a_fpar = fpar; ap.a_fvp = fvp; @@ -553,395 +582,737 @@ vop_rename(struct vnode *fdvp, struct namecache *fpar, ap.a_tpar = tpar; ap.a_tvp = tvp; ap.a_tcnp = tcnp; - return(fdvp->v_vops->vop_rename(&ap)); + return(ops->vop_rename(&ap)); } int -vop_mkdir(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap) +vop_mkdir(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct vnode **vpp, struct componentname *cnp, struct vattr *vap) { struct vop_mkdir_args ap; ap.a_head.a_desc = &vop_mkdir_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vpp = vpp; ap.a_cnp = cnp; ap.a_vap = vap; - return(dvp->v_vops->vop_mkdir(&ap)); + return(ops->vop_mkdir(&ap)); } int -vop_rmdir(struct vnode *dvp, struct namecache *par, - struct vnode *vp, struct componentname *cnp) +vop_rmdir(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct vnode *vp, struct componentname *cnp) { struct vop_rmdir_args ap; ap.a_head.a_desc = &vop_rmdir_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vp = vp; ap.a_cnp = cnp; - return(dvp->v_vops->vop_rmdir(&ap)); + return(ops->vop_rmdir(&ap)); } int -vop_symlink(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap, char *target) +vop_symlink(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, + struct vnode **vpp, struct componentname *cnp, + struct vattr *vap, char *target) { struct vop_symlink_args ap; ap.a_head.a_desc = &vop_symlink_desc; + ap.a_head.a_ops = ops; ap.a_dvp = dvp; ap.a_par = par; ap.a_vpp = vpp; ap.a_cnp = cnp; ap.a_vap = vap; ap.a_target = target; - return(dvp->v_vops->vop_symlink(&ap)); + return(ops->vop_symlink(&ap)); } int -vop_readdir(struct vnode *vp, struct uio *uio, - struct ucred *cred, int *eofflag, - int *ncookies, u_long **cookies) +vop_readdir(struct vop_ops *ops, struct vnode *vp, struct uio *uio, + struct ucred *cred, int *eofflag, int *ncookies, u_long **cookies) { struct vop_readdir_args ap; ap.a_head.a_desc = &vop_readdir_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_uio = uio; ap.a_cred = cred; ap.a_eofflag = eofflag; ap.a_ncookies = ncookies; ap.a_cookies = cookies; - return(vp->v_vops->vop_readdir(&ap)); + return(ops->vop_readdir(&ap)); } int -vop_readlink(struct vnode *vp, struct uio *uio, - struct ucred *cred) +vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio, + struct ucred *cred) { struct vop_readlink_args ap; ap.a_head.a_desc = &vop_readlink_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_uio = uio; ap.a_cred = cred; - return(vp->v_vops->vop_readlink(&ap)); + return(ops->vop_readlink(&ap)); } int -vop_inactive(struct vnode *vp, struct thread *td) +vop_inactive(struct vop_ops *ops, struct vnode *vp, struct thread *td) { struct vop_inactive_args ap; ap.a_head.a_desc = &vop_inactive_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_td = td; - return(vp->v_vops->vop_inactive(&ap)); + return(ops->vop_inactive(&ap)); } int -vop_reclaim(struct vnode *vp, struct thread *td) +vop_reclaim(struct vop_ops *ops, struct vnode *vp, struct thread *td) { struct vop_reclaim_args ap; ap.a_head.a_desc = &vop_reclaim_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_td = td; - return(vp->v_vops->vop_reclaim(&ap)); + return(ops->vop_reclaim(&ap)); } int -vop_lock(struct vnode *vp, struct lwkt_tokref *vlock, - int flags, struct thread *td) +vop_lock(struct vop_ops *ops, struct vnode *vp, struct lwkt_tokref *vlock, + int flags, struct thread *td) { struct vop_lock_args ap; ap.a_head.a_desc = &vop_lock_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_vlock = vlock; ap.a_flags = flags; ap.a_td = td; - return(vp->v_vops->vop_lock(&ap)); + return(ops->vop_lock(&ap)); } int -vop_unlock(struct vnode *vp, struct lwkt_tokref *vlock, - int flags, struct thread *td) +vop_unlock(struct vop_ops *ops, struct vnode *vp, struct lwkt_tokref *vlock, + int flags, struct thread *td) { struct vop_unlock_args ap; ap.a_head.a_desc = &vop_unlock_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_vlock = vlock; ap.a_flags = flags; ap.a_td = td; - return(vp->v_vops->vop_unlock(&ap)); + return(ops->vop_unlock(&ap)); } int -vop_bmap(struct vnode *vp, daddr_t bn, struct vnode **vpp, - daddr_t *bnp, int *runp, int *runb) +vop_bmap(struct vop_ops *ops, struct vnode *vp, daddr_t bn, struct vnode **vpp, + daddr_t *bnp, int *runp, int *runb) { struct vop_bmap_args ap; ap.a_head.a_desc = &vop_bmap_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_bn = bn; ap.a_vpp = vpp; ap.a_bnp = bnp; ap.a_runp = runp; ap.a_runb = runb; - return(vp->v_vops->vop_bmap(&ap)); + return(ops->vop_bmap(&ap)); } int -vop_strategy(struct vnode *vp, struct buf *bp) +vop_strategy(struct vop_ops *ops, struct vnode *vp, struct buf *bp) { struct vop_strategy_args ap; ap.a_head.a_desc = &vop_strategy_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_bp = bp; - return(vp->v_vops->vop_strategy(&ap)); + return(ops->vop_strategy(&ap)); } int -vop_print(struct vnode *vp) +vop_print(struct vop_ops *ops, struct vnode *vp) { struct vop_print_args ap; ap.a_head.a_desc = &vop_print_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; - return(vp->v_vops->vop_print(&ap)); + return(ops->vop_print(&ap)); } int -vop_pathconf(struct vnode *vp, int name, - register_t *retval) +vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name, + register_t *retval) { struct vop_pathconf_args ap; ap.a_head.a_desc = &vop_pathconf_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_name = name; ap.a_retval = retval; - return(vp->v_vops->vop_pathconf(&ap)); + return(ops->vop_pathconf(&ap)); } int -vop_advlock(struct vnode *vp, caddr_t id, int op, - struct flock *fl, int flags) +vop_advlock(struct vop_ops *ops, struct vnode *vp, caddr_t id, int op, + struct flock *fl, int flags) { struct vop_advlock_args ap; ap.a_head.a_desc = &vop_advlock_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_id = id; ap.a_op = op; ap.a_fl = fl; ap.a_flags = flags; - return(vp->v_vops->vop_advlock(&ap)); + return(ops->vop_advlock(&ap)); } int -vop_balloc(struct vnode *vp, off_t startoffset, - int size, struct ucred *cred, int flags, - struct buf **bpp) +vop_balloc(struct vop_ops *ops, struct vnode *vp, off_t startoffset, + int size, struct ucred *cred, int flags, + struct buf **bpp) { struct vop_balloc_args ap; ap.a_head.a_desc = &vop_balloc_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_startoffset = startoffset; ap.a_size = size; ap.a_cred = cred; ap.a_flags = flags; ap.a_bpp = bpp; - return(vp->v_vops->vop_balloc(&ap)); + return(ops->vop_balloc(&ap)); } int -vop_reallocblks(struct vnode *vp, - struct cluster_save *buflist) +vop_reallocblks(struct vop_ops *ops, struct vnode *vp, + struct cluster_save *buflist) { struct vop_reallocblks_args ap; ap.a_head.a_desc = &vop_reallocblks_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_buflist = buflist; - return(vp->v_vops->vop_reallocblks(&ap)); + return(ops->vop_reallocblks(&ap)); } int -vop_getpages(struct vnode *vp, vm_page_t *m, int count, - int reqpage, vm_ooffset_t offset) +vop_getpages(struct vop_ops *ops, struct vnode *vp, vm_page_t *m, int count, + int reqpage, vm_ooffset_t offset) { struct vop_getpages_args ap; ap.a_head.a_desc = &vop_getpages_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_m = m; ap.a_count = count; ap.a_reqpage = reqpage; ap.a_offset = offset; - return(vp->v_vops->vop_getpages(&ap)); + return(ops->vop_getpages(&ap)); } int -vop_putpages(struct vnode *vp, vm_page_t *m, int count, - int sync, int *rtvals, - vm_ooffset_t offset) +vop_putpages(struct vop_ops *ops, struct vnode *vp, vm_page_t *m, int count, + int sync, int *rtvals, vm_ooffset_t offset) { struct vop_putpages_args ap; ap.a_head.a_desc = &vop_putpages_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_m = m; ap.a_count = count; ap.a_sync = sync; ap.a_rtvals = rtvals; ap.a_offset = offset; - return(vp->v_vops->vop_putpages(&ap)); + return(ops->vop_putpages(&ap)); } int -vop_freeblks(struct vnode *vp, daddr_t addr, - daddr_t length) +vop_freeblks(struct vop_ops *ops, struct vnode *vp, + daddr_t addr, daddr_t length) { struct vop_freeblks_args ap; ap.a_head.a_desc = &vop_freeblks_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_addr = addr; ap.a_length = length; - return(vp->v_vops->vop_freeblks(&ap)); + return(ops->vop_freeblks(&ap)); } int -vop_bwrite(struct vnode *vp, struct buf *bp) +vop_bwrite(struct vop_ops *ops, struct vnode *vp, struct buf *bp) { struct vop_bwrite_args ap; ap.a_head.a_desc = &vop_bwrite_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_bp = bp; - return(vp->v_vops->vop_bwrite(&ap)); + return(ops->vop_bwrite(&ap)); } int -vop_getacl(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td) +vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type, + struct acl *aclp, struct ucred *cred, struct thread *td) { struct vop_getacl_args ap; ap.a_head.a_desc = &vop_getacl_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_type = type; ap.a_aclp = aclp; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_getacl(&ap)); + return(ops->vop_getacl(&ap)); } int -vop_setacl(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td) +vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type, + struct acl *aclp, struct ucred *cred, struct thread *td) { struct vop_setacl_args ap; ap.a_head.a_desc = &vop_setacl_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_type = type; ap.a_aclp = aclp; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_setacl(&ap)); + return(ops->vop_setacl(&ap)); } int -vop_aclcheck(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td) +vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type, + struct acl *aclp, struct ucred *cred, struct thread *td) { struct vop_aclcheck_args ap; ap.a_head.a_desc = &vop_aclcheck_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_type = type; ap.a_aclp = aclp; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_aclcheck(&ap)); + return(ops->vop_aclcheck(&ap)); } int -vop_getextattr(struct vnode *vp, char *name, - struct uio *uio, struct ucred *cred, - struct thread *td) +vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name, + struct uio *uio, struct ucred *cred, struct thread *td) { struct vop_getextattr_args ap; ap.a_head.a_desc = &vop_getextattr_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_name = name; ap.a_uio = uio; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_getextattr(&ap)); + return(ops->vop_getextattr(&ap)); } int -vop_setextattr(struct vnode *vp, char *name, - struct uio *uio, struct ucred *cred, - struct thread *td) +vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name, + struct uio *uio, struct ucred *cred, struct thread *td) { struct vop_setextattr_args ap; ap.a_head.a_desc = &vop_setextattr_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_name = name; ap.a_uio = uio; ap.a_cred = cred; ap.a_td = td; - return(vp->v_vops->vop_setextattr(&ap)); + return(ops->vop_setextattr(&ap)); } int -vop_createvobject(struct vnode *vp, struct thread *td) +vop_createvobject(struct vop_ops *ops, struct vnode *vp, struct thread *td) { struct vop_createvobject_args ap; ap.a_head.a_desc = &vop_createvobject_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_td = td; - return(vp->v_vops->vop_createvobject(&ap)); + return(ops->vop_createvobject(&ap)); } int -vop_destroyvobject(struct vnode *vp) +vop_destroyvobject(struct vop_ops *ops, struct vnode *vp) { struct vop_destroyvobject_args ap; ap.a_head.a_desc = &vop_destroyvobject_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; - return(vp->v_vops->vop_destroyvobject(&ap)); + return(ops->vop_destroyvobject(&ap)); } int -vop_getvobject(struct vnode *vp, struct vm_object **objpp) +vop_getvobject(struct vop_ops *ops, struct vnode *vp, struct vm_object **objpp) { struct vop_getvobject_args ap; ap.a_head.a_desc = &vop_getvobject_desc; + ap.a_head.a_ops = ops; ap.a_vp = vp; ap.a_objpp = objpp; - return(vp->v_vops->vop_getvobject(&ap)); + return(ops->vop_getvobject(&ap)); +} + +/************************************************************************ + * PRIMARY VNODE OPERATIONS FORWARDING CALLS * + ************************************************************************ + * + * These procedures are called from VFSs such as unionfs and nullfs + * when they wish to forward an operation on one VFS to another. The + * argument structure/message is modified and then directly passed to the + * appropriate routine. This routines may also be called by initiators + * who have an argument structure in hand rather then discreet arguments. + */ +int +vop_vnoperate_ap(struct vop_generic_args *ap) +{ + return (VOCALL(ap->a_ops, ap)); +} + +int +vop_islocked_ap(struct vop_islocked_args *ap) +{ + return(ap->a_head.a_ops->vop_islocked(ap)); +} + +int +vop_lookup_ap(struct vop_lookup_args *ap) +{ + return(ap->a_head.a_ops->vop_lookup(ap)); +} + +int +vop_cachedlookup_ap(struct vop_cachedlookup_args *ap) +{ + return(ap->a_head.a_ops->vop_cachedlookup(ap)); +} + +int +vop_create_ap(struct vop_create_args *ap) +{ + return(ap->a_head.a_ops->vop_create(ap)); +} + +int +vop_whiteout_ap(struct vop_whiteout_args *ap) +{ + return(ap->a_head.a_ops->vop_whiteout(ap)); +} + +int +vop_mknod_ap(struct vop_mknod_args *ap) +{ + return(ap->a_head.a_ops->vop_mknod(ap)); +} + +int +vop_open_ap(struct vop_open_args *ap) +{ + return(ap->a_head.a_ops->vop_open(ap)); +} + +int +vop_close_ap(struct vop_close_args *ap) +{ + return(ap->a_head.a_ops->vop_close(ap)); +} + +int +vop_access_ap(struct vop_access_args *ap) +{ + return(ap->a_head.a_ops->vop_access(ap)); +} + +int +vop_getattr_ap(struct vop_getattr_args *ap) +{ + return(ap->a_head.a_ops->vop_getattr(ap)); +} + +int +vop_setattr_ap(struct vop_setattr_args *ap) +{ + return(ap->a_head.a_ops->vop_setattr(ap)); +} + +int +vop_read_ap(struct vop_read_args *ap) +{ + return(ap->a_head.a_ops->vop_read(ap)); +} + +int +vop_write_ap(struct vop_write_args *ap) +{ + return(ap->a_head.a_ops->vop_write(ap)); +} + +int +vop_lease_ap(struct vop_lease_args *ap) +{ + return(ap->a_head.a_ops->vop_lease(ap)); +} + +int +vop_ioctl_ap(struct vop_ioctl_args *ap) +{ + return(ap->a_head.a_ops->vop_ioctl(ap)); +} + +int +vop_poll_ap(struct vop_poll_args *ap) +{ + return(ap->a_head.a_ops->vop_poll(ap)); +} + +int +vop_kqfilter_ap(struct vop_kqfilter_args *ap) +{ + return(ap->a_head.a_ops->vop_kqfilter(ap)); +} + +int +vop_revoke_ap(struct vop_revoke_args *ap) +{ + return(ap->a_head.a_ops->vop_revoke(ap)); +} + +int +vop_mmap_ap(struct vop_mmap_args *ap) +{ + return(ap->a_head.a_ops->vop_mmap(ap)); +} + +int +vop_fsync_ap(struct vop_fsync_args *ap) +{ + return(ap->a_head.a_ops->vop_fsync(ap)); +} + +int +vop_remove_ap(struct vop_remove_args *ap) +{ + return(ap->a_head.a_ops->vop_remove(ap)); +} + +int +vop_link_ap(struct vop_link_args *ap) +{ + return(ap->a_head.a_ops->vop_link(ap)); +} + +int +vop_rename_ap(struct vop_rename_args *ap) +{ + return(ap->a_head.a_ops->vop_rename(ap)); +} + +int +vop_mkdir_ap(struct vop_mkdir_args *ap) +{ + return(ap->a_head.a_ops->vop_mkdir(ap)); +} + +int +vop_rmdir_ap(struct vop_rmdir_args *ap) +{ + return(ap->a_head.a_ops->vop_rmdir(ap)); +} + +int +vop_symlink_ap(struct vop_symlink_args *ap) +{ + return(ap->a_head.a_ops->vop_symlink(ap)); +} + +int +vop_readdir_ap(struct vop_readdir_args *ap) +{ + return(ap->a_head.a_ops->vop_readdir(ap)); +} + +int +vop_readlink_ap(struct vop_readlink_args *ap) +{ + return(ap->a_head.a_ops->vop_readlink(ap)); +} + +int +vop_inactive_ap(struct vop_inactive_args *ap) +{ + return(ap->a_head.a_ops->vop_inactive(ap)); +} + +int +vop_reclaim_ap(struct vop_reclaim_args *ap) +{ + return(ap->a_head.a_ops->vop_reclaim(ap)); +} + +int +vop_lock_ap(struct vop_lock_args *ap) +{ + return(ap->a_head.a_ops->vop_lock(ap)); +} + +int +vop_unlock_ap(struct vop_unlock_args *ap) +{ + return(ap->a_head.a_ops->vop_unlock(ap)); +} + +int +vop_bmap_ap(struct vop_bmap_args *ap) +{ + return(ap->a_head.a_ops->vop_bmap(ap)); +} + +int +vop_strategy_ap(struct vop_strategy_args *ap) +{ + return(ap->a_head.a_ops->vop_strategy(ap)); +} + +int +vop_print_ap(struct vop_print_args *ap) +{ + return(ap->a_head.a_ops->vop_print(ap)); +} + +int +vop_pathconf_ap(struct vop_pathconf_args *ap) +{ + return(ap->a_head.a_ops->vop_pathconf(ap)); +} + +int +vop_advlock_ap(struct vop_advlock_args *ap) +{ + return(ap->a_head.a_ops->vop_advlock(ap)); +} + +int +vop_balloc_ap(struct vop_balloc_args *ap) +{ + return(ap->a_head.a_ops->vop_balloc(ap)); +} + +int +vop_reallocblks_ap(struct vop_reallocblks_args *ap) +{ + return(ap->a_head.a_ops->vop_reallocblks(ap)); +} + +int +vop_getpages_ap(struct vop_getpages_args *ap) +{ + return(ap->a_head.a_ops->vop_getpages(ap)); +} + +int +vop_putpages_ap(struct vop_putpages_args *ap) +{ + return(ap->a_head.a_ops->vop_putpages(ap)); +} + +int +vop_freeblks_ap(struct vop_freeblks_args *ap) +{ + return(ap->a_head.a_ops->vop_freeblks(ap)); +} + +int +vop_bwrite_ap(struct vop_bwrite_args *ap) +{ + return(ap->a_head.a_ops->vop_bwrite(ap)); +} + +int +vop_getacl_ap(struct vop_getacl_args *ap) +{ + return(ap->a_head.a_ops->vop_getacl(ap)); +} + +int +vop_setacl_ap(struct vop_setacl_args *ap) +{ + return(ap->a_head.a_ops->vop_setacl(ap)); +} + +int +vop_aclcheck_ap(struct vop_aclcheck_args *ap) +{ + return(ap->a_head.a_ops->vop_aclcheck(ap)); +} + +int +vop_getextattr_ap(struct vop_getextattr_args *ap) +{ + return(ap->a_head.a_ops->vop_getextattr(ap)); +} + +int +vop_setextattr_ap(struct vop_setextattr_args *ap) +{ + return(ap->a_head.a_ops->vop_setextattr(ap)); +} + +int +vop_createvobject_ap(struct vop_createvobject_args *ap) +{ + return(ap->a_head.a_ops->vop_createvobject(ap)); +} + +int +vop_destroyvobject_ap(struct vop_destroyvobject_args *ap) +{ + return(ap->a_head.a_ops->vop_destroyvobject(ap)); +} + +int +vop_getvobject_ap(struct vop_getvobject_args *ap) +{ + return(ap->a_head.a_ops->vop_getvobject(ap)); } diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 92e61bc784..ffb206b974 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -32,7 +32,7 @@ * * @(#)mount.h 8.21 (Berkeley) 5/20/95 * $FreeBSD: src/sys/sys/mount.h,v 1.89.2.7 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/sys/mount.h,v 1.11 2004/05/21 15:41:23 drhodus Exp $ + * $DragonFly: src/sys/sys/mount.h,v 1.12 2004/08/17 18:57:32 dillon Exp $ */ #ifndef _SYS_MOUNT_H_ @@ -52,6 +52,7 @@ #endif struct thread; +struct vop_ops; typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */ @@ -112,6 +113,13 @@ struct statfs { * list. Filesystem kld's syncing code should remain compatible since * they only need to scan the dirty vnode list (nvnodelist -> dirtyvnodelist). * + * NOTE: mnt_fsmanage structures. These structures are required by the new + * vnode operations vector abstraction. Each one contains its own operations + * vector which is registered just like VNODEOP_SET/vnodeopv_desc except it + * is done in the mount code rather then on vfs initialization. This + * structure is responsible for per-mount management, including vfs threading, + * journaling, and so forth. + * * NOTE: Any vnode marked VPLACEMARKER is a placemarker and should ALWAYS BE * SKIPPED. NO OTHER FIELDS IN SUCH VNODES ARE VALID. */ @@ -134,6 +142,9 @@ struct mount { u_int mnt_iosize_max; /* max IO request size */ struct vnodelst mnt_reservedvnlist; /* (future) dirty vnode list */ int mnt_nvnodelistsize; /* # of vnodes on this mount */ + struct vop_ops *mnt_vn_ops; /* for use by the VFS */ + struct vop_ops *mnt_vn_spec_ops; /* for use by the VFS */ + struct vop_ops *mnt_vn_fifo_ops; /* for use by the VFS */ }; #endif /* _KERNEL || _KERNEL_STRUCTURES */ diff --git a/sys/sys/vfscache.h b/sys/sys/vfscache.h new file mode 100644 index 0000000000..453df23b65 --- /dev/null +++ b/sys/sys/vfscache.h @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2004 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/sys/vfscache.h,v 1.1 2004/08/17 18:57:32 dillon Exp $ + */ +/* + * This module serves as a focal point for virtually all filesystem and + * device related calls. It is or will be responsible for all high level + * kernel management for filesystem and device operations, including but + * limited to: + * + * Function Status + * ---------------- ----- + * Journaling TODO + * Range Locking TODO + * Cache Coherency TODO + * VNode Operations Dispatch TODO + * Mount Point Operations TODO + * FileOps Operations TODO + */ + +#ifndef _SYS_VFSCACHE_H_ +#define _SYS_VFSCACHE_H_ + +#ifndef _SYS_VFSOPS_H_ +#include +#endif + +/* + * Vnode types. VNON means no type. + */ +enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; + +/* + * Vnode tag types. + * These are for the benefit of external programs only (e.g., pstat) + * and should NEVER be inspected by the kernel. + */ +enum vtagtype { + VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, + VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, + VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, + VT_HPFS, VT_NWFS, VT_SMBFS, VT_UDF +}; + +/* + * Vnode attributes. A field value of VNOVAL represents a field whose value + * is unavailable (getattr) or which is not to be changed (setattr). + */ +struct vattr { + enum vtype va_type; /* vnode type (for create) */ + u_short va_mode; /* files access mode and type */ + short va_nlink; /* number of references to file */ + uid_t va_uid; /* owner user id */ + gid_t va_gid; /* owner group id */ + udev_t va_fsid; /* file system id */ + long va_fileid; /* file id */ + u_quad_t va_size; /* file size in bytes */ + long va_blocksize; /* blocksize preferred for i/o */ + struct timespec va_atime; /* time of last access */ + struct timespec va_mtime; /* time of last modification */ + struct timespec va_ctime; /* time file changed */ + u_long va_gen; /* generation number of file */ + u_long va_flags; /* flags defined for file */ + udev_t va_rdev; /* device the special file represents */ + u_quad_t va_bytes; /* bytes of disk space held by file */ + u_quad_t va_filerev; /* file modification number */ + u_int va_vaflags; /* operations flags, see below */ + long va_spare; /* remain quad aligned */ +}; + +/* + * Flags for va_vaflags. + */ +#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ +#define VA_EXCLUSIVE 0x02 /* exclusive create request */ + +#if 0 /* NOT YET */ + +/* + * The vfscache structure holds the system cacheable elements associated with + * a file or device. This structure is most typically embedded within a + * vnode. + */ +struct vfscache { + int fc_flags; + struct vm_object *fc_object; /* cached data */ + struct vattr fc_attr; /* cached attribute data */ +}; + +#define FCF_ATTR_GOOD 0x00000001 /* FUTURE */ +#define FCF_ATTR_ATIME 0x00010000 /* FUTURE attr modifications */ +#define FCF_ATTR_MTIME 0x00020000 /* FUTURE attr modifications */ +#define FCF_ATTR_CTIME 0x00040000 /* FUTURE attr modifications */ +#define FCF_ATTR_UID 0x00080000 /* FUTURE attr modifications */ +#define FCF_ATTR_GID 0x00100000 /* FUTURE attr modifications */ +#define FCF_ATTR_SIZE 0x00200000 /* FUTURE attr modifications */ + +#endif + +#endif + diff --git a/sys/sys/vfsops.h b/sys/sys/vfsops.h index e1225f82e1..cb9519bae6 100644 --- a/sys/sys/vfsops.h +++ b/sys/sys/vfsops.h @@ -31,11 +31,11 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/sys/vfsops.h,v 1.1 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/sys/vfsops.h,v 1.2 2004/08/17 18:57:32 dillon Exp $ */ /* - * The vopops structure vectors all access to a filesystem. It contains a + * The vop_ops structure vectors all access to a filesystem. It contains a * fixed set of vectors which are 'compiled' by the vnodeopv_entry_desc * array that is typically declared in "vfs/blah/blah_vnops.c". * @@ -62,8 +62,12 @@ * conversion when it occurs. */ -#ifndef _SYS_VOPOPS_H_ -#define _SYS_VOPOPS_H_ +#ifndef _SYS_VFSOPS_H_ +#define _SYS_VFSOPS_H_ + +#ifndef _SYS_ACL_H_ +#include +#endif struct vnode; struct thread; @@ -75,9 +79,11 @@ struct uio; struct knote; struct vm_object; struct vm_page; +struct vfscache; struct vop_generic_args { struct vnodeop_desc *a_desc; + struct vop_ops *a_ops; }; struct vop_islocked_args { @@ -485,12 +491,26 @@ struct vop_getvobject_args { }; /* - * This structure is the post-compiled VOP operations vector and should only - * be used by kern/vfs_vopops.c. + * This structure is the post-compiled VOP operations vector. vop_ops are + * typically per-mount entities. The first section is used by our vop_*() + * function wrappers to implement hooks for per-mount management functions + * such as journaling and cache coherency protocols. The second section is + * the function dispatch for the VFSs. The functions are supposed to run + * in the context of the VFS's thread (if it has one) and should not be + * directly called from random kernel code. Note that VOCALL()s are direct + * calls used for chaining vop_ops structures from a VFS context. */ struct vop_ops { - int vv_refs; - struct vop_ops *vv_new; + struct vop_ops *vv_new; /* vfs_recalc_vnodeops() only */ + struct mount *vv_mount; /* may be NULL */ + int vv_refs; + int vv_flags; /* see VVF_* flags below */ + + /* XXX Journaling control */ + /* XXX Cache Coherency functions (local/remote/clustered) */ + /* XXX Other */ + int vv_reserved[64]; /* (temporary) reduce recompile pain */ + #define vop_ops_first_field vop_default int (*vop_default)(struct vop_generic_args *); int (*vop_islocked)(struct vop_islocked_args *); @@ -547,6 +567,17 @@ struct vop_ops { #define vop_ops_last_field vop_getvobject }; +#define VVF_JOURNAL_HOOK 0x0001 /* FUTURE */ +#define VVF_CCOHERENCY_HOOK 0x0002 /* FUTURE */ +#define VVF_UNUSED_04 0x0004 +#define VVF_UNUSED_08 0x0008 +#define VVF_NOATIME 0x0010 /* FUTURE */ +#define VVF_RDONLY 0x0020 /* FUTURE */ +#define VVF_NOCLUSTER 0x0040 /* FUTURE */ +#define VVF_SUIDDIR 0x0080 /* FUTURE */ + +#define VFF_HOOK_MASK (VFF_JOURNAL_HOOK|VFF_CCOHERENCY_HOOK) + /* * Kernel VOP arguments union, suitable for malloc / embedding in other * structures. The vop_args_union can hold any VOP call argument structure. @@ -618,115 +649,175 @@ union vop_args_union { * routine directly in order to allow DragonFly to properly wrap the operation * in a message and dispatch it to the correct thread. */ -int vop_islocked(struct vnode *vp, struct thread *td); -int vop_lookup(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct namecache **ncpp, - struct componentname *cnp); -int vop_cachedlookup(struct vnode *dvp, struct namecache *par, +int vop_islocked(struct vop_ops *ops, struct vnode *vp, struct thread *td); +int vop_lookup(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode **vpp, struct namecache **ncpp, struct componentname *cnp); -int vop_create(struct vnode *dvp, struct namecache *par, +int vop_cachedlookup(struct vop_ops *ops, struct vnode *dvp, + struct namecache *par, struct vnode **vpp, + struct namecache **ncpp, struct componentname *cnp); +int vop_create(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode **vpp, struct componentname *cnp, struct vattr *vap); -int vop_whiteout(struct vnode *dvp, struct namecache *par, +int vop_whiteout(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct componentname *cnp, int flags); -int vop_mknod(struct vnode *dvp, struct namecache *par, +int vop_mknod(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode **vpp, struct componentname *cnp, struct vattr *vap); -int vop_open(struct vnode *vp, int mode, struct ucred *cred, - struct thread *td); -int vop_close(struct vnode *vp, int fflag, struct thread *td); -int vop_access(struct vnode *vp, int mode, struct ucred *cred, - struct thread *td); -int vop_getattr(struct vnode *vp, struct vattr *vap, +int vop_open(struct vop_ops *ops, struct vnode *vp, int mode, + struct ucred *cred, struct thread *td); +int vop_close(struct vop_ops *ops, struct vnode *vp, + int fflag, struct thread *td); +int vop_access(struct vop_ops *ops, struct vnode *vp, int mode, + struct ucred *cred, struct thread *td); +int vop_getattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap, struct thread *td); -int vop_setattr(struct vnode *vp, struct vattr *vap, +int vop_setattr(struct vop_ops *ops, struct vnode *vp, struct vattr *vap, struct ucred *cred, struct thread *td); -int vop_read(struct vnode *vp, struct uio *uio, int ioflag, - struct ucred *cred); -int vop_write(struct vnode *vp, struct uio *uio, int ioflag, - struct ucred *cred); -int vop_lease(struct vnode *vp, struct thread *td, +int vop_read(struct vop_ops *ops, struct vnode *vp, struct uio *uio, + int ioflag, struct ucred *cred); +int vop_write(struct vop_ops *ops, struct vnode *vp, struct uio *uio, + int ioflag, struct ucred *cred); +int vop_lease(struct vop_ops *ops, struct vnode *vp, struct thread *td, struct ucred *cred, int flag); -int vop_ioctl(struct vnode *vp, u_long command, caddr_t data, - int fflag, struct ucred *cred, - struct thread *td); -int vop_poll(struct vnode *vp, int events, struct ucred *cred, - struct thread *td); -int vop_kqfilter(struct vnode *vp, struct knote *kn); -int vop_revoke(struct vnode *vp, int flags); -int vop_mmap(struct vnode *vp, int fflags, struct ucred *cred, +int vop_ioctl(struct vop_ops *ops, struct vnode *vp, u_long command, + caddr_t data, int fflag, + struct ucred *cred, struct thread *td); +int vop_poll(struct vop_ops *ops, struct vnode *vp, int events, + struct ucred *cred, struct thread *td); +int vop_kqfilter(struct vop_ops *ops, struct vnode *vp, struct knote *kn); +int vop_revoke(struct vop_ops *ops, struct vnode *vp, int flags); +int vop_mmap(struct vop_ops *ops, struct vnode *vp, int fflags, + struct ucred *cred, struct thread *td); +int vop_fsync(struct vop_ops *ops, struct vnode *vp, int waitfor, struct thread *td); -int vop_fsync(struct vnode *vp, int waitfor, struct thread *td); -int vop_remove(struct vnode *dvp, struct namecache *par, +int vop_remove(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode *vp, struct componentname *cnp); -int vop_link(struct vnode *tdvp, struct namecache *par, +int vop_link(struct vop_ops *ops, struct vnode *tdvp, struct namecache *par, struct vnode *vp, struct componentname *cnp); -int vop_rename(struct vnode *fdvp, struct namecache *fpar, +int vop_rename(struct vop_ops *ops, struct vnode *fdvp, struct namecache *fpar, struct vnode *fvp, struct componentname *fcnp, struct vnode *tdvp, struct namecache *tpar, struct vnode *tvp, struct componentname *tcnp); -int vop_mkdir(struct vnode *dvp, struct namecache *par, +int vop_mkdir(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode **vpp, struct componentname *cnp, struct vattr *vap); -int vop_rmdir(struct vnode *dvp, struct namecache *par, +int vop_rmdir(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode *vp, struct componentname *cnp); -int vop_symlink(struct vnode *dvp, struct namecache *par, +int vop_symlink(struct vop_ops *ops, struct vnode *dvp, struct namecache *par, struct vnode **vpp, struct componentname *cnp, struct vattr *vap, char *target); -int vop_readdir(struct vnode *vp, struct uio *uio, +int vop_readdir(struct vop_ops *ops, struct vnode *vp, struct uio *uio, struct ucred *cred, int *eofflag, int *ncookies, u_long **cookies); -int vop_readlink(struct vnode *vp, struct uio *uio, +int vop_readlink(struct vop_ops *ops, struct vnode *vp, struct uio *uio, struct ucred *cred); -int vop_inactive(struct vnode *vp, struct thread *td); -int vop_reclaim(struct vnode *vp, struct thread *td); -int vop_lock(struct vnode *vp, struct lwkt_tokref *vlock, - int flags, struct thread *td); -int vop_unlock(struct vnode *vp, struct lwkt_tokref *vlock, - int flags, struct thread *td); -int vop_bmap(struct vnode *vp, daddr_t bn, struct vnode **vpp, - daddr_t *bnp, int *runp, int *runb); -int vop_strategy(struct vnode *vp, struct buf *bp); -int vop_print(struct vnode *vp); -int vop_pathconf(struct vnode *vp, int name, +int vop_inactive(struct vop_ops *ops, struct vnode *vp, struct thread *td); +int vop_reclaim(struct vop_ops *ops, struct vnode *vp, struct thread *td); +int vop_lock(struct vop_ops *ops, struct vnode *vp, + struct lwkt_tokref *vlock, int flags, struct thread *td); +int vop_unlock(struct vop_ops *ops, struct vnode *vp, + struct lwkt_tokref *vlock, int flags, struct thread *td); +int vop_bmap(struct vop_ops *ops, struct vnode *vp, daddr_t bn, + struct vnode **vpp, daddr_t *bnp, int *runp, int *runb); +int vop_strategy(struct vop_ops *ops, struct vnode *vp, struct buf *bp); +int vop_print(struct vop_ops *ops, struct vnode *vp); +int vop_pathconf(struct vop_ops *ops, struct vnode *vp, int name, register_t *retval); -int vop_advlock(struct vnode *vp, caddr_t id, int op, +int vop_advlock(struct vop_ops *ops, struct vnode *vp, caddr_t id, int op, struct flock *fl, int flags); -int vop_balloc(struct vnode *vp, off_t startoffset, +int vop_balloc(struct vop_ops *ops, struct vnode *vp, off_t startoffset, int size, struct ucred *cred, int flags, struct buf **bpp); -int vop_reallocblks(struct vnode *vp, +int vop_reallocblks(struct vop_ops *ops, struct vnode *vp, struct cluster_save *buflist); -int vop_getpages(struct vnode *vp, struct vm_page **m, int count, - int reqpage, vm_ooffset_t offset); -int vop_putpages(struct vnode *vp, struct vm_page **m, int count, - int sync, int *rtvals, - vm_ooffset_t offset); -int vop_freeblks(struct vnode *vp, daddr_t addr, - daddr_t length); -int vop_bwrite(struct vnode *vp, struct buf *bp); -int vop_getacl(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td); -int vop_setacl(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td); -int vop_aclcheck(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td); -int vop_getextattr(struct vnode *vp, char *name, - struct uio *uio, struct ucred *cred, - struct thread *td); -int vop_setextattr(struct vnode *vp, char *name, - struct uio *uio, struct ucred *cred, - struct thread *td); -int vop_createvobject(struct vnode *vp, struct thread *td); -int vop_destroyvobject(struct vnode *vp); -int vop_getvobject(struct vnode *vp, struct vm_object **objpp); +int vop_getpages(struct vop_ops *ops, struct vnode *vp, struct vm_page **m, + int count, int reqpage, vm_ooffset_t offset); +int vop_putpages(struct vop_ops *ops, struct vnode *vp, struct vm_page **m, + int count, int sync, int *rtvals, vm_ooffset_t offset); +int vop_freeblks(struct vop_ops *ops, struct vnode *vp, + daddr_t addr, daddr_t length); +int vop_bwrite(struct vop_ops *ops, struct vnode *vp, struct buf *bp); +int vop_getacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type, + struct acl *aclp, struct ucred *cred, struct thread *td); +int vop_setacl(struct vop_ops *ops, struct vnode *vp, acl_type_t type, + struct acl *aclp, struct ucred *cred, struct thread *td); +int vop_aclcheck(struct vop_ops *ops, struct vnode *vp, acl_type_t type, + struct acl *aclp, struct ucred *cred, struct thread *td); +int vop_getextattr(struct vop_ops *ops, struct vnode *vp, char *name, + struct uio *uio, struct ucred *cred, struct thread *td); +int vop_setextattr(struct vop_ops *ops, struct vnode *vp, char *name, + struct uio *uio, struct ucred *cred, struct thread *td); +int vop_createvobject(struct vop_ops *ops, + struct vnode *vp, struct thread *td); +int vop_destroyvobject(struct vop_ops *ops, struct vnode *vp); +int vop_getvobject(struct vop_ops *ops, + struct vnode *vp, struct vm_object **objpp); + +/* + * Kernel VOP forwarding wrappers. These are called when a VFS such as + * nullfs or unionfs needs to push down into another VFS, changing the + * a_ops pointer and consequentially necessitating additional + * cache management. + * + * Note that this is different from vop_ops chaining within the same + * filesystem. When a filesystem chains a vop_ops it just uses VOCALLs. + */ +int vop_vnoperate_ap(struct vop_generic_args *ap); +int vop_islocked_ap(struct vop_islocked_args *ap); +int vop_lookup_ap(struct vop_lookup_args *ap); +int vop_cachedlookup_ap(struct vop_cachedlookup_args *ap); +int vop_create_ap(struct vop_create_args *ap); +int vop_whiteout_ap(struct vop_whiteout_args *ap); +int vop_mknod_ap(struct vop_mknod_args *ap); +int vop_open_ap(struct vop_open_args *ap); +int vop_close_ap(struct vop_close_args *ap); +int vop_access_ap(struct vop_access_args *ap); +int vop_getattr_ap(struct vop_getattr_args *ap); +int vop_setattr_ap(struct vop_setattr_args *ap); +int vop_read_ap(struct vop_read_args *ap); +int vop_write_ap(struct vop_write_args *ap); +int vop_lease_ap(struct vop_lease_args *ap); +int vop_ioctl_ap(struct vop_ioctl_args *ap); +int vop_poll_ap(struct vop_poll_args *ap); +int vop_kqfilter_ap(struct vop_kqfilter_args *ap); +int vop_revoke_ap(struct vop_revoke_args *ap); +int vop_mmap_ap(struct vop_mmap_args *ap); +int vop_fsync_ap(struct vop_fsync_args *ap); +int vop_remove_ap(struct vop_remove_args *ap); +int vop_link_ap(struct vop_link_args *ap); +int vop_rename_ap(struct vop_rename_args *ap); +int vop_mkdir_ap(struct vop_mkdir_args *ap); +int vop_rmdir_ap(struct vop_rmdir_args *ap); +int vop_symlink_ap(struct vop_symlink_args *ap); +int vop_readdir_ap(struct vop_readdir_args *ap); +int vop_readlink_ap(struct vop_readlink_args *ap); +int vop_inactive_ap(struct vop_inactive_args *ap); +int vop_reclaim_ap(struct vop_reclaim_args *ap); +int vop_lock_ap(struct vop_lock_args *ap); +int vop_unlock_ap(struct vop_unlock_args *ap); +int vop_bmap_ap(struct vop_bmap_args *ap); +int vop_strategy_ap(struct vop_strategy_args *ap); +int vop_print_ap(struct vop_print_args *ap); +int vop_pathconf_ap(struct vop_pathconf_args *ap); +int vop_advlock_ap(struct vop_advlock_args *ap); +int vop_balloc_ap(struct vop_balloc_args *ap); +int vop_reallocblks_ap(struct vop_reallocblks_args *ap); +int vop_getpages_ap(struct vop_getpages_args *ap); +int vop_putpages_ap(struct vop_putpages_args *ap); +int vop_freeblks_ap(struct vop_freeblks_args *ap); +int vop_bwrite_ap(struct vop_bwrite_args *ap); +int vop_getacl_ap(struct vop_getacl_args *ap); +int vop_setacl_ap(struct vop_setacl_args *ap); +int vop_aclcheck_ap(struct vop_aclcheck_args *ap); +int vop_getextattr_ap(struct vop_getextattr_args *ap); +int vop_setextattr_ap(struct vop_setextattr_args *ap); +int vop_createvobject_ap(struct vop_createvobject_args *ap); +int vop_destroyvobject_ap(struct vop_destroyvobject_args *ap); +int vop_getvobject_ap(struct vop_getvobject_args *ap); /* - * VOP operations descriptor. This is used by the vopops compiler + * VOP operations descriptor. This is used by the vop_ops compiler * to convert VFS vector arrays (typically in vfs/blah/blah_vnops.c) * into a vop_ops operations vector. */ @@ -787,109 +878,111 @@ extern struct vnodeop_desc vop_getvobject_desc; /* * VOP_ macro compatibility. Remove these as we get rid of the VOP macros. + * We have to convert the VOP macros into the vop_*() version that requires + * the appropriate v_ops structure pointer for the first arg. */ #define VOP_ISLOCKED(vp, td) \ - vop_islocked(vp, td) + vop_islocked((vp)->v_ops, vp, td) #define VOP_LOOKUP(dvp, par, vpp, ncpp, cnp) \ - vop_lookup(dvp, par, vpp, ncpp, cnp) + vop_lookup((dvp)->v_ops, dvp, par, vpp, ncpp, cnp) #define VOP_CACHEDLOOKUP(dvp, par, vpp, ncpp, cnp) \ - vop_cachedlookup(dvp, par, vpp, ncpp, cnp) + vop_cachedlookup((dvp)->v_ops, dvp, par, vpp, ncpp, cnp) #define VOP_CREATE(dvp, par, vpp, cnp, vap) \ - vop_create(dvp, par, vpp, cnp, vap) + vop_create((dvp)->v_ops, dvp, par, vpp, cnp, vap) #define VOP_WHITEOUT(dvp, par, cnp, flags) \ - vop_whiteout(dvp, par, cnp, flags) + vop_whiteout((dvp)->v_ops, dvp, par, cnp, flags) #define VOP_MKNOD(dvp, par, vpp, cnp, vap) \ - vop_mknod(dvp, par, vpp, cnp, vap) + vop_mknod((dvp)->v_ops, dvp, par, vpp, cnp, vap) #define VOP_OPEN(vp, mode, cred, td) \ - vop_open(vp, mode, cred, td) + vop_open((vp)->v_ops, vp, mode, cred, td) #define VOP_CLOSE(vp, fflag, td) \ - vop_close(vp, fflag, td) + vop_close((vp)->v_ops, vp, fflag, td) #define VOP_ACCESS(vp, mode, cred, td) \ - vop_access(vp, mode, cred, td) + vop_access((vp)->v_ops, vp, mode, cred, td) #define VOP_GETATTR(vp, vap, td) \ - vop_getattr(vp, vap, td) + vop_getattr((vp)->v_ops, vp, vap, td) #define VOP_SETATTR(vp, vap, cred, td) \ - vop_setattr(vp, vap, cred, td) + vop_setattr((vp)->v_ops, vp, vap, cred, td) #define VOP_READ(vp, uio, ioflag, cred) \ - vop_read(vp, uio, ioflag, cred) + vop_read((vp)->v_ops, vp, uio, ioflag, cred) #define VOP_WRITE(vp, uio, ioflag, cred) \ - vop_write(vp, uio, ioflag, cred) + vop_write((vp)->v_ops, vp, uio, ioflag, cred) #define VOP_LEASE(vp, td, cred, flag) \ - vop_lease(vp, td, cred, flag) + vop_lease((vp)->v_ops, vp, td, cred, flag) #define VOP_IOCTL(vp, command, data, fflag, cred, td) \ - vop_ioctl(vp, command, data, fflag, cred, td) + vop_ioctl((vp)->v_ops, vp, command, data, fflag, cred, td) #define VOP_POLL(vp, events, cred, td) \ - vop_poll(vp, events, cred, td) + vop_poll((vp)->v_ops, vp, events, cred, td) #define VOP_KQFILTER(vp, kn) \ - vop_kqfilter(vp, kn) + vop_kqfilter((vp)->v_ops, vp, kn) #define VOP_REVOKE(vp, flags) \ - vop_revoke(vp, flags) + vop_revoke((vp)->v_ops, vp, flags) #define VOP_MMAP(vp, fflags, cred, td) \ - vop_mmap(vp, fflags, cred, td) + vop_mmap((vp)->v_ops, vp, fflags, cred, td) #define VOP_FSYNC(vp, waitfor, td) \ - vop_fsync(vp, waitfor, td) + vop_fsync((vp)->v_ops, vp, waitfor, td) #define VOP_REMOVE(dvp, par, vp, cnp) \ - vop_remove(dvp, par, vp, cnp) + vop_remove((dvp)->v_ops, dvp, par, vp, cnp) #define VOP_LINK(tdvp, par, vp, cnp) \ - vop_link(tdvp, par, vp, cnp) + vop_link((tdvp)->v_ops, tdvp, par, vp, cnp) #define VOP_RENAME(fdvp, fpar, fvp, fcnp, tdvp, tpar, tvp, tcnp) \ - vop_rename(fdvp, fpar, fvp, fcnp, tdvp, tpar, tvp, tcnp) + vop_rename((fdvp)->v_ops, fdvp, fpar, fvp, fcnp, tdvp, tpar, tvp, tcnp) #define VOP_MKDIR(dvp, par, vpp, cnp, vap) \ - vop_mkdir(dvp, par, vpp, cnp, vap) + vop_mkdir((dvp)->v_ops, dvp, par, vpp, cnp, vap) #define VOP_RMDIR(dvp, par, vp, cnp) \ - vop_rmdir(dvp, par, vp, cnp) + vop_rmdir((dvp)->v_ops, dvp, par, vp, cnp) #define VOP_SYMLINK(dvp, par, vpp, cnp, vap, target) \ - vop_symlink(dvp, par, vpp, cnp, vap, target) + vop_symlink((dvp)->v_ops, dvp, par, vpp, cnp, vap, target) #define VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies) \ - vop_readdir(vp, uio, cred, eofflag, ncookies, cookies) + vop_readdir((vp)->v_ops, vp, uio, cred, eofflag, ncookies, cookies) #define VOP_READLINK(vp, uio, cred) \ - vop_readlink(vp, uio, cred) + vop_readlink((vp)->v_ops, vp, uio, cred) #define VOP_INACTIVE(vp, td) \ - vop_inactive(vp, td) + vop_inactive((vp)->v_ops, vp, td) #define VOP_RECLAIM(vp, td) \ - vop_reclaim(vp, td) + vop_reclaim((vp)->v_ops, vp, td) #define VOP_LOCK(vp, vlock, flags, td) \ - vop_lock(vp, vlock, flags, td) + vop_lock((vp)->v_ops, vp, vlock, flags, td) #define VOP_UNLOCK(vp, vlock, flags, td) \ - vop_unlock(vp, vlock, flags, td) + vop_unlock((vp)->v_ops, vp, vlock, flags, td) #define VOP_BMAP(vp, bn, vpp, bnp, runp, runb) \ - vop_bmap(vp, bn, vpp, bnp, runp, runb) + vop_bmap((vp)->v_ops, vp, bn, vpp, bnp, runp, runb) #define VOP_STRATEGY(vp, bp) \ - vop_strategy(vp, bp) + vop_strategy((vp)->v_ops, vp, bp) #define VOP_PRINT(vp) \ - vop_print(vp) + vop_print((vp)->v_ops, vp) #define VOP_PATHCONF(vp, name, retval) \ - vop_pathconf(vp, name, retval) + vop_pathconf((vp)->v_ops, vp, name, retval) #define VOP_ADVLOCK(vp, id, op, fl, flags) \ - vop_advlock(vp, id, op, fl, flags) + vop_advlock((vp)->v_ops, vp, id, op, fl, flags) #define VOP_BALLOC(vp, offset, size, cred, flags, bpp) \ - vop_balloc(vp, offset, size, cred, flags, bpp) + vop_balloc((vp)->v_ops, vp, offset, size, cred, flags, bpp) #define VOP_REALLOCBLKS(vp, buflist) \ - vop_reallocblks(vp, buflist) + vop_reallocblks((vp)->v_ops, vp, buflist) #define VOP_GETPAGES(vp, m, count, reqpage, off) \ - vop_getpages(vp, m, count, reqpage, off) + vop_getpages((vp)->v_ops, vp, m, count, reqpage, off) #define VOP_PUTPAGES(vp, m, count, sync, rtvals, off) \ - vop_putpages(vp, m, count, sync, rtvals, off) + vop_putpages((vp)->v_ops, vp, m, count, sync, rtvals, off) #define VOP_FREEBLKS(vp, addr, length) \ - vop_freeblks(vp, addr, length) + vop_freeblks((vp)->v_ops, vp, addr, length) #define VOP_BWRITE(vp, bp) \ - vop_bwrite(vp, bp) + vop_bwrite((vp)->v_ops, vp, bp) #define VOP_GETACL(vp, type, aclp, cred, td) \ - vop_getacl(vp, type, aclp, cred, td) + vop_getacl((vp)->v_ops, vp, type, aclp, cred, td) #define VOP_SETACL(vp, type, aclp, cred, td) \ - vop_setacl(vp, type, aclp, cred, td) + vop_setacl((vp)->v_ops, vp, type, aclp, cred, td) #define VOP_ACLCHECK(vp, type, aclp, cred, td) \ - vop_aclcheck(vp, type, aclp, cred, td) + vop_aclcheck((vp)->v_ops, vp, type, aclp, cred, td) #define VOP_GETEXTATTR(vp, name, uio, cred, td) \ - vop_getextattr(vp, name, uio, cred, td) + vop_getextattr((vp)->v_ops, vp, name, uio, cred, td) #define VOP_SETEXTATTR(vp, name, uio, cred, td) \ - vop_setextattr(vp, name, uio, cred, td) + vop_setextattr((vp)->v_ops, vp, name, uio, cred, td) #define VOP_CREATEVOBJECT(vp, td) \ - vop_createvobject(vp, td) + vop_createvobject((vp)->v_ops, vp, td) #define VOP_DESTROYVOBJECT(vp) \ - vop_destroyvobject(vp) + vop_destroyvobject((vp)->v_ops, vp) #define VOP_GETVOBJECT(vp, objpp) \ - vop_getvobject(vp, objpp) + vop_getvobject((vp)->v_ops, vp, objpp) #endif diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 7071dc5d06..4dc06bdf4d 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -32,7 +32,7 @@ * * @(#)vnode.h 8.7 (Berkeley) 2/4/94 * $FreeBSD: src/sys/sys/vnode.h,v 1.111.2.19 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/sys/vnode.h,v 1.19 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/sys/vnode.h,v 1.20 2004/08/17 18:57:32 dillon Exp $ */ #ifndef _SYS_VNODE_H_ @@ -47,7 +47,8 @@ #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES) #include #endif -#include +#include +#include #include @@ -57,29 +58,13 @@ * each mounted-on file, text file, and the root. */ -/* - * Vnode types. VNON means no type. - */ -enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; - -/* - * Vnode tag types. - * These are for the benefit of external programs only (e.g., pstat) - * and should NEVER be inspected by the kernel. - */ -enum vtagtype { - VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, - VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, - VT_HPFS, VT_NWFS, VT_SMBFS, VT_UDF -}; - /* * Each underlying filesystem allocates its own private area and hangs * it from v_data. If non-null, this area is freed in getnewvnode(). */ TAILQ_HEAD(buflists, buf); + /* * Reading or writing any of these items requires holding the appropriate lock. * v_freelist is locked by the global vnode_free_list token. @@ -91,6 +76,7 @@ TAILQ_HEAD(buflists, buf); * XXX note: v_opencount currently only used by specfs. It should be used * universally. */ + struct vnode { u_long v_flag; /* vnode flags (see below) */ int v_usecount; /* reference count of users */ @@ -99,7 +85,7 @@ struct vnode { int v_opencount; /* number of explicit opens */ u_long v_id; /* capability identifier */ struct mount *v_mount; /* ptr to vfs we are in */ - struct vop_ops *v_vops; + struct vop_ops *v_ops; /* mount, vops, other things */ TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */ TAILQ_ENTRY(vnode) v_nmntvnodes; /* vnodes for mount point */ struct buflists v_cleanblkhd; /* clean blocklist head */ @@ -179,38 +165,6 @@ struct vnode { #define VOBJDIRTY 0x800000 /* object might be dirty */ #define VPLACEMARKER 0x1000000 /* dummy vnode placemarker */ -/* - * Vnode attributes. A field value of VNOVAL represents a field whose value - * is unavailable (getattr) or which is not to be changed (setattr). - */ -struct vattr { - enum vtype va_type; /* vnode type (for create) */ - u_short va_mode; /* files access mode and type */ - short va_nlink; /* number of references to file */ - uid_t va_uid; /* owner user id */ - gid_t va_gid; /* owner group id */ - udev_t va_fsid; /* file system id */ - long va_fileid; /* file id */ - u_quad_t va_size; /* file size in bytes */ - long va_blocksize; /* blocksize preferred for i/o */ - struct timespec va_atime; /* time of last access */ - struct timespec va_mtime; /* time of last modification */ - struct timespec va_ctime; /* time file changed */ - u_long va_gen; /* generation number of file */ - u_long va_flags; /* flags defined for file */ - udev_t va_rdev; /* device the special file represents */ - u_quad_t va_bytes; /* bytes of disk space held by file */ - u_quad_t va_filerev; /* file modification number */ - u_int va_vaflags; /* operations flags, see below */ - long va_spare; /* remain quad aligned */ -}; - -/* - * Flags for va_vaflags. - */ -#define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ -#define VA_EXCLUSIVE 0x02 /* exclusive create request */ - /* * Flags for ioflag. (high 16 bits used to ask for read-ahead and * help with write clustering) @@ -285,8 +239,8 @@ extern int vttoif_tab[]; #define NULLVP ((struct vnode *)NULL) #define VNODEOP_SET(f) \ - C_SYSINIT(f##init, SI_SUB_VFS, SI_ORDER_SECOND, vfs_add_vnodeops, &f); \ - C_SYSUNINIT(f##uninit, SI_SUB_VFS, SI_ORDER_SECOND, vfs_rm_vnodeops, &f); + C_SYSINIT(f##init, SI_SUB_VFS, SI_ORDER_SECOND, vfs_add_vnodeops_sysinit, &f); \ + C_SYSUNINIT(f##uninit, SI_SUB_VFS, SI_ORDER_SECOND,vfs_rm_vnodeops_sysinit, &f); /* * Global vnode data. @@ -402,7 +356,8 @@ struct vnodeopv_desc { struct vnodeopv_node { TAILQ_ENTRY(vnodeopv_node) entry; - const struct vnodeopv_desc *vdesc; + struct vop_ops *ops; /* allocated vector */ + struct vnodeopv_entry_desc *descs; /* null terminated list */ }; #ifdef DEBUG_VFS_LOCKS @@ -476,12 +431,16 @@ void assert_vop_unlocked(struct vnode *vp, const char *str); typedef int (*vocall_func_t)(struct vop_generic_args *); -#define VOCALL(vops,off,ap) (*(vocall_func_t *)((char *)(vops)+(off)))(ap) - /* - * This call works for vnodes in the kernel. + * This call executes the vops vector for the offset stored in the ap's + * descriptor of the passed vops rather then the one related to the + * ap's vop_ops structure. It is used to chain VOPS calls on behalf of + * filesystems from a VFS's context ONLY (that is, from a VFS's own vops + * vector function). */ -#define VCALL(VP,OFF,AP) VOCALL((VP)->v_vops,(OFF),(AP)) +#define VOCALL(vops, ap) \ + (*(vocall_func_t *)((char *)(vops)+((ap)->a_desc->vdesc_offset)))(ap) + #define VDESC(OP) (& __CONCAT(OP,_desc)) #define VOFFSET(OP) (VDESC(OP)->vdesc_offset) @@ -525,7 +484,7 @@ int bdevvp (dev_t dev, struct vnode **vpp); void cvtstat (struct stat *st, struct ostat *ost); void cvtnstat (struct stat *sb, struct nstat *nsb); int getnewvnode (enum vtagtype tag, - struct mount *mp, struct vop_ops *vops, struct vnode **vpp); + struct mount *mp, struct vop_ops *ops, struct vnode **vpp); int lease_check (struct vop_lease_args *ap); int spec_vnoperate (struct vop_generic_args *); int speedup_syncer (void); @@ -533,8 +492,10 @@ void vattr_null (struct vattr *vap); int vcount (struct vnode *vp); void vdrop (struct vnode *); int vfinddev (dev_t dev, enum vtype type, struct vnode **vpp); -void vfs_add_vnodeops (const void *); -void vfs_rm_vnodeops (const void *); +void vfs_add_vnodeops_sysinit (const void *); +void vfs_rm_vnodeops_sysinit (const void *); +void vfs_add_vnodeops(struct vop_ops **, struct vnodeopv_entry_desc *); +void vfs_rm_vnodeops(struct vop_ops **); int vflush (struct mount *mp, int rootrefs, int flags); int vmntvnodescan(struct mount *mp, int (*fastfunc)(struct mount *mp, struct vnode *vp, void *data), @@ -606,6 +567,7 @@ void vref (struct vnode *vp); extern struct vop_ops *default_vnode_vops; extern struct vop_ops *spec_vnode_vops; +extern struct vop_ops *dead_vnode_vops; #endif /* _KERNEL */ diff --git a/sys/sys/vopops.h b/sys/sys/vopops.h deleted file mode 100644 index 81e48e4fab..0000000000 --- a/sys/sys/vopops.h +++ /dev/null @@ -1,895 +0,0 @@ -/* - * Copyright (c) 2004 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Matthew Dillon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $DragonFly: src/sys/sys/Attic/vopops.h,v 1.1 2004/08/13 17:51:10 dillon Exp $ - */ - -/* - * The vopops structure vectors all access to a filesystem. It contains a - * fixed set of vectors which are 'compiled' by the vnodeopv_entry_desc - * array that is typically declared in "vfs/blah/blah_vnops.c". - * - * In DragonFly the ultimate goal is to thread the VFS, which means that - * the dispatch functions will eventually be called from the context of - * a management thread rather then directly called by a process. This - * requires us to divorce direct process dependancies (in particular ioctl - * and UIO's). In addition, it is our intention to implement kernel - * level cache management and coherency in the vop_*() interfacing - * layer. - * - * The number of management threads will depend on the VFS. The idea is - * to give a high performance VFS such as UFS at least one thread per cpu, - * and a low performance VFS such as CD9660 perhaps just one thread period. - * Blocking issues within the management thread are up to the VFS itself, - * but DragonFly will introduce a layer above the VFS to handle cacheable - * requests without having to enter the VFS (e.g. by making attribute - * and VM object information a permanent fixture of the vnode structure - * and accessing them directly). - * - * THE VOPOPS VECTORS SHOULD NEVER BE CALLED DIRECTLY! Instead always use - * the kernel helper procedures vop_*() to call a vopop. The kernel - * helper procedure will be responsible for handling the DragonFly messaging - * conversion when it occurs. - */ - -#ifndef _SYS_VOPOPS_H_ -#define _SYS_VOPOPS_H_ - -struct vnode; -struct thread; -struct namecache; -struct componentname; -struct vattr; -struct ucred; -struct uio; -struct knote; -struct vm_object; -struct vm_page; - -struct vop_generic_args { - struct vnodeop_desc *a_desc; -}; - -struct vop_islocked_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct thread *a_td; -}; - -struct vop_lookup_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode **a_vpp; - struct namecache **a_ncpp; - struct componentname *a_cnp; -}; - -struct vop_cachedlookup_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode **a_vpp; - struct namecache **a_ncpp; - struct componentname *a_cnp; -}; - -struct vop_create_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode **a_vpp; - struct componentname *a_cnp; - struct vattr *a_vap; -}; - -struct vop_whiteout_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct componentname *a_cnp; - int a_flags; -}; - -struct vop_mknod_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode **a_vpp; - struct componentname *a_cnp; - struct vattr *a_vap; -}; - -struct vop_open_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_mode; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_close_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_fflag; - struct thread *a_td; -}; - -struct vop_access_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_mode; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_getattr_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct vattr *a_vap; - struct thread *a_td; -}; - -struct vop_setattr_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct vattr *a_vap; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_read_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; -}; - -struct vop_write_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; -}; - -struct vop_lease_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct thread *a_td; - struct ucred *a_cred; - int a_flag; -}; - -struct vop_ioctl_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - u_long a_command; - caddr_t a_data; - int a_fflag; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_poll_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_events; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_kqfilter_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct knote *a_kn; -}; - -struct vop_revoke_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_flags; -}; - -struct vop_mmap_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_fflags; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_fsync_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_waitfor; - struct thread *a_td; -}; - -struct vop_remove_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode *a_vp; - struct componentname *a_cnp; -}; - -struct vop_link_args { - struct vop_generic_args a_head; - struct vnode *a_tdvp; - struct namecache *a_par; - struct vnode *a_vp; - struct componentname *a_cnp; -}; - -struct vop_rename_args { - struct vop_generic_args a_head; - struct vnode *a_fdvp; - struct namecache *a_fpar; - struct vnode *a_fvp; - struct componentname *a_fcnp; - struct vnode *a_tdvp; - struct namecache *a_tpar; - struct vnode *a_tvp; - struct componentname *a_tcnp; -}; - -struct vop_mkdir_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode **a_vpp; - struct componentname *a_cnp; - struct vattr *a_vap; -}; - -struct vop_rmdir_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode *a_vp; - struct componentname *a_cnp; -}; - -struct vop_symlink_args { - struct vop_generic_args a_head; - struct vnode *a_dvp; - struct namecache *a_par; - struct vnode **a_vpp; - struct componentname *a_cnp; - struct vattr *a_vap; - char *a_target; -}; - -struct vop_readdir_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct uio *a_uio; - struct ucred *a_cred; - int *a_eofflag; - int *a_ncookies; - u_long **a_cookies; -}; - -struct vop_readlink_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct uio *a_uio; - struct ucred *a_cred; -}; - -struct vop_inactive_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct thread *a_td; -}; - -struct vop_reclaim_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct thread *a_td; -}; - -struct vop_lock_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct lwkt_tokref *a_vlock; - int a_flags; - struct thread *a_td; -}; - -struct vop_unlock_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct lwkt_tokref *a_vlock; - int a_flags; - struct thread *a_td; -}; - -struct vop_bmap_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - daddr_t a_bn; - struct vnode **a_vpp; - daddr_t *a_bnp; - int *a_runp; - int *a_runb; -}; - -struct vop_strategy_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct buf *a_bp; -}; - -struct vop_print_args { - struct vop_generic_args a_head; - struct vnode *a_vp; -}; - -struct vop_pathconf_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - int a_name; - register_t *a_retval; -}; - -struct vop_advlock_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - caddr_t a_id; - int a_op; - struct flock *a_fl; - int a_flags; -}; - -struct vop_balloc_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - off_t a_startoffset; - int a_size; - struct ucred *a_cred; - int a_flags; - struct buf **a_bpp; -}; - -struct vop_reallocblks_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct cluster_save *a_buflist; -}; - -struct vop_getpages_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct vm_page **a_m; - int a_count; - int a_reqpage; - vm_ooffset_t a_offset; -}; - -struct vop_putpages_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct vm_page **a_m; - int a_count; - int a_sync; - int *a_rtvals; - vm_ooffset_t a_offset; -}; - -struct vop_freeblks_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - daddr_t a_addr; - daddr_t a_length; -}; - -struct vop_bwrite_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct buf *a_bp; -}; - -struct vop_getacl_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - acl_type_t a_type; - struct acl *a_aclp; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_setacl_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - acl_type_t a_type; - struct acl *a_aclp; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_aclcheck_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - acl_type_t a_type; - struct acl *a_aclp; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_getextattr_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - char *a_name; - struct uio *a_uio; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_setextattr_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - char *a_name; - struct uio *a_uio; - struct ucred *a_cred; - struct thread *a_td; -}; - -struct vop_createvobject_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct thread *a_td; -}; - -struct vop_destroyvobject_args { - struct vop_generic_args a_head; - struct vnode *a_vp; -}; - -struct vop_getvobject_args { - struct vop_generic_args a_head; - struct vnode *a_vp; - struct vm_object **a_objpp; -}; - -/* - * This structure is the post-compiled VOP operations vector and should only - * be used by kern/vfs_vopops.c. - */ -struct vop_ops { - int vv_refs; - struct vop_ops *vv_new; -#define vop_ops_first_field vop_default - int (*vop_default)(struct vop_generic_args *); - int (*vop_islocked)(struct vop_islocked_args *); - int (*vop_lookup)(struct vop_lookup_args *); - int (*vop_cachedlookup)(struct vop_cachedlookup_args *); - int (*vop_create)(struct vop_create_args *); - int (*vop_whiteout)(struct vop_whiteout_args *); - int (*vop_mknod)(struct vop_mknod_args *); - int (*vop_open)(struct vop_open_args *); - int (*vop_close)(struct vop_close_args *); - int (*vop_access)(struct vop_access_args *); - int (*vop_getattr)(struct vop_getattr_args *); - int (*vop_setattr)(struct vop_setattr_args *); - int (*vop_read)(struct vop_read_args *); - int (*vop_write)(struct vop_write_args *); - int (*vop_lease)(struct vop_lease_args *); - int (*vop_ioctl)(struct vop_ioctl_args *); - int (*vop_poll)(struct vop_poll_args *); - int (*vop_kqfilter)(struct vop_kqfilter_args *); - int (*vop_revoke)(struct vop_revoke_args *); - int (*vop_mmap)(struct vop_mmap_args *); - int (*vop_fsync)(struct vop_fsync_args *); - int (*vop_remove)(struct vop_remove_args *); - int (*vop_link)(struct vop_link_args *); - int (*vop_rename)(struct vop_rename_args *); - int (*vop_mkdir)(struct vop_mkdir_args *); - int (*vop_rmdir)(struct vop_rmdir_args *); - int (*vop_symlink)(struct vop_symlink_args *); - int (*vop_readdir)(struct vop_readdir_args *); - int (*vop_readlink)(struct vop_readlink_args *); - int (*vop_inactive)(struct vop_inactive_args *); - int (*vop_reclaim)(struct vop_reclaim_args *); - int (*vop_lock)(struct vop_lock_args *); - int (*vop_unlock)(struct vop_unlock_args *); - int (*vop_bmap)(struct vop_bmap_args *); - int (*vop_strategy)(struct vop_strategy_args *); - int (*vop_print)(struct vop_print_args *); - int (*vop_pathconf)(struct vop_pathconf_args *); - int (*vop_advlock)(struct vop_advlock_args *); - int (*vop_balloc)(struct vop_balloc_args *); - int (*vop_reallocblks)(struct vop_reallocblks_args *); - int (*vop_getpages)(struct vop_getpages_args *); - int (*vop_putpages)(struct vop_putpages_args *); - int (*vop_freeblks)(struct vop_freeblks_args *); - int (*vop_bwrite)(struct vop_bwrite_args *); - int (*vop_getacl)(struct vop_getacl_args *); - int (*vop_setacl)(struct vop_setacl_args *); - int (*vop_aclcheck)(struct vop_aclcheck_args *); - int (*vop_getextattr)(struct vop_getextattr_args *); - int (*vop_setextattr)(struct vop_setextattr_args *); - int (*vop_createvobject)(struct vop_createvobject_args *); - int (*vop_destroyvobject)(struct vop_destroyvobject_args *); - int (*vop_getvobject)(struct vop_getvobject_args *); -#define vop_ops_last_field vop_getvobject -}; - -/* - * Kernel VOP arguments union, suitable for malloc / embedding in other - * structures. The vop_args_union can hold any VOP call argument structure. - * Note that vu_head is broken out. - */ -union vop_args_union { - struct vop_generic_args vu_head; - struct vop_generic_args vu_default; - struct vop_islocked_args vu_islocked; - struct vop_lookup_args vu_lookup; - struct vop_cachedlookup_args vu_cachedlookup; - struct vop_create_args vu_create; - struct vop_whiteout_args vu_whiteout; - struct vop_mknod_args vu_mknod; - struct vop_open_args vu_open; - struct vop_close_args vu_close; - struct vop_access_args vu_access; - struct vop_getattr_args vu_getattr; - struct vop_setattr_args vu_setattr; - struct vop_read_args vu_read; - struct vop_write_args vu_write; - struct vop_lease_args vu_lease; - struct vop_ioctl_args vu_ioctl; - struct vop_poll_args vu_poll; - struct vop_kqfilter_args vu_kqfilter; - struct vop_revoke_args vu_revoke; - struct vop_mmap_args vu_mmap; - struct vop_fsync_args vu_fsync; - struct vop_remove_args vu_remove; - struct vop_link_args vu_link; - struct vop_rename_args vu_rename; - struct vop_mkdir_args vu_mkdir; - struct vop_rmdir_args vu_rmdir; - struct vop_symlink_args vu_symlink; - struct vop_readdir_args vu_readdir; - struct vop_readlink_args vu_readlink; - struct vop_inactive_args vu_inactive; - struct vop_reclaim_args vu_reclaim; - struct vop_lock_args vu_lock; - struct vop_unlock_args vu_unlock; - struct vop_bmap_args vu_bmap; - struct vop_strategy_args vu_strategy; - struct vop_print_args vu_print; - struct vop_pathconf_args vu_pathconf; - struct vop_advlock_args vu_advlock; - struct vop_balloc_args vu_balloc; - struct vop_reallocblks_args vu_reallocblks; - struct vop_getpages_args vu_getpages; - struct vop_putpages_args vu_putpages; - struct vop_freeblks_args vu_freeblks; - struct vop_bwrite_args vu_bwrite; - struct vop_getacl_args vu_getacl; - struct vop_setacl_args vu_setacl; - struct vop_aclcheck_args vu_aclcheck; - struct vop_getextattr_args vu_getextattr; - struct vop_setextattr_args vu_setextattr; - struct vop_createvobject_args vu_createvobject; - struct vop_destroyvobject_args vu_destroyvobject; - struct vop_getvobject_args vu_getvobject; -}; - -#ifdef _KERNEL - -/* - * Kernel VOP call wrappers. These wrappers are responsible for wrapping - * the arguments in the appropriate VOP arguments structure, sending the - * message, and waiting for a reply. All kernel and VFS code should generally - * call these wrappers rather then attempt to call the operations vector - * routine directly in order to allow DragonFly to properly wrap the operation - * in a message and dispatch it to the correct thread. - */ -int vop_islocked(struct vnode *vp, struct thread *td); -int vop_lookup(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct namecache **ncpp, - struct componentname *cnp); -int vop_cachedlookup(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct namecache **ncpp, - struct componentname *cnp); -int vop_create(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap); -int vop_whiteout(struct vnode *dvp, struct namecache *par, - struct componentname *cnp, int flags); -int vop_mknod(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap); -int vop_open(struct vnode *vp, int mode, struct ucred *cred, - struct thread *td); -int vop_close(struct vnode *vp, int fflag, struct thread *td); -int vop_access(struct vnode *vp, int mode, struct ucred *cred, - struct thread *td); -int vop_getattr(struct vnode *vp, struct vattr *vap, - struct thread *td); -int vop_setattr(struct vnode *vp, struct vattr *vap, - struct ucred *cred, struct thread *td); -int vop_read(struct vnode *vp, struct uio *uio, int ioflag, - struct ucred *cred); -int vop_write(struct vnode *vp, struct uio *uio, int ioflag, - struct ucred *cred); -int vop_lease(struct vnode *vp, struct thread *td, - struct ucred *cred, int flag); -int vop_ioctl(struct vnode *vp, u_long command, caddr_t data, - int fflag, struct ucred *cred, - struct thread *td); -int vop_poll(struct vnode *vp, int events, struct ucred *cred, - struct thread *td); -int vop_kqfilter(struct vnode *vp, struct knote *kn); -int vop_revoke(struct vnode *vp, int flags); -int vop_mmap(struct vnode *vp, int fflags, struct ucred *cred, - struct thread *td); -int vop_fsync(struct vnode *vp, int waitfor, struct thread *td); -int vop_remove(struct vnode *dvp, struct namecache *par, - struct vnode *vp, struct componentname *cnp); -int vop_link(struct vnode *tdvp, struct namecache *par, - struct vnode *vp, struct componentname *cnp); -int vop_rename(struct vnode *fdvp, struct namecache *fpar, - struct vnode *fvp, struct componentname *fcnp, - struct vnode *tdvp, struct namecache *tpar, - struct vnode *tvp, struct componentname *tcnp); -int vop_mkdir(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap); -int vop_rmdir(struct vnode *dvp, struct namecache *par, - struct vnode *vp, struct componentname *cnp); -int vop_symlink(struct vnode *dvp, struct namecache *par, - struct vnode **vpp, struct componentname *cnp, - struct vattr *vap, char *target); -int vop_readdir(struct vnode *vp, struct uio *uio, - struct ucred *cred, int *eofflag, - int *ncookies, u_long **cookies); -int vop_readlink(struct vnode *vp, struct uio *uio, - struct ucred *cred); -int vop_inactive(struct vnode *vp, struct thread *td); -int vop_reclaim(struct vnode *vp, struct thread *td); -int vop_lock(struct vnode *vp, struct lwkt_tokref *vlock, - int flags, struct thread *td); -int vop_unlock(struct vnode *vp, struct lwkt_tokref *vlock, - int flags, struct thread *td); -int vop_bmap(struct vnode *vp, daddr_t bn, struct vnode **vpp, - daddr_t *bnp, int *runp, int *runb); -int vop_strategy(struct vnode *vp, struct buf *bp); -int vop_print(struct vnode *vp); -int vop_pathconf(struct vnode *vp, int name, - register_t *retval); -int vop_advlock(struct vnode *vp, caddr_t id, int op, - struct flock *fl, int flags); -int vop_balloc(struct vnode *vp, off_t startoffset, - int size, struct ucred *cred, int flags, - struct buf **bpp); -int vop_reallocblks(struct vnode *vp, - struct cluster_save *buflist); -int vop_getpages(struct vnode *vp, struct vm_page **m, int count, - int reqpage, vm_ooffset_t offset); -int vop_putpages(struct vnode *vp, struct vm_page **m, int count, - int sync, int *rtvals, - vm_ooffset_t offset); -int vop_freeblks(struct vnode *vp, daddr_t addr, - daddr_t length); -int vop_bwrite(struct vnode *vp, struct buf *bp); -int vop_getacl(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td); -int vop_setacl(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td); -int vop_aclcheck(struct vnode *vp, acl_type_t type, - struct acl *aclp, struct ucred *cred, - struct thread *td); -int vop_getextattr(struct vnode *vp, char *name, - struct uio *uio, struct ucred *cred, - struct thread *td); -int vop_setextattr(struct vnode *vp, char *name, - struct uio *uio, struct ucred *cred, - struct thread *td); -int vop_createvobject(struct vnode *vp, struct thread *td); -int vop_destroyvobject(struct vnode *vp); -int vop_getvobject(struct vnode *vp, struct vm_object **objpp); - -/* - * VOP operations descriptor. This is used by the vopops compiler - * to convert VFS vector arrays (typically in vfs/blah/blah_vnops.c) - * into a vop_ops operations vector. - */ -extern struct vnodeop_desc vop_default_desc; -extern struct vnodeop_desc vop_islocked_desc; -extern struct vnodeop_desc vop_lookup_desc; -extern struct vnodeop_desc vop_cachedlookup_desc; -extern struct vnodeop_desc vop_create_desc; -extern struct vnodeop_desc vop_whiteout_desc; -extern struct vnodeop_desc vop_mknod_desc; -extern struct vnodeop_desc vop_open_desc; -extern struct vnodeop_desc vop_close_desc; -extern struct vnodeop_desc vop_access_desc; -extern struct vnodeop_desc vop_getattr_desc; -extern struct vnodeop_desc vop_setattr_desc; -extern struct vnodeop_desc vop_read_desc; -extern struct vnodeop_desc vop_write_desc; -extern struct vnodeop_desc vop_lease_desc; -extern struct vnodeop_desc vop_ioctl_desc; -extern struct vnodeop_desc vop_poll_desc; -extern struct vnodeop_desc vop_kqfilter_desc; -extern struct vnodeop_desc vop_revoke_desc; -extern struct vnodeop_desc vop_mmap_desc; -extern struct vnodeop_desc vop_fsync_desc; -extern struct vnodeop_desc vop_remove_desc; -extern struct vnodeop_desc vop_link_desc; -extern struct vnodeop_desc vop_rename_desc; -extern struct vnodeop_desc vop_mkdir_desc; -extern struct vnodeop_desc vop_rmdir_desc; -extern struct vnodeop_desc vop_symlink_desc; -extern struct vnodeop_desc vop_readdir_desc; -extern struct vnodeop_desc vop_readlink_desc; -extern struct vnodeop_desc vop_inactive_desc; -extern struct vnodeop_desc vop_reclaim_desc; -extern struct vnodeop_desc vop_lock_desc; -extern struct vnodeop_desc vop_unlock_desc; -extern struct vnodeop_desc vop_bmap_desc; -extern struct vnodeop_desc vop_strategy_desc; -extern struct vnodeop_desc vop_print_desc; -extern struct vnodeop_desc vop_pathconf_desc; -extern struct vnodeop_desc vop_advlock_desc; -extern struct vnodeop_desc vop_balloc_desc; -extern struct vnodeop_desc vop_reallocblks_desc; -extern struct vnodeop_desc vop_getpages_desc; -extern struct vnodeop_desc vop_putpages_desc; -extern struct vnodeop_desc vop_freeblks_desc; -extern struct vnodeop_desc vop_bwrite_desc; -extern struct vnodeop_desc vop_getacl_desc; -extern struct vnodeop_desc vop_setacl_desc; -extern struct vnodeop_desc vop_aclcheck_desc; -extern struct vnodeop_desc vop_getextattr_desc; -extern struct vnodeop_desc vop_setextattr_desc; -extern struct vnodeop_desc vop_createvobject_desc; -extern struct vnodeop_desc vop_destroyvobject_desc; -extern struct vnodeop_desc vop_getvobject_desc; - -#endif - -/* - * VOP_ macro compatibility. Remove these as we get rid of the VOP macros. - */ -#define VOP_ISLOCKED(vp, td) \ - vop_islocked(vp, td) -#define VOP_LOOKUP(dvp, par, vpp, ncpp, cnp) \ - vop_lookup(dvp, par, vpp, ncpp, cnp) -#define VOP_CACHEDLOOKUP(dvp, par, vpp, ncpp, cnp) \ - vop_cachedlookup(dvp, par, vpp, ncpp, cnp) -#define VOP_CREATE(dvp, par, vpp, cnp, vap) \ - vop_create(dvp, par, vpp, cnp, vap) -#define VOP_WHITEOUT(dvp, par, cnp, flags) \ - vop_whiteout(dvp, par, cnp, flags) -#define VOP_MKNOD(dvp, par, vpp, cnp, vap) \ - vop_mknod(dvp, par, vpp, cnp, vap) -#define VOP_OPEN(vp, mode, cred, td) \ - vop_open(vp, mode, cred, td) -#define VOP_CLOSE(vp, fflag, td) \ - vop_close(vp, fflag, td) -#define VOP_ACCESS(vp, mode, cred, td) \ - vop_access(vp, mode, cred, td) -#define VOP_GETATTR(vp, vap, td) \ - vop_getattr(vp, vap, td) -#define VOP_SETATTR(vp, vap, cred, td) \ - vop_setattr(vp, vap, cred, td) -#define VOP_READ(vp, uio, ioflag, cred) \ - vop_read(vp, uio, ioflag, cred) -#define VOP_WRITE(vp, uio, ioflag, cred) \ - vop_write(vp, uio, ioflag, cred) -#define VOP_LEASE(vp, td, cred, flag) \ - vop_lease(vp, td, cred, flag) -#define VOP_IOCTL(vp, command, data, fflag, cred, td) \ - vop_ioctl(vp, command, data, fflag, cred, td) -#define VOP_POLL(vp, events, cred, td) \ - vop_poll(vp, events, cred, td) -#define VOP_KQFILTER(vp, kn) \ - vop_kqfilter(vp, kn) -#define VOP_REVOKE(vp, flags) \ - vop_revoke(vp, flags) -#define VOP_MMAP(vp, fflags, cred, td) \ - vop_mmap(vp, fflags, cred, td) -#define VOP_FSYNC(vp, waitfor, td) \ - vop_fsync(vp, waitfor, td) -#define VOP_REMOVE(dvp, par, vp, cnp) \ - vop_remove(dvp, par, vp, cnp) -#define VOP_LINK(tdvp, par, vp, cnp) \ - vop_link(tdvp, par, vp, cnp) -#define VOP_RENAME(fdvp, fpar, fvp, fcnp, tdvp, tpar, tvp, tcnp) \ - vop_rename(fdvp, fpar, fvp, fcnp, tdvp, tpar, tvp, tcnp) -#define VOP_MKDIR(dvp, par, vpp, cnp, vap) \ - vop_mkdir(dvp, par, vpp, cnp, vap) -#define VOP_RMDIR(dvp, par, vp, cnp) \ - vop_rmdir(dvp, par, vp, cnp) -#define VOP_SYMLINK(dvp, par, vpp, cnp, vap, target) \ - vop_symlink(dvp, par, vpp, cnp, vap, target) -#define VOP_READDIR(vp, uio, cred, eofflag, ncookies, cookies) \ - vop_readdir(vp, uio, cred, eofflag, ncookies, cookies) -#define VOP_READLINK(vp, uio, cred) \ - vop_readlink(vp, uio, cred) -#define VOP_INACTIVE(vp, td) \ - vop_inactive(vp, td) -#define VOP_RECLAIM(vp, td) \ - vop_reclaim(vp, td) -#define VOP_LOCK(vp, vlock, flags, td) \ - vop_lock(vp, vlock, flags, td) -#define VOP_UNLOCK(vp, vlock, flags, td) \ - vop_unlock(vp, vlock, flags, td) -#define VOP_BMAP(vp, bn, vpp, bnp, runp, runb) \ - vop_bmap(vp, bn, vpp, bnp, runp, runb) -#define VOP_STRATEGY(vp, bp) \ - vop_strategy(vp, bp) -#define VOP_PRINT(vp) \ - vop_print(vp) -#define VOP_PATHCONF(vp, name, retval) \ - vop_pathconf(vp, name, retval) -#define VOP_ADVLOCK(vp, id, op, fl, flags) \ - vop_advlock(vp, id, op, fl, flags) -#define VOP_BALLOC(vp, offset, size, cred, flags, bpp) \ - vop_balloc(vp, offset, size, cred, flags, bpp) -#define VOP_REALLOCBLKS(vp, buflist) \ - vop_reallocblks(vp, buflist) -#define VOP_GETPAGES(vp, m, count, reqpage, off) \ - vop_getpages(vp, m, count, reqpage, off) -#define VOP_PUTPAGES(vp, m, count, sync, rtvals, off) \ - vop_putpages(vp, m, count, sync, rtvals, off) -#define VOP_FREEBLKS(vp, addr, length) \ - vop_freeblks(vp, addr, length) -#define VOP_BWRITE(vp, bp) \ - vop_bwrite(vp, bp) -#define VOP_GETACL(vp, type, aclp, cred, td) \ - vop_getacl(vp, type, aclp, cred, td) -#define VOP_SETACL(vp, type, aclp, cred, td) \ - vop_setacl(vp, type, aclp, cred, td) -#define VOP_ACLCHECK(vp, type, aclp, cred, td) \ - vop_aclcheck(vp, type, aclp, cred, td) -#define VOP_GETEXTATTR(vp, name, uio, cred, td) \ - vop_getextattr(vp, name, uio, cred, td) -#define VOP_SETEXTATTR(vp, name, uio, cred, td) \ - vop_setextattr(vp, name, uio, cred, td) -#define VOP_CREATEVOBJECT(vp, td) \ - vop_createvobject(vp, td) -#define VOP_DESTROYVOBJECT(vp) \ - vop_destroyvobject(vp) -#define VOP_GETVOBJECT(vp, objpp) \ - vop_getvobject(vp, objpp) - -#endif - diff --git a/sys/vfs/coda/coda_vnops.c b/sys/vfs/coda/coda_vnops.c index 2627f989b8..2e33bc00ed 100644 --- a/sys/vfs/coda/coda_vnops.c +++ b/sys/vfs/coda/coda_vnops.c @@ -28,7 +28,7 @@ * * @(#) src/sys/coda/coda_vnops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_vnops.c,v 1.22.2.1 2001/06/29 16:26:22 shafeeq Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.17 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.c,v 1.18 2004/08/17 18:57:32 dillon Exp $ * */ @@ -82,8 +82,6 @@ int coda_attr_cache = 1; /* Set to cache attributes in the kernel */ int coda_symlink_cache = 1; /* Set to cache symbolic link information */ int coda_access_cache = 1; /* Set to handle some access checks directly */ -struct vop_ops *coda_vnode_vops; - /* structure to keep track of vfs calls */ struct coda_op_stats coda_vnodeopstats[CODA_VNODEOPS_SIZE]; @@ -170,11 +168,6 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = { { NULL, NULL } }; -static struct vnodeopv_desc coda_vnodeop_opv_desc = - { &coda_vnode_vops, coda_vnodeop_entries }; - -VNODEOP_SET(coda_vnodeop_opv_desc); - /* A generic panic: we were called with something we didn't define yet */ int coda_vop_error(void *anon) @@ -557,7 +550,7 @@ coda_ioctl(void *v) * Make sure this is a coda style cnode, but it may be a * different vfsp */ - if (tvp->v_vops != coda_vnode_vops) { + if (tvp->v_tag != VT_CODA) { vrele(tvp); NDFREE(&ndp, NDF_ONLY_PNBUF); MARK_INT_FAIL(CODA_IOCTL_STATS); @@ -1908,7 +1901,7 @@ make_coda_node(ViceFid *fid, struct mount *vfsp, short type) lockinit(&cp->c_lock, 0, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode(VT_CODA, vfsp, coda_vnode_vops, &vp); + err = getnewvnode(VT_CODA, vfsp, vfsp->mnt_vn_ops, &vp); if (err) { panic("coda: getnewvnode returned error %d\n", err); } diff --git a/sys/vfs/coda/coda_vnops.h b/sys/vfs/coda/coda_vnops.h index f6a40d2887..6ed3defef1 100644 --- a/sys/vfs/coda/coda_vnops.h +++ b/sys/vfs/coda/coda_vnops.h @@ -28,7 +28,7 @@ * * @(#) src/sys/coda/coda_vnops.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_vnops.h,v 1.6 1999/08/28 00:40:58 peter Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.h,v 1.6 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_vnops.h,v 1.7 2004/08/17 18:57:32 dillon Exp $ * */ @@ -81,8 +81,6 @@ int coda_vop_nop (void *); int coda_fbsd_getpages (void *); int coda_fbsd_putpages (void *); -extern struct vop_ops *coda_vnode_vops; - int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct thread *p); int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); diff --git a/sys/vfs/deadfs/dead_vnops.c b/sys/vfs/deadfs/dead_vnops.c index 7459c84eaf..2f9a87584f 100644 --- a/sys/vfs/deadfs/dead_vnops.c +++ b/sys/vfs/deadfs/dead_vnops.c @@ -32,7 +32,7 @@ * * @(#)dead_vnops.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/miscfs/deadfs/dead_vnops.c,v 1.26 1999/08/28 00:46:42 peter Exp $ - * $DragonFly: src/sys/vfs/deadfs/dead_vnops.c,v 1.9 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/deadfs/dead_vnops.c,v 1.10 2004/08/17 18:57:33 dillon Exp $ */ #include @@ -169,7 +169,7 @@ dead_ioctl(struct vop_ioctl_args *ap) { if (!chkvnlock(ap->a_vp)) return (ENOTTY); - return (VCALL(ap->a_vp, VOFFSET(vop_ioctl), &ap->a_head)); + return (vop_ioctl_ap(ap)); } /* @@ -193,7 +193,7 @@ dead_lock(struct vop_lock_args *ap) } if (!chkvnlock(vp)) return (0); - return (VCALL(vp, VOFFSET(vop_lock), &ap->a_head)); + return (vop_lock_ap(ap)); } /* diff --git a/sys/vfs/fdesc/fdesc_vfsops.c b/sys/vfs/fdesc/fdesc_vfsops.c index 011feaed0e..3738350a11 100644 --- a/sys/vfs/fdesc/fdesc_vfsops.c +++ b/sys/vfs/fdesc/fdesc_vfsops.c @@ -36,7 +36,7 @@ * @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vfsops.c,v 1.22.2.3 2002/08/23 17:42:39 njl Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.7 2004/04/24 04:32:03 drhodus Exp $ + * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.8 2004/08/17 18:57:33 dillon Exp $ */ /* @@ -57,6 +57,8 @@ #include "fdesc.h" +extern struct vnodeopv_entry_desc fdesc_vnodeop_entries[]; + static MALLOC_DEFINE(M_FDESCMNT, "FDESC mount", "FDESC mount structure"); static int fdesc_mount (struct mount *mp, char *path, caddr_t data, @@ -87,6 +89,8 @@ fdesc_mount(struct mount *mp, char *path, caddr_t data, if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); + vfs_add_vnodeops(&mp->mnt_vn_ops, fdesc_vnodeop_entries); + error = fdesc_allocvp(Froot, FD_ROOT, mp, &rvp, td); if (error) return (error); diff --git a/sys/vfs/fdesc/fdesc_vnops.c b/sys/vfs/fdesc/fdesc_vnops.c index 385823ea41..6e4912a659 100644 --- a/sys/vfs/fdesc/fdesc_vnops.c +++ b/sys/vfs/fdesc/fdesc_vnops.c @@ -36,7 +36,7 @@ * @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vnops.c,v 1.47.2.1 2001/10/22 22:49:26 chris Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.12 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.13 2004/08/17 18:57:33 dillon Exp $ */ /* @@ -66,8 +66,6 @@ #define FDL_LOCKED 0x02 static int fdcache_lock; -static struct vop_ops *fdesc_vnode_vops; - #define NFDCACHE 4 #define FD_NHASH(ix) \ (&fdhashtbl[(ix) & fdhash]) @@ -132,7 +130,7 @@ loop: */ MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK); - error = getnewvnode(VT_FDESC, mp, fdesc_vnode_vops, vpp); + error = getnewvnode(VT_FDESC, mp, mp->mnt_vn_ops, vpp); if (error) { FREE(fd, M_TEMP); goto out; @@ -528,7 +526,7 @@ fdesc_print(struct vop_print_args *ap) return (0); } -static struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { +struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { { &vop_default_desc, (void *) vop_defaultop }, { &vop_access_desc, (void *) vop_null }, { &vop_getattr_desc, (void *) fdesc_getattr }, @@ -543,7 +541,4 @@ static struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { { &vop_setattr_desc, (void *) fdesc_setattr }, { NULL, NULL } }; -static struct vnodeopv_desc fdesc_vnodeop_opv_desc = - { &fdesc_vnode_vops, fdesc_vnodeop_entries }; -VNODEOP_SET(fdesc_vnodeop_opv_desc); diff --git a/sys/vfs/fifofs/fifo_vnops.c b/sys/vfs/fifofs/fifo_vnops.c index 5316ebb7c9..d72af3d249 100644 --- a/sys/vfs/fifofs/fifo_vnops.c +++ b/sys/vfs/fifofs/fifo_vnops.c @@ -32,7 +32,7 @@ * * @(#)fifo_vnops.c 8.10 (Berkeley) 5/27/95 * $FreeBSD: src/sys/miscfs/fifofs/fifo_vnops.c,v 1.45.2.4 2003/04/22 10:11:24 bde Exp $ - * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.15 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/fifofs/fifo_vnops.c,v 1.16 2004/08/17 18:57:33 dillon Exp $ */ #include @@ -133,7 +133,7 @@ VNODEOP_SET(fifo_vnodeop_opv_desc); int fifo_vnoperate(struct vop_generic_args *ap) { - return (VOCALL(fifo_vnode_vops, ap->a_desc->vdesc_offset, ap)); + return (VOCALL(fifo_vnode_vops, ap)); } /* diff --git a/sys/vfs/gnu/ext2fs/ext2_extern.h b/sys/vfs/gnu/ext2fs/ext2_extern.h index e8d9b1159f..a6b765d226 100644 --- a/sys/vfs/gnu/ext2fs/ext2_extern.h +++ b/sys/vfs/gnu/ext2fs/ext2_extern.h @@ -38,7 +38,7 @@ * * @(#)ffs_extern.h 8.3 (Berkeley) 4/16/94 * $FreeBSD: src/sys/gnu/ext2fs/ext2_extern.h,v 1.22.6.1 2000/11/05 19:17:40 bde Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_extern.h,v 1.5 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_extern.h,v 1.6 2004/08/17 18:57:33 dillon Exp $ */ #ifndef _SYS_GNU_EXT2FS_EXT2_EXTERN_H_ @@ -101,8 +101,4 @@ void mark_buffer_dirty (struct buf *bh); */ #define IS_EXT2_VNODE(vp) (vp->v_mount->mnt_stat.f_type == MOUNT_EXT2FS) -extern struct vop_ops *ext2_vnode_vops; -extern struct vop_ops *ext2_spec_vops; -extern struct vop_ops *ext2_fifo_vops; - #endif /* !_SYS_GNU_EXT2FS_EXT2_EXTERN_H_ */ diff --git a/sys/vfs/gnu/ext2fs/ext2_vfsops.c b/sys/vfs/gnu/ext2fs/ext2_vfsops.c index 0475bc50ac..493beb3d5e 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vfsops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vfsops.c @@ -38,7 +38,7 @@ * * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 * $FreeBSD: src/sys/gnu/ext2fs/ext2_vfsops.c,v 1.63.2.7 2002/07/01 00:18:51 iedowse Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vfsops.c,v 1.17 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vfsops.c,v 1.18 2004/08/17 18:57:33 dillon Exp $ */ #include "opt_quota.h" @@ -70,6 +70,10 @@ #include "ext2_fs.h" #include "ext2_fs_sb.h" +extern struct vnodeopv_entry_desc ext2_vnodeop_entries[]; +extern struct vnodeopv_entry_desc ext2_specop_entries[]; +extern struct vnodeopv_entry_desc ext2_fifoop_entries[]; + static int ext2_fhtovp (struct mount *, struct fid *, struct vnode **); static int ext2_flushfiles (struct mount *mp, int flags, struct thread *td); static int ext2_mount (struct mount *, @@ -753,6 +757,11 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) for (i = 0; i < MAXQUOTAS; i++) ump->um_quotas[i] = NULLVP; dev->si_mountpoint = mp; + + vfs_add_vnodeops(&mp->mnt_vn_ops, ext2_vnodeop_entries); + vfs_add_vnodeops(&mp->mnt_vn_spec_ops, ext2_specop_entries); + vfs_add_vnodeops(&mp->mnt_vn_fifo_ops, ext2_fifoop_entries); + if (ronly == 0) ext2_sbupdate(ump, MNT_WAIT); return (0); @@ -1044,7 +1053,7 @@ restart: MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode(VT_UFS, mp, ext2_vnode_vops, &vp)) != 0) { + if ((error = getnewvnode(VT_UFS, mp, mp->mnt_vn_ops, &vp)) != 0) { if (ext2fs_inode_hash_lock < 0) wakeup(&ext2fs_inode_hash_lock); ext2fs_inode_hash_lock = 0; @@ -1118,7 +1127,7 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino))); * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - if ((error = ufs_vinit(mp, ext2_spec_vops, ext2_fifo_vops, &vp)) != 0) { + if ((error = ufs_vinit(mp, &vp)) != 0) { vput(vp); *vpp = NULL; return (error); diff --git a/sys/vfs/gnu/ext2fs/ext2_vnops.c b/sys/vfs/gnu/ext2fs/ext2_vnops.c index d9f6e0b032..751e0a079d 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vnops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vnops.c @@ -44,7 +44,7 @@ * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * @(#)ext2_vnops.c 8.7 (Berkeley) 2/3/94 * $FreeBSD: src/sys/gnu/ext2fs/ext2_vnops.c,v 1.51.2.2 2003/01/02 17:26:18 bde Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vnops.c,v 1.14 2004/08/13 17:51:10 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vnops.c,v 1.15 2004/08/17 18:57:33 dillon Exp $ */ #include "opt_quota.h" @@ -97,8 +97,7 @@ static int ext2_getpages (struct vop_getpages_args *); static int ext2_putpages (struct vop_putpages_args *); /* Global vfs data structures for ufs. */ -struct vop_ops *ext2_vnode_vops; -static struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { +struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { { &vop_default_desc, (void *) ufs_vnoperate }, { &vop_cachedlookup_desc, (void *) ext2_lookup }, { &vop_fsync_desc, (void *) ext2_fsync }, @@ -120,32 +119,20 @@ static struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { { &vop_putpages_desc, (void *) ext2_putpages }, { NULL, NULL } }; -static struct vnodeopv_desc ext2fs_vnodeop_opv_desc = - { &ext2_vnode_vops, ext2_vnodeop_entries }; -struct vop_ops *ext2_spec_vops; -static struct vnodeopv_entry_desc ext2_specop_entries[] = { +struct vnodeopv_entry_desc ext2_specop_entries[] = { { &vop_default_desc, (void *) ufs_vnoperatespec }, { &vop_fsync_desc, (void *) ext2_fsync }, { &vop_inactive_desc, (void *) ext2_inactive }, { NULL, NULL } }; -static struct vnodeopv_desc ext2fs_specop_opv_desc = - { &ext2_spec_vops, ext2_specop_entries }; -struct vop_ops *ext2_fifo_vops; -static struct vnodeopv_entry_desc ext2_fifoop_entries[] = { +struct vnodeopv_entry_desc ext2_fifoop_entries[] = { { &vop_default_desc, (void *) ufs_vnoperatefifo }, { &vop_fsync_desc, (void *) ext2_fsync }, { &vop_inactive_desc, (void *) ext2_inactive }, { NULL, NULL } }; -static struct vnodeopv_desc ext2fs_fifoop_opv_desc = - { &ext2_fifo_vops, ext2_fifoop_entries }; - - VNODEOP_SET(ext2fs_vnodeop_opv_desc); - VNODEOP_SET(ext2fs_specop_opv_desc); - VNODEOP_SET(ext2fs_fifoop_opv_desc); #include "ext2_readwrite.c" diff --git a/sys/vfs/hpfs/hpfs.h b/sys/vfs/hpfs/hpfs.h index 98d86fb709..9ba8ed9d82 100644 --- a/sys/vfs/hpfs/hpfs.h +++ b/sys/vfs/hpfs/hpfs.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs.h,v 1.1 1999/12/09 19:09:58 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs.h,v 1.11 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs.h,v 1.12 2004/08/17 18:57:33 dillon Exp $ */ /*#define HPFS_DEBUG 10*/ @@ -406,7 +406,6 @@ typedef int (vop_t) (void *); #define LOCKMGR(a, b, c, d) lockmgr((a), (b), (c), (d)) #endif -extern struct vop_ops *hpfs_vnode_vops; struct vfsconf; /* Hash routines, too small to be separate header */ diff --git a/sys/vfs/hpfs/hpfs_vfsops.c b/sys/vfs/hpfs/hpfs_vfsops.c index 96f9a73e86..51d555a53c 100644 --- a/sys/vfs/hpfs/hpfs_vfsops.c +++ b/sys/vfs/hpfs/hpfs_vfsops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vfsops.c,v 1.3.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.18 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_vfsops.c,v 1.19 2004/08/17 18:57:33 dillon Exp $ */ @@ -58,6 +58,8 @@ #include "hpfsmount.h" #include "hpfs_subr.h" +extern struct vnodeopv_entry_desc hpfs_vnodeop_entries[]; + #if defined(__DragonFly__) MALLOC_DEFINE(M_HPFSMNT, "HPFS mount", "HPFS mount structure"); MALLOC_DEFINE(M_HPFSNO, "HPFS node", "HPFS node structure"); @@ -392,6 +394,7 @@ hpfs_mountfs(struct vnode *devvp, struct mount *mp, struct hpfs_args *argsp, hpfs_bmdeinit(hpmp); goto failed; } + vfs_add_vnodeops(&mp->mnt_vn_ops, hpfs_vnodeop_entries); error = hpfs_root(mp, &vp); if (error) { @@ -610,7 +613,7 @@ hpfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode), M_HPFSNO, M_WAITOK); - error = getnewvnode(VT_HPFS, hpmp->hpm_mp, hpfs_vnode_vops, &vp); + error = getnewvnode(VT_HPFS, hpmp->hpm_mp, hpmp->hpm_mp->mnt_vn_ops, &vp); if (error) { printf("hpfs_vget: can't get new vnode\n"); FREE(hp, M_HPFSNO); diff --git a/sys/vfs/hpfs/hpfs_vnops.c b/sys/vfs/hpfs/hpfs_vnops.c index ac79e0b390..7dc1574c17 100644 --- a/sys/vfs/hpfs/hpfs_vnops.c +++ b/sys/vfs/hpfs/hpfs_vnops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/hpfs/hpfs_vnops.c,v 1.2.2.2 2002/01/15 18:35:09 semenu Exp $ - * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.15 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/hpfs/hpfs_vnops.c,v 1.16 2004/08/17 18:57:33 dillon Exp $ */ #include @@ -1309,7 +1309,6 @@ hpfs_pathconf(struct vop_pathconf_args *ap) /* * Global vfs data structures */ -struct vop_ops *hpfs_vnode_vops; #if defined(__DragonFly__) struct vnodeopv_entry_desc hpfs_vnodeop_entries[] = { { &vop_default_desc, (void *)vop_defaultop }, @@ -1343,11 +1342,6 @@ struct vnodeopv_entry_desc hpfs_vnodeop_entries[] = { { NULL, NULL } }; -static -struct vnodeopv_desc hpfs_vnodeop_opv_desc = - { &hpfs_vnode_vops, hpfs_vnodeop_entries }; - -VNODEOP_SET(hpfs_vnodeop_opv_desc); #else /* defined(__NetBSD__) */ struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { { &vop_default_desc, (void *) genfs_badop }, /* XXX */ @@ -1397,7 +1391,5 @@ struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { { &vop_bwrite_desc, vn_bwrite }, /* bwrite */ { (struct vnodeop_desc *)NULL, (int (*) (void *))NULL } }; -struct vnodeopv_desc ntfs_vnodeop_opv_desc = - { &ntfs_vnode_vops, ntfs_vnodeop_entries }; #endif diff --git a/sys/vfs/isofs/cd9660/cd9660_mount.h b/sys/vfs/isofs/cd9660/cd9660_mount.h index dca570d553..489e3fbc69 100644 --- a/sys/vfs/isofs/cd9660/cd9660_mount.h +++ b/sys/vfs/isofs/cd9660/cd9660_mount.h @@ -37,7 +37,7 @@ * * @(#)cd9660_mount.h 8.1 (Berkeley) 5/24/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_mount.h,v 1.3.2.2 2001/03/14 12:03:50 bp Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_mount.h,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_mount.h,v 1.3 2004/08/17 18:57:33 dillon Exp $ */ /* @@ -54,3 +54,4 @@ struct iso_args { #define ISOFSMNT_EXTATT 0x00000004 /* enable extended attributes */ #define ISOFSMNT_NOJOLIET 0x00000008 /* disable Joliet Ext.*/ #define ISOFSMNT_BROKENJOLIET 0x00000010/* allow broken Joliet disks */ + diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c index cb864d9ef9..d2d219c8e9 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c @@ -37,7 +37,7 @@ * * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vfsops.c,v 1.74.2.7 2002/04/08 09:39:29 bde Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.18 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.19 2004/08/17 18:57:33 dillon Exp $ */ #include @@ -62,6 +62,10 @@ #include "cd9660_node.h" #include "cd9660_mount.h" +extern struct vnodeopv_entry_desc cd9660_vnodeop_entries[]; +extern struct vnodeopv_entry_desc cd9660_specop_entries[]; +extern struct vnodeopv_entry_desc cd9660_fifoop_entries[]; + MALLOC_DEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure"); MALLOC_DEFINE(M_ISOFSNODE, "ISOFS node", "ISOFS vnode private part"); @@ -473,7 +477,7 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, /* this effectively ignores all the mount flags */ log(LOG_INFO, "cd9660: High Sierra Format\n"); isomp->iso_ftype = ISO_FTYPE_HIGH_SIERRA; - } else + } else { switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) { default: isomp->iso_ftype = ISO_FTYPE_DEFAULT; @@ -486,6 +490,7 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, isomp->iso_ftype = ISO_FTYPE_RRIP; break; } + } /* Decide whether to use the Joliet descriptor */ @@ -505,6 +510,10 @@ iso_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, supbp = NULL; } + vfs_add_vnodeops(&mp->mnt_vn_ops, cd9660_vnodeop_entries); + vfs_add_vnodeops(&mp->mnt_vn_spec_ops, cd9660_specop_entries); + vfs_add_vnodeops(&mp->mnt_vn_fifo_ops, cd9660_fifoop_entries); + return 0; out: dev->si_mountpoint = NULL; @@ -699,7 +708,7 @@ cd9660_vget_internal(struct mount *mp, ino_t ino, struct vnode **vpp, return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnode_vops, &vp)) != 0) { + if ((error = getnewvnode(VT_ISOFS, mp, mp->mnt_vn_ops, &vp)) != 0) { *vpp = NULLVP; return (error); } @@ -831,11 +840,11 @@ cd9660_vget_internal(struct mount *mp, ino_t ino, struct vnode **vpp, */ switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) { case VFIFO: - vp->v_vops = cd9660_fifo_vops; + vp->v_ops = mp->mnt_vn_fifo_ops; break; case VCHR: case VBLK: - vp->v_vops = cd9660_spec_vops; + vp->v_ops = mp->mnt_vn_spec_ops; addaliasu(vp, ip->inode.iso_rdev); break; default: diff --git a/sys/vfs/isofs/cd9660/cd9660_vnops.c b/sys/vfs/isofs/cd9660/cd9660_vnops.c index 0d3ff7a9fc..59f4e33df3 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vnops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vnops.c @@ -37,7 +37,7 @@ * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vnops.c,v 1.62 1999/12/15 23:01:51 eivind Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.10 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vnops.c,v 1.11 2004/08/17 18:57:33 dillon Exp $ */ #include @@ -842,8 +842,7 @@ cd9660_advlock(ap) /* * Global vfs data structures for cd9660 */ -struct vop_ops *cd9660_vnode_vops; -static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { +struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_default_desc, (void *) vop_defaultop }, { &vop_access_desc, (void *) cd9660_access }, { &vop_advlock_desc, (void *) cd9660_advlock }, @@ -868,15 +867,11 @@ static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_putpages_desc, (void *) cd9660_putpages }, { NULL, NULL } }; -static struct vnodeopv_desc cd9660_vnodeop_opv_desc = - { &cd9660_vnode_vops, cd9660_vnodeop_entries }; -VNODEOP_SET(cd9660_vnodeop_opv_desc); /* * Special device vnode ops */ -struct vop_ops *cd9660_spec_vops; -static struct vnodeopv_entry_desc cd9660_specop_entries[] = { +struct vnodeopv_entry_desc cd9660_specop_entries[] = { { &vop_default_desc, (void *) spec_vnoperate }, { &vop_access_desc, (void *) cd9660_access }, { &vop_getattr_desc, (void *) cd9660_getattr }, @@ -889,12 +884,8 @@ static struct vnodeopv_entry_desc cd9660_specop_entries[] = { { &vop_unlock_desc, (void *) vop_stdunlock }, { NULL, NULL } }; -static struct vnodeopv_desc cd9660_specop_opv_desc = - { &cd9660_spec_vops, cd9660_specop_entries }; -VNODEOP_SET(cd9660_specop_opv_desc); -struct vop_ops *cd9660_fifo_vops; -static struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { +struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { { &vop_default_desc, (void *) fifo_vnoperate }, { &vop_access_desc, (void *) cd9660_access }, { &vop_getattr_desc, (void *) cd9660_getattr }, @@ -907,7 +898,4 @@ static struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { { &vop_unlock_desc, (void *) vop_stdunlock }, { NULL, NULL } }; -static struct vnodeopv_desc cd9660_fifoop_opv_desc = - { &cd9660_fifo_vops, cd9660_fifoop_entries }; -VNODEOP_SET(cd9660_fifoop_opv_desc); diff --git a/sys/vfs/isofs/cd9660/iso.h b/sys/vfs/isofs/cd9660/iso.h index ecbdea89b3..6a38818b9d 100644 --- a/sys/vfs/isofs/cd9660/iso.h +++ b/sys/vfs/isofs/cd9660/iso.h @@ -37,7 +37,7 @@ * * @(#)iso.h 8.6 (Berkeley) 5/10/95 * $FreeBSD: src/sys/isofs/cd9660/iso.h,v 1.19.2.1 2000/07/08 14:35:56 bp Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/iso.h,v 1.4 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/iso.h,v 1.5 2004/08/17 18:57:33 dillon Exp $ */ #define ISODCL(from, to) (to - from + 1) @@ -263,10 +263,6 @@ int cd9660_uninit (struct vfsconf *); #define cd9660_sysctl ((int (*) (int *, u_int, void *, size_t *, void *, \ size_t, struct proc *))eopnotsupp) -extern struct vop_ops *cd9660_vnode_vops; -extern struct vop_ops *cd9660_spec_vops; -extern struct vop_ops *cd9660_fifo_vops; - int isochar (u_char *, u_char *, int, u_char *); int isofncmp (u_char *, int, u_char *, int, int); void isofntrans (u_char *, int, u_char *, u_short *, int, int, int); diff --git a/sys/vfs/mfs/mfs_vnops.c b/sys/vfs/mfs/mfs_vnops.c index 4f469cba7c..63b57d9c4e 100644 --- a/sys/vfs/mfs/mfs_vnops.c +++ b/sys/vfs/mfs/mfs_vnops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vnops.c 8.11 (Berkeley) 5/22/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vnops.c,v 1.47.2.1 2001/05/22 02:06:43 bp Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.14 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.15 2004/08/17 18:57:33 dillon Exp $ */ #include @@ -63,7 +63,8 @@ static int mfs_print (struct vop_print_args *); /* XXX */ static int mfs_strategy (struct vop_strategy_args *); /* XXX */ static int mfs_getpages (struct vop_getpages_args *); /* XXX */ /* - * mfs vnode operations. + * mfs vnode operations. Note: the vops here are used for the MFS block + * device, not for operations on files (MFS calls the ffs mount code for that) */ struct vop_ops *mfs_vnode_vops; static struct vnodeopv_entry_desc mfs_vnodeop_entries[] = { @@ -122,7 +123,7 @@ mfs_open(struct vop_open_args *ap) static int mfs_fsync(struct vop_fsync_args *ap) { - return (VOCALL(spec_vnode_vops, VOFFSET(vop_fsync), &ap->a_head)); + return (VOCALL(spec_vnode_vops, &ap->a_head)); } /* @@ -412,5 +413,5 @@ mfs_badop(struct vop_generic_args *ap) static int mfs_getpages(struct vop_getpages_args *ap) { - return (VOCALL(spec_vnode_vops, VOFFSET(vop_getpages), &ap->a_head)); + return (VOCALL(spec_vnode_vops, &ap->a_head)); } diff --git a/sys/vfs/msdosfs/denode.h b/sys/vfs/msdosfs/denode.h index 20ae751060..d9f6789c06 100644 --- a/sys/vfs/msdosfs/denode.h +++ b/sys/vfs/msdosfs/denode.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/denode.h,v 1.20 1999/12/29 04:54:52 peter Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/denode.h,v 1.6 2004/08/13 17:51:11 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/denode.h,v 1.7 2004/08/17 18:57:34 dillon Exp $ */ /* $NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $ */ /*- @@ -260,8 +260,6 @@ struct defid { #endif }; -extern struct vop_ops *msdosfs_vnode_vops; - int msdosfs_lookup (struct vop_cachedlookup_args *); int msdosfs_inactive (struct vop_inactive_args *); int msdosfs_reclaim (struct vop_reclaim_args *); diff --git a/sys/vfs/msdosfs/msdosfs_denode.c b/sys/vfs/msdosfs/msdosfs_denode.c index a831751d74..a323a3fe11 100644 --- a/sys/vfs/msdosfs/msdosfs_denode.c +++ b/sys/vfs/msdosfs/msdosfs_denode.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_denode.c,v 1.47.2.3 2002/08/22 16:20:15 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_denode.c,v 1.13 2004/08/13 17:51:11 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_denode.c,v 1.14 2004/08/17 18:57:34 dillon Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ /*- @@ -266,7 +266,7 @@ deget(struct msdosfsmount *pmp, /* so we know the maj/min number */ * copy it from the passed disk buffer. */ /* getnewvnode() does a vref() on the vnode */ - error = getnewvnode(VT_MSDOSFS, mntp, msdosfs_vnode_vops, &nvp); + error = getnewvnode(VT_MSDOSFS, mntp, mntp->mnt_vn_ops, &nvp); if (error) { *depp = NULL; FREE(ldep, M_MSDOSFSNODE); diff --git a/sys/vfs/msdosfs/msdosfs_vfsops.c b/sys/vfs/msdosfs/msdosfs_vfsops.c index e5e235cbed..4cf0629eb0 100644 --- a/sys/vfs/msdosfs/msdosfs_vfsops.c +++ b/sys/vfs/msdosfs/msdosfs_vfsops.c @@ -1,5 +1,5 @@ /* $FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/msdosfs/Attic/msdosfs_vfsops.c,v 1.60.2.8 2004/03/02 09:43:04 tjr Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.17 2004/08/02 13:22:34 joerg Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vfsops.c,v 1.18 2004/08/17 18:57:34 dillon Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */ /*- @@ -70,6 +70,8 @@ #include "msdosfsmount.h" #include "fat.h" +extern struct vnodeopv_entry_desc msdosfs_vnodeop_entries[]; + #define MSDOSFS_DFLTBSIZE 4096 #if 1 /*def PC98*/ @@ -209,6 +211,7 @@ msdosfs_mountroot(void) (void) copystr(ROOTNAME, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); + (void)msdosfs_statfs(mp, &mp->mnt_stat, p); vfs_unlock(mp); return (0); @@ -725,6 +728,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp, struct thread *td, mp->mnt_stat.f_fsid.val[0] = dev2udev(dev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; mp->mnt_flag |= MNT_LOCAL; + vfs_add_vnodeops(&mp->mnt_vn_ops, msdosfs_vnodeop_entries); dev->si_mountpoint = mp; return 0; diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c index 793e0c2e14..bf77ac737a 100644 --- a/sys/vfs/msdosfs/msdosfs_vnops.c +++ b/sys/vfs/msdosfs/msdosfs_vnops.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_vnops.c,v 1.95.2.4 2003/06/13 15:05:47 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.16 2004/08/13 17:51:11 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.17 2004/08/17 18:57:34 dillon Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -1895,8 +1895,7 @@ msdosfs_putpages(struct vop_putpages_args *ap) } /* Global vfs data structures for msdosfs */ -struct vop_ops *msdosfs_vnode_vops; -static struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = { +struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) msdosfs_access }, { &vop_bmap_desc, (void *) msdosfs_bmap }, @@ -1929,7 +1928,3 @@ static struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = { { &vop_putpages_desc, (void *) msdosfs_putpages }, { NULL, NULL } }; -static struct vnodeopv_desc msdosfs_vnodeop_opv_desc = - { &msdosfs_vnode_vops, msdosfs_vnodeop_entries }; - -VNODEOP_SET(msdosfs_vnodeop_opv_desc); diff --git a/sys/vfs/nfs/nfs_node.c b/sys/vfs/nfs/nfs_node.c index 5b44b5ce50..dc006c55bb 100644 --- a/sys/vfs/nfs/nfs_node.c +++ b/sys/vfs/nfs/nfs_node.c @@ -35,7 +35,7 @@ * * @(#)nfs_node.c 8.6 (Berkeley) 5/22/95 * $FreeBSD: src/sys/nfs/nfs_node.c,v 1.36.2.3 2002/01/05 22:25:04 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_node.c,v 1.11 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_node.c,v 1.12 2004/08/17 18:57:34 dillon Exp $ */ @@ -137,7 +137,7 @@ loop: */ np = zalloc(nfsnode_zone); - error = getnewvnode(VT_NFS, mntp, nfsv2_vnode_vops, &nvp); + error = getnewvnode(VT_NFS, mntp, mntp->mnt_vn_ops, &nvp); if (error) { if (nfs_node_hash_lock < 0) wakeup(&nfs_node_hash_lock); diff --git a/sys/vfs/nfs/nfs_subs.c b/sys/vfs/nfs/nfs_subs.c index 9a534b1b70..3b0ac748dd 100644 --- a/sys/vfs/nfs/nfs_subs.c +++ b/sys/vfs/nfs/nfs_subs.c @@ -35,7 +35,7 @@ * * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95 * $FreeBSD: /repoman/r/ncvs/src/sys/nfsclient/nfs_subs.c,v 1.128 2004/04/14 23:23:55 peadar Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.19 2004/08/13 17:51:11 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.20 2004/08/17 18:57:34 dillon Exp $ */ /* @@ -1242,11 +1242,12 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, if (vp->v_type != vtyp) { vp->v_type = vtyp; if (vp->v_type == VFIFO) { - vp->v_vops = fifo_nfsv2node_vops; - } - if (vp->v_type == VCHR || vp->v_type == VBLK) { - vp->v_vops = spec_nfsv2node_vops; + vp->v_ops = vp->v_mount->mnt_vn_fifo_ops; + } else if (vp->v_type == VCHR || vp->v_type == VBLK) { + vp->v_ops = vp->v_mount->mnt_vn_spec_ops; addaliasu(vp, rdev); + } else { + vp->v_ops = vp->v_mount->mnt_vn_ops; } np->n_mtime = mtime.tv_sec; } diff --git a/sys/vfs/nfs/nfs_vfsops.c b/sys/vfs/nfs/nfs_vfsops.c index 727116e6bd..5c74161421 100644 --- a/sys/vfs/nfs/nfs_vfsops.c +++ b/sys/vfs/nfs/nfs_vfsops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 * $FreeBSD: src/sys/nfs/nfs_vfsops.c,v 1.91.2.7 2003/01/27 20:04:08 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vfsops.c,v 1.19 2004/06/06 19:16:11 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vfsops.c,v 1.20 2004/08/17 18:57:34 dillon Exp $ */ #include "opt_bootp.h" @@ -75,6 +75,9 @@ extern int nfs_mountroot(struct mount *mp); extern void bootpc_init(void); extern int nfs_ticks; +extern struct vnodeopv_entry_desc nfsv2_vnodeop_entries[]; +extern struct vnodeopv_entry_desc nfsv2_fifoop_entries[]; +extern struct vnodeopv_entry_desc nfsv2_specop_entries[]; MALLOC_DEFINE(M_NFSREQ, "NFS req", "NFS request header"); MALLOC_DEFINE(M_NFSBIGFH, "NFSV3 bigfh", "NFS version 3 file handle"); @@ -953,6 +956,13 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, mp->mnt_stat.f_iosize = nfs_iosize(nmp->nm_flag & NFSMNT_NFSV3, nmp->nm_sotype); + /* + * Install vop_ops for our vnops + */ + vfs_add_vnodeops(&mp->mnt_vn_ops, nfsv2_vnodeop_entries); + vfs_add_vnodeops(&mp->mnt_vn_spec_ops, nfsv2_specop_entries); + vfs_add_vnodeops(&mp->mnt_vn_fifo_ops, nfsv2_fifoop_entries); + /* * A reference count is needed on the nfsnode representing the * remote root. If this object is not persistent, then backward diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index f9d973902b..b134f6575d 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.26 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.27 2004/08/17 18:57:34 dillon Exp $ */ @@ -138,8 +138,7 @@ static int nfs_bwrite (struct vop_bwrite_args *); /* * Global vfs data structures for nfs */ -struct vop_ops *nfsv2_vnode_vops; -static struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { +struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) nfs_access }, { &vop_advlock_desc, (void *) nfs_advlock }, @@ -177,15 +176,11 @@ static struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { { &vop_write_desc, (void *) nfs_write }, { NULL, NULL } }; -static struct vnodeopv_desc nfsv2_vnodeop_opv_desc = - { &nfsv2_vnode_vops, nfsv2_vnodeop_entries }; -VNODEOP_SET(nfsv2_vnodeop_opv_desc); /* * Special device vnode ops */ -struct vop_ops *spec_nfsv2node_vops; -static struct vnodeopv_entry_desc nfsv2_specop_entries[] = { +struct vnodeopv_entry_desc nfsv2_specop_entries[] = { { &vop_default_desc, (void *) spec_vnoperate }, { &vop_access_desc, (void *) nfsspec_access }, { &vop_close_desc, (void *) nfsspec_close }, @@ -202,12 +197,8 @@ static struct vnodeopv_entry_desc nfsv2_specop_entries[] = { { &vop_write_desc, (void *) nfsspec_write }, { NULL, NULL } }; -static struct vnodeopv_desc spec_nfsv2nodeop_opv_desc = - { &spec_nfsv2node_vops, nfsv2_specop_entries }; -VNODEOP_SET(spec_nfsv2nodeop_opv_desc); -struct vop_ops *fifo_nfsv2node_vops; -static struct vnodeopv_entry_desc nfsv2_fifoop_entries[] = { +struct vnodeopv_entry_desc nfsv2_fifoop_entries[] = { { &vop_default_desc, (void *) fifo_vnoperate }, { &vop_access_desc, (void *) nfsspec_access }, { &vop_close_desc, (void *) nfsfifo_close }, @@ -224,9 +215,6 @@ static struct vnodeopv_entry_desc nfsv2_fifoop_entries[] = { { &vop_write_desc, (void *) nfsfifo_write }, { NULL, NULL } }; -static struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc = - { &fifo_nfsv2node_vops, nfsv2_fifoop_entries }; -VNODEOP_SET(fifo_nfsv2nodeop_opv_desc); static int nfs_mknodrpc (struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, @@ -3200,7 +3188,7 @@ nfsspec_read(struct vop_read_args *ap) */ np->n_flag |= NACC; getnanotime(&np->n_atim); - return (VOCALL(spec_vnode_vops, VOFFSET(vop_read), &ap->a_head)); + return (VOCALL(spec_vnode_vops, &ap->a_head)); } /* @@ -3219,7 +3207,7 @@ nfsspec_write(struct vop_write_args *ap) */ np->n_flag |= NUPD; getnanotime(&np->n_mtim); - return (VOCALL(spec_vnode_vops, VOFFSET(vop_write), &ap->a_head)); + return (VOCALL(spec_vnode_vops, &ap->a_head)); } /* @@ -3249,7 +3237,7 @@ nfsspec_close(struct vop_close_args *ap) (void)VOP_SETATTR(vp, &vattr, nfs_vpcred(vp, ND_WRITE), ap->a_td); } } - return (VOCALL(spec_vnode_vops, VOFFSET(vop_close), &ap->a_head)); + return (VOCALL(spec_vnode_vops, &ap->a_head)); } /* @@ -3268,7 +3256,7 @@ nfsfifo_read(struct vop_read_args *ap) */ np->n_flag |= NACC; getnanotime(&np->n_atim); - return (VOCALL(fifo_vnode_vops, VOFFSET(vop_read), &ap->a_head)); + return (VOCALL(fifo_vnode_vops, &ap->a_head)); } /* @@ -3287,7 +3275,7 @@ nfsfifo_write(struct vop_write_args *ap) */ np->n_flag |= NUPD; getnanotime(&np->n_mtim); - return (VOCALL(fifo_vnode_vops, VOFFSET(vop_write), &ap->a_head)); + return (VOCALL(fifo_vnode_vops, &ap->a_head)); } /* @@ -3322,6 +3310,6 @@ nfsfifo_close(struct vop_close_args *ap) (void)VOP_SETATTR(vp, &vattr, nfs_vpcred(vp, ND_WRITE), ap->a_td); } } - return (VOCALL(fifo_vnode_vops, VOFFSET(vop_close), &ap->a_head)); + return (VOCALL(fifo_vnode_vops, &ap->a_head)); } diff --git a/sys/vfs/nfs/nfsnode.h b/sys/vfs/nfs/nfsnode.h index e8cf2587ea..a582516785 100644 --- a/sys/vfs/nfs/nfsnode.h +++ b/sys/vfs/nfs/nfsnode.h @@ -35,7 +35,7 @@ * * @(#)nfsnode.h 8.9 (Berkeley) 5/14/95 * $FreeBSD: /repoman/r/ncvs/src/sys/nfsclient/nfsnode.h,v 1.43 2004/04/14 23:23:55 peadar Exp $ - * $DragonFly: src/sys/vfs/nfs/nfsnode.h,v 1.10 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfsnode.h,v 1.11 2004/08/17 18:57:34 dillon Exp $ */ @@ -207,10 +207,6 @@ nfs_vpcred(struct vnode *vp, int ndflag) return(VFSTONFS((vp)->v_mount)->nm_cred); } -extern struct vop_ops *fifo_nfsv2node_vops; -extern struct vop_ops *nfsv2_vnode_vops; -extern struct vop_ops *spec_nfsv2node_vops; - /* * Prototypes for NFS vnode operations */ diff --git a/sys/vfs/ntfs/ntfs.h b/sys/vfs/ntfs/ntfs.h index b4f495be0f..977920dd7d 100644 --- a/sys/vfs/ntfs/ntfs.h +++ b/sys/vfs/ntfs/ntfs.h @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs.h,v 1.8.2.2 2001/10/12 22:08:49 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs.h,v 1.5 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs.h,v 1.6 2004/08/17 18:57:34 dillon Exp $ */ /*#define NTFS_DEBUG 1*/ @@ -336,4 +336,3 @@ typedef int (vop_t) (void *); #define ddprintf(a) #endif -extern struct vop_ops *ntfs_vnode_vops; diff --git a/sys/vfs/ntfs/ntfs_vfsops.c b/sys/vfs/ntfs/ntfs_vfsops.c index dd3c3be4d2..30655c9d34 100644 --- a/sys/vfs/ntfs/ntfs_vfsops.c +++ b/sys/vfs/ntfs/ntfs_vfsops.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vfsops.c,v 1.20.2.5 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vfsops.c,v 1.18 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_vfsops.c,v 1.19 2004/08/17 18:57:34 dillon Exp $ */ @@ -68,6 +68,8 @@ #include "ntfs_ihash.h" #include "ntfsmount.h" +extern struct vnodeopv_entry_desc ntfs_vnodeop_entries[]; + #if defined(__DragonFly__) MALLOC_DEFINE(M_NTFSMNT, "NTFS mount", "NTFS mount structure"); MALLOC_DEFINE(M_NTFSNTNODE,"NTFS ntnode", "NTFS ntnode information"); @@ -596,6 +598,9 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, mp->mnt_maxsymlinklen = 0; mp->mnt_flag |= MNT_LOCAL; dev->si_mountpoint = mp; + + vfs_add_vnodeops(&mp->mnt_vn_ops, ntfs_vnodeop_entries); + return (0); out1: @@ -913,7 +918,7 @@ ntfs_vgetex(struct mount *mp, ino_t ino, u_int32_t attrtype, char *attrname, return (0); } - error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, ntfs_vnode_vops, &vp); + error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, ntmp->ntm_mountp->mnt_vn_ops, &vp); if(error) { ntfs_frele(fp); ntfs_ntput(ip); diff --git a/sys/vfs/ntfs/ntfs_vnops.c b/sys/vfs/ntfs/ntfs_vnops.c index 48ad085bff..078554c511 100644 --- a/sys/vfs/ntfs/ntfs_vnops.c +++ b/sys/vfs/ntfs/ntfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ntfs/ntfs_vnops.c,v 1.9.2.4 2002/08/06 19:35:18 semenu Exp $ - * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.13 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/ntfs/ntfs_vnops.c,v 1.14 2004/08/17 18:57:34 dillon Exp $ * */ @@ -864,9 +864,6 @@ ntfs_pathconf(void *v) /* * Global vfs data structures */ -struct vop_ops *ntfs_vnode_vops; -#if defined(__DragonFly__) -static struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, @@ -899,63 +896,3 @@ struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { { NULL, NULL } }; -static -struct vnodeopv_desc ntfs_vnodeop_opv_desc = - { &ntfs_vnode_vops, ntfs_vnodeop_entries }; - -VNODEOP_SET(ntfs_vnodeop_opv_desc); - -#else /* !FreeBSD */ - -struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { - { &vop_default_desc, (void *) ntfs_bypass }, - { &vop_lookup_desc, (void *) ntfs_lookup }, /* lookup */ - { &vop_create_desc, genfs_eopnotsupp }, /* create */ - { &vop_mknod_desc, genfs_eopnotsupp }, /* mknod */ - { &vop_open_desc, (void *) ntfs_open }, /* open */ - { &vop_close_desc,(void *) ntfs_close }, /* close */ - { &vop_access_desc, (void *) ntfs_access }, /* access */ - { &vop_getattr_desc, (void *) ntfs_getattr }, /* getattr */ - { &vop_setattr_desc, genfs_eopnotsupp }, /* setattr */ - { &vop_read_desc, (void *) ntfs_read }, /* read */ - { &vop_write_desc, (void *) ntfs_write }, /* write */ - { &vop_lease_desc, genfs_lease_check }, /* lease */ - { &vop_fcntl_desc, genfs_fcntl }, /* fcntl */ - { &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */ - { &vop_poll_desc, genfs_poll }, /* poll */ - { &vop_revoke_desc, genfs_revoke }, /* revoke */ - { &vop_mmap_desc, genfs_eopnotsupp }, /* mmap */ - { &vop_fsync_desc, genfs_fsync }, /* fsync */ - { &vop_seek_desc, genfs_seek }, /* seek */ - { &vop_remove_desc, genfs_eopnotsupp }, /* remove */ - { &vop_link_desc, genfs_eopnotsupp }, /* link */ - { &vop_rename_desc, genfs_eopnotsupp }, /* rename */ - { &vop_mkdir_desc, genfs_eopnotsupp }, /* mkdir */ - { &vop_rmdir_desc, genfs_eopnotsupp }, /* rmdir */ - { &vop_symlink_desc, genfs_eopnotsupp }, /* symlink */ - { &vop_readdir_desc, (void *) ntfs_readdir }, /* readdir */ - { &vop_readlink_desc, genfs_eopnotsupp }, /* readlink */ - { &vop_abortop_desc, genfs_abortop }, /* abortop */ - { &vop_inactive_desc, (void *) ntfs_inactive }, /* inactive */ - { &vop_reclaim_desc, (void *) ntfs_reclaim }, /* reclaim */ - { &vop_lock_desc, genfs_lock }, /* lock */ - { &vop_unlock_desc, genfs_unlock }, /* unlock */ - { &vop_bmap_desc, (void *) ntfs_bmap }, /* bmap */ - { &vop_strategy_desc, (void *) ntfs_strategy }, /* strategy */ - { &vop_print_desc, (void *) ntfs_print }, /* print */ - { &vop_islocked_desc, genfs_islocked }, /* islocked */ - { &vop_pathconf_desc, ntfs_pathconf }, /* pathconf */ - { &vop_advlock_desc, genfs_nullop }, /* advlock */ - { &vop_blkatoff_desc, genfs_eopnotsupp }, /* blkatoff */ - { &vop_valloc_desc, genfs_eopnotsupp }, /* valloc */ - { &vop_reallocblks_desc, genfs_eopnotsupp }, /* reallocblks */ - { &vop_vfree_desc, genfs_eopnotsupp }, /* vfree */ - { &vop_truncate_desc, genfs_eopnotsupp }, /* truncate */ - { &vop_update_desc, genfs_eopnotsupp }, /* update */ - { &vop_bwrite_desc, vn_bwrite }, /* bwrite */ - { NULL, NULL } -}; -struct vnodeopv_desc ntfs_vnodeop_opv_desc = - { &ntfs_vnode_vops, ntfs_vnodeop_entries }; - -#endif diff --git a/sys/vfs/nullfs/null.h b/sys/vfs/nullfs/null.h index 4ec8efb2d3..3cc505c55d 100644 --- a/sys/vfs/nullfs/null.h +++ b/sys/vfs/nullfs/null.h @@ -36,7 +36,7 @@ * @(#)null.h 8.3 (Berkeley) 8/20/94 * * $FreeBSD: src/sys/miscfs/nullfs/null.h,v 1.11.2.3 2001/06/26 04:20:09 bp Exp $ - * $DragonFly: src/sys/vfs/nullfs/null.h,v 1.4 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nullfs/null.h,v 1.5 2004/08/17 18:57:34 dillon Exp $ */ struct null_args { @@ -76,7 +76,6 @@ struct vnode *null_checkvp(struct vnode *vp, char *fil, int lno); #define NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp) #endif -extern struct vop_ops *null_vnode_vops; extern struct lock null_hashlock; #ifdef MALLOC_DECLARE diff --git a/sys/vfs/nullfs/null_subr.c b/sys/vfs/nullfs/null_subr.c index e5068a970a..be187682ee 100644 --- a/sys/vfs/nullfs/null_subr.c +++ b/sys/vfs/nullfs/null_subr.c @@ -36,7 +36,7 @@ * @(#)null_subr.c 8.7 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/nullfs/null_subr.c,v 1.21.2.4 2001/06/26 04:20:09 bp Exp $ - * $DragonFly: src/sys/vfs/nullfs/Attic/null_subr.c,v 1.11 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nullfs/Attic/null_subr.c,v 1.12 2004/08/17 18:57:34 dillon Exp $ */ #include @@ -161,7 +161,7 @@ null_node_alloc(struct mount *mp, struct vnode *lowervp, struct vnode **vpp) MALLOC(xp, struct null_node *, sizeof(struct null_node), M_NULLFSNODE, M_WAITOK); - error = getnewvnode(VT_NULL, mp, null_vnode_vops, vpp); + error = getnewvnode(VT_NULL, mp, mp->mnt_vn_ops, vpp); if (error) { FREE(xp, M_NULLFSNODE); return (error); @@ -293,17 +293,6 @@ struct vnode * null_checkvp(struct vnode *vp, char *fil, int lno) { struct null_node *a = VTONULL(vp); -#ifdef notyet - /* - * Can't do this check because vop_reclaim runs - * with a funny vop vector. - */ - if (vp->v_vops != null_vnode_vops) { - printf ("null_checkvp: on non-null-node\n"); - while (null_checkvp_barrier) /*WAIT*/ ; - panic("null_checkvp"); - }; -#endif if (a->null_lowervp == NULLVP) { /* Should never happen */ int i; u_long *p; diff --git a/sys/vfs/nullfs/null_vfsops.c b/sys/vfs/nullfs/null_vfsops.c index f2d54c9fe7..d2fa168ec5 100644 --- a/sys/vfs/nullfs/null_vfsops.c +++ b/sys/vfs/nullfs/null_vfsops.c @@ -37,7 +37,7 @@ * * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 * $FreeBSD: src/sys/miscfs/nullfs/null_vfsops.c,v 1.35.2.3 2001/07/26 20:37:11 iedowse Exp $ - * $DragonFly: src/sys/vfs/nullfs/null_vfsops.c,v 1.10 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nullfs/null_vfsops.c,v 1.11 2004/08/17 18:57:34 dillon Exp $ */ /* @@ -55,6 +55,8 @@ #include #include "null.h" +extern struct vnodeopv_entry_desc null_vnodeop_entries[]; + static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure"); static int nullfs_fhtovp(struct mount *mp, struct fid *fidp, @@ -112,7 +114,7 @@ nullfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, * Unlock lower node to avoid deadlock. * (XXX) VOP_ISLOCKED is needed? */ - if ((mp->mnt_vnodecovered->v_vops == null_vnode_vops) && + if ((mp->mnt_vnodecovered->v_tag == VT_NULL) && VOP_ISLOCKED(mp->mnt_vnodecovered, NULL)) { VOP_UNLOCK(mp->mnt_vnodecovered, NULL, 0, td); isvnunlocked = 1; @@ -158,6 +160,8 @@ nullfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, */ xmp->nullm_vfs = lowerrootvp->v_mount; + vfs_add_vnodeops(&mp->mnt_vn_ops, null_vnodeop_entries); + /* * Save reference. Each mount also holds * a reference on the root vnode. diff --git a/sys/vfs/nullfs/null_vnops.c b/sys/vfs/nullfs/null_vnops.c index e32dcc476b..96d262cfc1 100644 --- a/sys/vfs/nullfs/null_vnops.c +++ b/sys/vfs/nullfs/null_vnops.c @@ -38,7 +38,7 @@ * Ancestors: * @(#)lofs_vnops.c 1.2 (Berkeley) 6/18/92 * $FreeBSD: src/sys/miscfs/nullfs/null_vnops.c,v 1.38.2.6 2002/07/31 00:32:28 semenu Exp $ - * $DragonFly: src/sys/vfs/nullfs/null_vnops.c,v 1.12 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nullfs/null_vnops.c,v 1.13 2004/08/17 18:57:34 dillon Exp $ * ...and... * @(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project * @@ -273,7 +273,7 @@ null_bypass(struct vop_generic_args *ap) * that aren't. (We must always map first vp or vclean fails.) */ if (i && (*this_vp_p == NULLVP || - (*this_vp_p)->v_vops != null_vnode_vops)) { + (*this_vp_p)->v_tag != VT_NULL)) { old_vps[i] = NULLVP; } else { old_vps[i] = *this_vp_p; @@ -290,12 +290,14 @@ null_bypass(struct vop_generic_args *ap) } /* - * Call the operation on the lower layer - * with the modified argument structure. + * Call the operation on the lower layer with the modified + * argument structure. We have to adjust a_fm to point to the + * lower vp's vop_ops structure. */ - if (vps_p[0] && *vps_p[0]) - error = VCALL(*(vps_p[0]), descp->vdesc_offset, ap); - else { + if (vps_p[0] && *vps_p[0]) { + ap->a_ops = (*(vps_p[0]))->v_ops; + error = vop_vnoperate_ap(ap); + } else { printf("null_bypass: no map for %s\n", descp->vdesc_name); error = EINVAL; } @@ -797,8 +799,7 @@ null_getvobject(struct vop_getvobject_args *ap) /* * Global vfs data structures */ -struct vop_ops *null_vnode_vops; -static struct vnodeopv_entry_desc null_vnodeop_entries[] = { +struct vnodeopv_entry_desc null_vnodeop_entries[] = { { &vop_default_desc, (void *) null_bypass }, { &vop_access_desc, (void *) null_access }, { &vop_createvobject_desc, (void *) null_createvobject }, @@ -817,7 +818,4 @@ static struct vnodeopv_entry_desc null_vnodeop_entries[] = { { &vop_unlock_desc, (void *) null_unlock }, { NULL, NULL } }; -static struct vnodeopv_desc null_vnodeop_opv_desc = - { &null_vnode_vops, null_vnodeop_entries }; -VNODEOP_SET(null_vnodeop_opv_desc); diff --git a/sys/vfs/nwfs/nwfs_node.c b/sys/vfs/nwfs/nwfs_node.c index 3dc3e1bae5..f67cc932fa 100644 --- a/sys/vfs/nwfs/nwfs_node.c +++ b/sys/vfs/nwfs/nwfs_node.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_node.c,v 1.3.2.8 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.12 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.13 2004/08/17 18:57:35 dillon Exp $ */ #include #include @@ -58,8 +58,6 @@ #define NWNOHASH(fhsum) (&nwhashtbl[(fhsum.f_id) & nwnodehash]) -extern struct vop_ops *nwfs_vnode_vops; - static LIST_HEAD(nwnode_hash_head,nwnode) *nwhashtbl; static u_long nwnodehash; static struct lock nwhashlock; @@ -166,7 +164,7 @@ rescan: * elsewhere if MALLOC should block. */ MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); - error = getnewvnode(VT_NWFS, mp, nwfs_vnode_vops, &vp); + error = getnewvnode(VT_NWFS, mp, mp->mnt_vn_ops, &vp); if (error) { *vpp = NULL; FREE(np, M_NWNODE); diff --git a/sys/vfs/nwfs/nwfs_vfsops.c b/sys/vfs/nwfs/nwfs_vfsops.c index 75d6ef942e..3ba33abed8 100644 --- a/sys/vfs/nwfs/nwfs_vfsops.c +++ b/sys/vfs/nwfs/nwfs_vfsops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vfsops.c,v 1.6.2.6 2001/10/25 19:18:54 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.10 2004/04/22 17:56:44 cpressey Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.11 2004/08/17 18:57:35 dillon Exp $ */ #include "opt_ncp.h" #ifndef NCP @@ -58,6 +58,8 @@ #include "nwfs_node.h" #include "nwfs_subr.h" +extern struct vnodeopv_entry_desc nwfs_vnodeop_entries[]; + int nwfs_debuglevel = 0; static int nwfs_version = NWFS_VERSION; @@ -218,6 +220,9 @@ nwfs_mount(struct mount *mp, char *path, caddr_t data, } /* protect against invalid mount points */ nmp->m.mount_point[sizeof(nmp->m.mount_point)-1] = '\0'; + + vfs_add_vnodeops(&mp->mnt_vn_ops, nwfs_vnodeop_entries); + vfs_getnewfsid(mp); error = nwfs_root(mp, &vp); if (error) diff --git a/sys/vfs/nwfs/nwfs_vnops.c b/sys/vfs/nwfs/nwfs_vnops.c index 35cff600b9..4e35ecda5d 100644 --- a/sys/vfs/nwfs/nwfs_vnops.c +++ b/sys/vfs/nwfs/nwfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vnops.c,v 1.6.2.3 2001/03/14 11:26:59 bp Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vnops.c,v 1.13 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_vnops.c,v 1.14 2004/08/17 18:57:35 dillon Exp $ */ #include #include @@ -84,8 +84,7 @@ static int nwfs_print(struct vop_print_args *); static int nwfs_pathconf(struct vop_pathconf_args *ap); /* Global vfs data structures for nwfs */ -struct vop_ops *nwfs_vnode_vops; -static struct vnodeopv_entry_desc nwfs_vnodeop_entries[] = { +struct vnodeopv_entry_desc nwfs_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) nwfs_access }, { &vop_bmap_desc, (void *) nwfs_bmap }, @@ -119,10 +118,6 @@ static struct vnodeopv_entry_desc nwfs_vnodeop_entries[] = { { &vop_write_desc, (void *) nwfs_write }, { NULL, NULL } }; -static struct vnodeopv_desc nwfs_vnodeop_opv_desc = - { &nwfs_vnode_vops, nwfs_vnodeop_entries }; - -VNODEOP_SET(nwfs_vnodeop_opv_desc); /* * nwfs_access vnode op diff --git a/sys/vfs/portal/portal.h b/sys/vfs/portal/portal.h index 7bf71cfcf2..e42a9d54f3 100644 --- a/sys/vfs/portal/portal.h +++ b/sys/vfs/portal/portal.h @@ -36,7 +36,7 @@ * @(#)portal.h 8.4 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/portal/portal.h,v 1.7 1999/12/29 04:54:45 peter Exp $ - * $DragonFly: src/sys/vfs/portal/portal.h,v 1.3 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/portal/portal.h,v 1.4 2004/08/17 18:57:35 dillon Exp $ */ struct portal_args { @@ -68,5 +68,4 @@ struct portalnode { #define PORTAL_ROOTFILEID 2 -extern struct vop_ops *portal_vnode_vops; #endif /* _KERNEL */ diff --git a/sys/vfs/portal/portal_vfsops.c b/sys/vfs/portal/portal_vfsops.c index f59069708f..6c2a31c822 100644 --- a/sys/vfs/portal/portal_vfsops.c +++ b/sys/vfs/portal/portal_vfsops.c @@ -36,7 +36,7 @@ * @(#)portal_vfsops.c 8.11 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vfsops.c,v 1.26.2.2 2001/07/26 20:37:16 iedowse Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.9 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/portal/portal_vfsops.c,v 1.10 2004/08/17 18:57:35 dillon Exp $ */ /* @@ -58,6 +58,8 @@ #include #include "portal.h" +extern struct vnodeopv_entry_desc portal_vnodeop_entries[]; + static MALLOC_DEFINE(M_PORTALFSMNT, "PORTAL mount", "PORTAL mount structure"); static int portal_mount (struct mount *mp, char *path, caddr_t data, @@ -110,7 +112,10 @@ portal_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, MALLOC(fmp, struct portalmount *, sizeof(struct portalmount), M_PORTALFSMNT, M_WAITOK); /* XXX */ - error = getnewvnode(VT_PORTAL, mp, portal_vnode_vops, &rvp); /* XXX */ + + vfs_add_vnodeops(&mp->mnt_vn_ops, portal_vnodeop_entries); + + error = getnewvnode(VT_PORTAL, mp, mp->mnt_vn_ops, &rvp); /* XXX */ if (error) { FREE(fmp, M_PORTALFSMNT); FREE(pn, M_TEMP); diff --git a/sys/vfs/portal/portal_vnops.c b/sys/vfs/portal/portal_vnops.c index 376a771d33..c080444b66 100644 --- a/sys/vfs/portal/portal_vnops.c +++ b/sys/vfs/portal/portal_vnops.c @@ -36,7 +36,7 @@ * @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vnops.c,v 1.38 1999/12/21 06:29:00 chris Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.14 2004/08/13 17:51:12 dillon Exp $ + * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.15 2004/08/17 18:57:35 dillon Exp $ */ /* @@ -135,7 +135,7 @@ portal_lookup(struct vop_lookup_args *ap) MALLOC(pt, struct portalnode *, sizeof(struct portalnode), M_TEMP, M_WAITOK); - error = getnewvnode(VT_PORTAL, dvp->v_mount, portal_vnode_vops, &fvp); + error = getnewvnode(VT_PORTAL, dvp->v_mount, dvp->v_mount->mnt_vn_ops, &fvp); if (error) { FREE(pt, M_TEMP); goto bad; @@ -566,8 +566,7 @@ portal_badop(void) /* NOTREACHED */ } -struct vop_ops *portal_vnode_vops; -static struct vnodeopv_entry_desc portal_vnodeop_entries[] = { +struct vnodeopv_entry_desc portal_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, vop_null }, { &vop_bmap_desc, (void *) portal_badop }, @@ -582,7 +581,4 @@ static struct vnodeopv_entry_desc portal_vnodeop_entries[] = { { &vop_setattr_desc, (void *) portal_setattr }, { NULL, NULL } }; -static struct vnodeopv_desc portal_vnodeop_opv_desc = - { &portal_vnode_vops, portal_vnodeop_entries }; -VNODEOP_SET(portal_vnodeop_opv_desc); diff --git a/sys/vfs/procfs/procfs.h b/sys/vfs/procfs/procfs.h index 978671e534..906ee98509 100644 --- a/sys/vfs/procfs/procfs.h +++ b/sys/vfs/procfs/procfs.h @@ -38,7 +38,7 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs.h,v 1.32.2.3 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs.h,v 1.6 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs.h,v 1.7 2004/08/17 18:57:35 dillon Exp $ */ /* @@ -158,8 +158,7 @@ int procfs_validtype (struct proc *); #define PROCFS_LOCKED 0x01 #define PROCFS_WANT 0x02 -extern struct vop_ops *procfs_vnode_vops; - int procfs_root (struct mount *, struct vnode **); int procfs_rw (struct vop_read_args *); + #endif /* _KERNEL */ diff --git a/sys/vfs/procfs/procfs_subr.c b/sys/vfs/procfs/procfs_subr.c index cfe2441266..e00543b195 100644 --- a/sys/vfs/procfs/procfs_subr.c +++ b/sys/vfs/procfs/procfs_subr.c @@ -37,7 +37,7 @@ * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_subr.c,v 1.26.2.3 2002/02/18 21:28:04 des Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_subr.c,v 1.8 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_subr.c,v 1.9 2004/08/17 18:57:35 dillon Exp $ */ #include @@ -119,7 +119,7 @@ loop: */ MALLOC(pfs, struct pfsnode *, sizeof(struct pfsnode), M_TEMP, M_WAITOK); - if ((error = getnewvnode(VT_PROCFS, mp, procfs_vnode_vops, vpp)) != 0) { + if ((error = getnewvnode(VT_PROCFS, mp, mp->mnt_vn_ops, vpp)) != 0) { FREE(pfs, M_TEMP); goto out; } diff --git a/sys/vfs/procfs/procfs_vfsops.c b/sys/vfs/procfs/procfs_vfsops.c index eaca6af812..b58c2f41ab 100644 --- a/sys/vfs/procfs/procfs_vfsops.c +++ b/sys/vfs/procfs/procfs_vfsops.c @@ -37,7 +37,7 @@ * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_vfsops.c,v 1.32.2.1 2001/10/15 20:42:01 des Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_vfsops.c,v 1.6 2004/05/02 03:05:11 cpressey Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_vfsops.c,v 1.7 2004/08/17 18:57:35 dillon Exp $ */ /* @@ -52,6 +52,8 @@ #include #include +extern struct vnodeopv_entry_desc procfs_vnodeop_entries[]; + static int procfs_mount (struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct thread *td); static int procfs_statfs (struct mount *mp, struct statfs *sbp, @@ -90,7 +92,8 @@ procfs_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, size = sizeof("procfs") - 1; bcopy("procfs", mp->mnt_stat.f_mntfromname, size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void)procfs_statfs(mp, &mp->mnt_stat, td); + procfs_statfs(mp, &mp->mnt_stat, td); + vfs_add_vnodeops(&mp->mnt_vn_ops, procfs_vnodeop_entries); return (0); } diff --git a/sys/vfs/procfs/procfs_vnops.c b/sys/vfs/procfs/procfs_vnops.c index 4e3bc5f99a..99beafcc35 100644 --- a/sys/vfs/procfs/procfs_vnops.c +++ b/sys/vfs/procfs/procfs_vnops.c @@ -37,7 +37,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_vnops.c,v 1.76.2.7 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.17 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.18 2004/08/17 18:57:35 dillon Exp $ */ /* @@ -988,8 +988,7 @@ atopid(const char *b, u_int len) /* * procfs vnode operations. */ -struct vop_ops *procfs_vnode_vops; -static struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { +struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) procfs_access }, { &vop_advlock_desc, (void *) procfs_badop }, @@ -1018,7 +1017,4 @@ static struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { { &vop_ioctl_desc, (void *) procfs_ioctl }, { NULL, NULL } }; -static struct vnodeopv_desc procfs_vnodeop_opv_desc = - { &procfs_vnode_vops, procfs_vnodeop_entries }; -VNODEOP_SET(procfs_vnodeop_opv_desc); diff --git a/sys/vfs/smbfs/smbfs_node.c b/sys/vfs/smbfs/smbfs_node.c index c80f36c47e..c8421c0912 100644 --- a/sys/vfs/smbfs/smbfs_node.c +++ b/sys/vfs/smbfs/smbfs_node.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_node.c,v 1.2.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.11 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.12 2004/08/17 18:57:35 dillon Exp $ */ #include #include @@ -60,8 +60,6 @@ #define smbfs_hash_unlock(smp, td) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL, td) -extern struct vop_ops *smbfs_vnode_vops; - MALLOC_DEFINE(M_SMBNODE, "SMBFS node", "SMBFS vnode private part"); static MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name"); @@ -221,7 +219,7 @@ loop: return ENOENT; MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); - error = getnewvnode(VT_SMBFS, mp, smbfs_vnode_vops, &vp); + error = getnewvnode(VT_SMBFS, mp, mp->mnt_vn_ops, &vp); if (error) { FREE(np, M_SMBNODE); return error; diff --git a/sys/vfs/smbfs/smbfs_vfsops.c b/sys/vfs/smbfs/smbfs_vfsops.c index 2ed17904d3..4f76325be2 100644 --- a/sys/vfs/smbfs/smbfs_vfsops.c +++ b/sys/vfs/smbfs/smbfs_vfsops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vfsops.c,v 1.2.2.5 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vfsops.c,v 1.12 2004/05/03 05:19:50 cpressey Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_vfsops.c,v 1.13 2004/08/17 18:57:35 dillon Exp $ */ #include "opt_netsmb.h" #ifndef NETSMB @@ -60,6 +60,8 @@ #include +extern struct vnodeopv_entry_desc smbfs_vnodeop_entries[]; + int smbfs_debuglevel = 0; static int smbfs_version = SMBFS_VERSION; @@ -221,6 +223,9 @@ smbfs_mount(struct mount *mp, char *path, caddr_t data, /* protect against invalid mount points */ smp->sm_args.mount_point[sizeof(smp->sm_args.mount_point) - 1] = '\0'; vfs_getnewfsid(mp); + + vfs_add_vnodeops(&mp->mnt_vn_ops, smbfs_vnodeop_entries); + error = smbfs_root(mp, &vp); if (error) goto bad; diff --git a/sys/vfs/smbfs/smbfs_vnops.c b/sys/vfs/smbfs/smbfs_vnops.c index 02e4a081e7..df0c4e2547 100644 --- a/sys/vfs/smbfs/smbfs_vnops.c +++ b/sys/vfs/smbfs/smbfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.2.2.8 2003/04/04 08:57:23 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.14 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.15 2004/08/17 18:57:35 dillon Exp $ */ #include #include @@ -86,8 +86,7 @@ static int smbfs_pathconf(struct vop_pathconf_args *ap); static int smbfs_advlock(struct vop_advlock_args *); static int smbfs_getextattr(struct vop_getextattr_args *ap); -struct vop_ops *smbfs_vnode_vops; -static struct vnodeopv_entry_desc smbfs_vnodeop_entries[] = { +struct vnodeopv_entry_desc smbfs_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) smbfs_access }, { &vop_advlock_desc, (void *) smbfs_advlock }, @@ -125,11 +124,6 @@ static struct vnodeopv_entry_desc smbfs_vnodeop_entries[] = { { NULL, NULL } }; -static struct vnodeopv_desc smbfs_vnodeop_opv_desc = - { &smbfs_vnode_vops, smbfs_vnodeop_entries }; - -VNODEOP_SET(smbfs_vnodeop_opv_desc); - /* * smbfs_access(struct vnode *a_vp, int a_mode, struct ucred *a_cred, * struct thread *a_td) diff --git a/sys/vfs/specfs/spec_vnops.c b/sys/vfs/specfs/spec_vnops.c index b9021da4ca..2992d20189 100644 --- a/sys/vfs/specfs/spec_vnops.c +++ b/sys/vfs/specfs/spec_vnops.c @@ -32,7 +32,7 @@ * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 * $FreeBSD: src/sys/miscfs/specfs/spec_vnops.c,v 1.131.2.4 2001/02/26 04:23:20 jlemon Exp $ - * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.19 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.20 2004/08/17 18:57:35 dillon Exp $ */ #include @@ -73,7 +73,7 @@ static int spec_strategy (struct vop_strategy_args *); static int spec_write (struct vop_write_args *); struct vop_ops *spec_vnode_vops; -static struct vnodeopv_entry_desc spec_vnodeop_entries[] = { +struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, vop_ebadf }, { &vop_advlock_desc, (void *) spec_advlock }, @@ -110,7 +110,6 @@ static struct vnodeopv_entry_desc spec_vnodeop_entries[] = { }; static struct vnodeopv_desc spec_vnodeop_opv_desc = { &spec_vnode_vops, spec_vnodeop_entries }; - VNODEOP_SET(spec_vnodeop_opv_desc); extern int dev_ref_debug; @@ -121,7 +120,7 @@ extern int dev_ref_debug; int spec_vnoperate(struct vop_generic_args *ap) { - return (VOCALL(spec_vnode_vops, ap->a_desc->vdesc_offset, ap)); + return (VOCALL(spec_vnode_vops, ap)); } static void spec_getpages_iodone (struct buf *bp); diff --git a/sys/vfs/udf/udf_vfsops.c b/sys/vfs/udf/udf_vfsops.c index 1760170127..7e206e5c3b 100644 --- a/sys/vfs/udf/udf_vfsops.c +++ b/sys/vfs/udf/udf_vfsops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/udf/udf_vfsops.c,v 1.16 2003/11/05 06:56:08 scottl Exp $ - * $DragonFly: src/sys/vfs/udf/udf_vfsops.c,v 1.6 2004/05/26 07:45:26 dillon Exp $ + * $DragonFly: src/sys/vfs/udf/udf_vfsops.c,v 1.7 2004/08/17 18:57:35 dillon Exp $ */ /* udf_vfsops.c */ @@ -94,6 +94,8 @@ #include #include +extern struct vnodeopv_entry_desc udf_vnodeop_entries[]; + MALLOC_DEFINE(M_UDFNODE, "UDF node", "UDF node structure"); MALLOC_DEFINE(M_UDFMOUNT, "UDF mount", "UDF mount structure"); MALLOC_DEFINE(M_UDFFENTRY, "UDF fentry", "UDF file entry structure"); @@ -363,7 +365,9 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) printf("Couldn't find the fsd\n"); error = EINVAL; goto bail; - } + } + + vfs_add_vnodeops(&mp->mnt_vn_ops, udf_vnodeop_entries); /* * Find the file entry for the root directory. diff --git a/sys/vfs/udf/udf_vnops.c b/sys/vfs/udf/udf_vnops.c index b040fce312..38ce212202 100644 --- a/sys/vfs/udf/udf_vnops.c +++ b/sys/vfs/udf/udf_vnops.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/udf/udf_vnops.c,v 1.33 2003/12/07 05:04:49 scottl Exp $ - * $DragonFly: src/sys/vfs/udf/udf_vnops.c,v 1.5 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/udf/udf_vnops.c,v 1.6 2004/08/17 18:57:35 dillon Exp $ */ /* udf_vnops.c */ @@ -64,8 +64,7 @@ static int udf_reclaim(struct vop_reclaim_args *); static int udf_readatoffset(struct udf_node *, int *, int, struct buf **, uint8_t **); static int udf_bmap_internal(struct udf_node *, uint32_t, daddr_t *, uint32_t *); -struct vop_ops *udf_vnode_vops; -static struct vnodeopv_entry_desc udf_vnodeop_entries[] = { +struct vnodeopv_entry_desc udf_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) udf_access }, { &vop_bmap_desc, (void *) udf_bmap }, @@ -81,9 +80,6 @@ static struct vnodeopv_entry_desc udf_vnodeop_entries[] = { { &vop_strategy_desc, (void *) udf_strategy }, { NULL, NULL } }; -static struct vnodeopv_desc udf_vnodeop_opv_desc = - { &udf_vnode_vops, udf_vnodeop_entries }; -VNODEOP_SET(udf_vnodeop_opv_desc); MALLOC_DEFINE(M_UDFFID, "UDF FID", "UDF FileId structure"); MALLOC_DEFINE(M_UDFDS, "UDF DS", "UDF Dirstream structure"); @@ -182,7 +178,7 @@ udf_allocv(struct mount *mp, struct vnode **vpp) int error; struct vnode *vp; - error = getnewvnode(VT_UDF, mp, udf_vnode_vops, &vp); + error = getnewvnode(VT_UDF, mp, mp->mnt_vn_ops, &vp); if (error) { printf("udf_allocv: failed to allocate new vnode\n"); return(error); diff --git a/sys/vfs/ufs/ffs_extern.h b/sys/vfs/ufs/ffs_extern.h index 316639ba4d..ee45d1fc4f 100644 --- a/sys/vfs/ufs/ffs_extern.h +++ b/sys/vfs/ufs/ffs_extern.h @@ -32,7 +32,7 @@ * * @(#)ffs_extern.h 8.6 (Berkeley) 3/30/95 * $FreeBSD: src/sys/ufs/ffs/ffs_extern.h,v 1.30 2000/01/09 22:40:02 mckusick Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_extern.h,v 1.7 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_extern.h,v 1.8 2004/08/17 18:57:36 dillon Exp $ */ #ifndef _UFS_FFS_EXTERN_H @@ -102,10 +102,6 @@ int ffs_vfree(struct vnode *, ino_t, int); int ffs_vget(struct mount *, ino_t, struct vnode **); int ffs_vptofh(struct vnode *, struct fid *); -extern struct vop_ops *ffs_vnode_vops; -extern struct vop_ops *ffs_spec_vops; -extern struct vop_ops *ffs_fifo_vops; - /* * Soft update function prototypes. */ diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c index c63da65104..cc5d8550d4 100644 --- a/sys/vfs/ufs/ffs_vfsops.c +++ b/sys/vfs/ufs/ffs_vfsops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vfsops.c,v 1.117.2.10 2002/06/23 22:34:52 iedowse Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.20 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vfsops.c,v 1.21 2004/08/17 18:57:36 dillon Exp $ */ #include "opt_quota.h" @@ -90,6 +90,11 @@ static struct vfsops ufs_vfsops = { VFS_SET(ufs_vfsops, ufs, 0); +extern struct vnodeopv_entry_desc ffs_vnodeop_entries[]; +extern struct vnodeopv_entry_desc ffs_specop_entries[]; +extern struct vnodeopv_entry_desc ffs_fifoop_entries[]; + + /* * ffs_mount * @@ -804,6 +809,10 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, fs->fs_clean = 0; (void) ffs_sbupdate(ump, MNT_WAIT); } + vfs_add_vnodeops(&mp->mnt_vn_ops, ffs_vnodeop_entries); + vfs_add_vnodeops(&mp->mnt_vn_spec_ops, ffs_specop_entries); + vfs_add_vnodeops(&mp->mnt_vn_fifo_ops, ffs_fifoop_entries); + return (0); out: dev->si_mountpoint = NULL; @@ -1142,7 +1151,7 @@ restart: ump->um_malloctype, M_WAITOK); /* Allocate a new vnode/inode. */ - error = getnewvnode(VT_UFS, mp, ffs_vnode_vops, &vp); + error = getnewvnode(VT_UFS, mp, mp->mnt_vn_ops, &vp); if (error) { if (ffs_inode_hash_lock < 0) wakeup(&ffs_inode_hash_lock); @@ -1207,7 +1216,7 @@ restart: * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - error = ufs_vinit(mp, ffs_spec_vops, ffs_fifo_vops, &vp); + error = ufs_vinit(mp, &vp); if (error) { vput(vp); *vpp = NULL; diff --git a/sys/vfs/ufs/ffs_vnops.c b/sys/vfs/ufs/ffs_vnops.c index 88c48fa4ae..28006a29df 100644 --- a/sys/vfs/ufs/ffs_vnops.c +++ b/sys/vfs/ufs/ffs_vnops.c @@ -32,7 +32,7 @@ * * @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95 * $FreeBSD: src/sys/ufs/ffs/ffs_vnops.c,v 1.64 2000/01/10 12:04:25 phk Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_vnops.c,v 1.9 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_vnops.c,v 1.10 2004/08/17 18:57:36 dillon Exp $ */ #include @@ -71,8 +71,7 @@ static int ffs_read (struct vop_read_args *); static int ffs_write (struct vop_write_args *); /* Global vfs data structures for ufs. */ -struct vop_ops *ffs_vnode_vops; -static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { +struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_default_desc, (void *) ufs_vnoperate }, { &vop_fsync_desc, (void *) ffs_fsync }, { &vop_getpages_desc, (void *) ffs_getpages }, @@ -83,30 +82,18 @@ static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { { &vop_write_desc, (void *) ffs_write }, { NULL, NULL } }; -static struct vnodeopv_desc ffs_vnodeop_opv_desc = - { &ffs_vnode_vops, ffs_vnodeop_entries }; -struct vop_ops *ffs_spec_vops; -static struct vnodeopv_entry_desc ffs_specop_entries[] = { +struct vnodeopv_entry_desc ffs_specop_entries[] = { { &vop_default_desc, (void *) ufs_vnoperatespec }, { &vop_fsync_desc, (void *) ffs_fsync }, { NULL, NULL } }; -static struct vnodeopv_desc ffs_specop_opv_desc = - { &ffs_spec_vops, ffs_specop_entries }; -struct vop_ops *ffs_fifo_vops; -static struct vnodeopv_entry_desc ffs_fifoop_entries[] = { +struct vnodeopv_entry_desc ffs_fifoop_entries[] = { { &vop_default_desc, (void *) ufs_vnoperatefifo }, { &vop_fsync_desc, (void *) ffs_fsync }, { NULL, NULL } }; -static struct vnodeopv_desc ffs_fifoop_opv_desc = - { &ffs_fifo_vops, ffs_fifoop_entries }; - -VNODEOP_SET(ffs_vnodeop_opv_desc); -VNODEOP_SET(ffs_specop_opv_desc); -VNODEOP_SET(ffs_fifoop_opv_desc); #include "ufs_readwrite.c" diff --git a/sys/vfs/ufs/ufs_extern.h b/sys/vfs/ufs/ufs_extern.h index a036d3dbf7..552517c6b6 100644 --- a/sys/vfs/ufs/ufs_extern.h +++ b/sys/vfs/ufs/ufs_extern.h @@ -32,7 +32,7 @@ * * @(#)ufs_extern.h 8.10 (Berkeley) 5/14/95 * $FreeBSD: src/sys/ufs/ufs/ufs_extern.h,v 1.27.2.1 2000/12/28 11:01:46 ps Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_extern.h,v 1.7 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_extern.h,v 1.8 2004/08/17 18:57:36 dillon Exp $ */ #ifndef _UFS_UFS_EXTERN_H_ @@ -90,8 +90,7 @@ int ufs_lookup(struct vop_cachedlookup_args *); int ufs_reclaim(struct vop_reclaim_args *); int ufs_root(struct mount *, struct vnode **); int ufs_start(struct mount *, int, struct thread *); -int ufs_vinit(struct mount *, struct vop_ops *, struct vop_ops *, - struct vnode **); +int ufs_vinit(struct mount *, struct vnode **); /* * Soft update function prototypes. diff --git a/sys/vfs/ufs/ufs_vnops.c b/sys/vfs/ufs/ufs_vnops.c index 0a80bd05db..5733cc3130 100644 --- a/sys/vfs/ufs/ufs_vnops.c +++ b/sys/vfs/ufs/ufs_vnops.c @@ -37,7 +37,7 @@ * * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * $FreeBSD: src/sys/ufs/ufs/ufs_vnops.c,v 1.131.2.8 2003/01/02 17:26:19 bde Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.16 2004/08/13 17:51:13 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.17 2004/08/17 18:57:36 dillon Exp $ */ #include "opt_quota.h" @@ -184,6 +184,7 @@ ufs_itimes(struct vnode *vp) * ufs_create(struct vnode *a_dvp, struct vnode **a_vpp, * struct componentname *a_cnp, struct vattr *a_vap) */ +static int ufs_create(struct vop_create_args *ap) { @@ -205,6 +206,7 @@ ufs_create(struct vop_create_args *ap) * struct componentname *a_cnp, struct vattr *a_vap) */ /* ARGSUSED */ +static int ufs_mknod(struct vop_mknod_args *ap) { @@ -254,6 +256,7 @@ ufs_mknod(struct vop_mknod_args *ap) * struct thread *a_td) */ /* ARGSUSED */ +static int ufs_open(struct vop_open_args *ap) { @@ -275,6 +278,7 @@ ufs_open(struct vop_open_args *ap) * struct thread *a_td) */ /* ARGSUSED */ +static int ufs_close(struct vop_close_args *ap) { @@ -292,6 +296,7 @@ ufs_close(struct vop_close_args *ap) * ufs_access(struct vnode *a_vp, int a_mode, struct ucred *a_cred, * struct thread *a_td) */ +static int ufs_access(struct vop_access_args *ap) { @@ -375,6 +380,7 @@ ufs_access(struct vop_access_args *ap) * struct thread *a_td) */ /* ARGSUSED */ +static int ufs_getattr(struct vop_getattr_args *ap) { @@ -416,6 +422,7 @@ ufs_getattr(struct vop_getattr_args *ap) * ufs_setattr(struct vnode *a_vp, struct vattr *a_vap, * struct ucred *a_cred, struct thread *a_td) */ +static int ufs_setattr(struct vop_setattr_args *ap) { @@ -662,6 +669,7 @@ good: * struct thread *a_td) */ /* ARGSUSED */ +static int ufs_mmap(struct vop_mmap_args *ap) { @@ -672,6 +680,7 @@ ufs_mmap(struct vop_mmap_args *ap) * ufs_remove(struct vnode *a_dvp, struct vnode *a_vp, * struct componentname *a_cnp) */ +static int ufs_remove(struct vop_remove_args *ap) { @@ -699,6 +708,7 @@ out: * ufs_link(struct vnode *a_tdvp, struct vnode *a_vp, * struct componentname *a_cnp) */ +static int ufs_link(struct vop_link_args *ap) { @@ -762,6 +772,7 @@ out2: * * ufs_whiteout(struct vnode *a_dvp, struct componentname *a_cnp, int a_flags) */ +static int ufs_whiteout(struct vop_whiteout_args *ap) { @@ -837,6 +848,7 @@ ufs_whiteout(struct vop_whiteout_args *ap) * struct componentname *a_fcnp, struct vnode *a_tdvp, * struct vnode *a_tvp, struct componentname *a_tcnp) */ +static int ufs_rename(struct vop_rename_args *ap) { @@ -1198,6 +1210,7 @@ out: * ufs_mkdir(struct vnode *a_dvp, struct vnode **a_vpp, * struct componentname *a_cnp, struct vattr *a_vap) */ +static int ufs_mkdir(struct vop_mkdir_args *ap) { @@ -1399,6 +1412,7 @@ out: * ufs_rmdir(struct vnode *a_dvp, struct vnode *a_vp, * struct componentname *a_cnp) */ +static int ufs_rmdir(struct vop_rmdir_args *ap) { @@ -1495,6 +1509,7 @@ out: * struct componentname *a_cnp, struct vattr *a_vap, * char *a_target) */ +static int ufs_symlink(struct vop_symlink_args *ap) { @@ -1535,6 +1550,7 @@ ufs_symlink(struct vop_symlink_args *ap) * ufs_readdir(struct vnode *a_vp, struct uio *a_uio, struct ucred *a_cred, * int *a_eofflag, int *ncookies, u_long **a_cookies) */ +static int ufs_readdir(struct vop_readdir_args *ap) { @@ -1639,6 +1655,7 @@ ufs_readdir(struct vop_readdir_args *ap) * * ufs_readlink(struct vnode *a_vp, struct uio *a_uio, struct ucred *a_cred) */ +static int ufs_readlink(struct vop_readlink_args *ap) { @@ -1664,6 +1681,7 @@ ufs_readlink(struct vop_readlink_args *ap) * * ufs_strategy(struct vnode *a_vp, struct buf *a_bp) */ +static int ufs_strategy(struct vop_strategy_args *ap) { @@ -1701,6 +1719,7 @@ ufs_strategy(struct vop_strategy_args *ap) * * ufs_print(struct vnode *a_vp) */ +static int ufs_print(struct vop_print_args *ap) { @@ -1723,6 +1742,7 @@ ufs_print(struct vop_print_args *ap) * ufsspec_read(struct vnode *a_vp, struct uio *a_uio, int a_ioflag, * struct ucred *a_cred) */ +static int ufsspec_read(struct vop_read_args *ap) { @@ -1732,7 +1752,7 @@ ufsspec_read(struct vop_read_args *ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(spec_vnode_vops, VOFFSET(vop_read), &ap->a_head); + error = VOCALL(spec_vnode_vops, &ap->a_head); /* * The inode may have been revoked during the call, so it must not * be accessed blindly here or in the other wrapper functions. @@ -1749,6 +1769,7 @@ ufsspec_read(struct vop_read_args *ap) * ufsspec_write(struct vnode *a_vp, struct uio *a_uio, int a_ioflag, * struct ucred *a_cred) */ +static int ufsspec_write(struct vop_write_args *ap) { @@ -1758,7 +1779,7 @@ ufsspec_write(struct vop_write_args *ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(spec_vnode_vops, VOFFSET(vop_write), &ap->a_head); + error = VOCALL(spec_vnode_vops, &ap->a_head); ip = VTOI(ap->a_vp); if (ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) VTOI(ap->a_vp)->i_flag |= IN_CHANGE | IN_UPDATE; @@ -1773,6 +1794,7 @@ ufsspec_write(struct vop_write_args *ap) * ufsspec_close(struct vnode *a_vp, int a_fflag, struct ucred *a_cred, * struct thread *a_td) */ +static int ufsspec_close(struct vop_close_args *ap) { @@ -1783,7 +1805,7 @@ ufsspec_close(struct vop_close_args *ap) if (vp->v_usecount > 1) ufs_itimes(vp); lwkt_reltoken(&vlock); - return (VOCALL(spec_vnode_vops, VOFFSET(vop_close), &ap->a_head)); + return (VOCALL(spec_vnode_vops, &ap->a_head)); } /* @@ -1792,6 +1814,7 @@ ufsspec_close(struct vop_close_args *ap) * ufsfifo_read(struct vnode *a_vp, struct uio *a_uio, int a_ioflag, * struct ucred *a_cred) */ +static int ufsfifo_read(struct vop_read_args *ap) { @@ -1801,7 +1824,7 @@ ufsfifo_read(struct vop_read_args *ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnode_vops, VOFFSET(vop_read), &ap->a_head); + error = VOCALL(fifo_vnode_vops, &ap->a_head); ip = VTOI(ap->a_vp); if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) @@ -1815,6 +1838,7 @@ ufsfifo_read(struct vop_read_args *ap) * ufsfifo_write(struct vnode *a_vp, struct uio *a_uio, int a_ioflag, * struct ucred *a_cred) */ +static int ufsfifo_write(struct vop_write_args *ap) { @@ -1824,7 +1848,7 @@ ufsfifo_write(struct vop_write_args *ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnode_vops, VOFFSET(vop_write), &ap->a_head); + error = VOCALL(fifo_vnode_vops, &ap->a_head); ip = VTOI(ap->a_vp); if (ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) VTOI(ap->a_vp)->i_flag |= IN_CHANGE | IN_UPDATE; @@ -1839,6 +1863,7 @@ ufsfifo_write(struct vop_write_args *ap) * ufsfifo_close(struct vnode *a_vp, int a_fflag, struct ucred *a_cred, * struct thread *a_td) */ +static int ufsfifo_close(struct vop_close_args *ap) { @@ -1849,7 +1874,7 @@ ufsfifo_close(struct vop_close_args *ap) if (vp->v_usecount > 1) ufs_itimes(vp); lwkt_reltoken(&vlock); - return (VOCALL(fifo_vnode_vops, VOFFSET(vop_close), &ap->a_head)); + return (VOCALL(fifo_vnode_vops, &ap->a_head)); } /* @@ -1857,12 +1882,13 @@ ufsfifo_close(struct vop_close_args *ap) * * Fall through to ufs kqfilter routines if needed */ +static int ufsfifo_kqfilter(struct vop_kqfilter_args *ap) { int error; - error = VOCALL(fifo_vnode_vops, VOFFSET(vop_kqfilter), &ap->a_head); + error = VOCALL(fifo_vnode_vops, &ap->a_head); if (error) error = ufs_kqfilter(ap); return (error); @@ -1873,6 +1899,7 @@ ufsfifo_kqfilter(struct vop_kqfilter_args *ap) * * ufs_pathconf(struct vnode *a_vp, int a_name, int *a_retval) */ +static int ufs_pathconf(struct vop_pathconf_args *ap) { @@ -1907,6 +1934,7 @@ ufs_pathconf(struct vop_pathconf_args *ap) * ufs_advlock(struct vnode *a_vp, caddr_t a_id, int a_op, struct flock *a_fl, * int a_flags) */ +static int ufs_advlock(struct vop_advlock_args *ap) { @@ -1920,8 +1948,7 @@ ufs_advlock(struct vop_advlock_args *ap) * vnodes. */ int -ufs_vinit(struct mount *mntp, struct vop_ops *specops, struct vop_ops *fifoops, - struct vnode **vpp) +ufs_vinit(struct mount *mntp, struct vnode **vpp) { struct inode *ip; struct vnode *vp; @@ -1932,11 +1959,11 @@ ufs_vinit(struct mount *mntp, struct vop_ops *specops, struct vop_ops *fifoops, switch(vp->v_type = IFTOVT(ip->i_mode)) { case VCHR: case VBLK: - vp->v_vops = specops; + vp->v_ops = mntp->mnt_vn_spec_ops; addaliasu(vp, ip->i_rdev); break; case VFIFO: - vp->v_vops = fifoops; + vp->v_ops = mntp->mnt_vn_fifo_ops; break; default: break; @@ -1957,6 +1984,7 @@ ufs_vinit(struct mount *mntp, struct vop_ops *specops, struct vop_ops *fifoops, /* * Allocate a new inode. */ +static int ufs_makeinode(int mode, struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) @@ -2280,7 +2308,7 @@ VNODEOP_SET(ufs_fifoop_opv_desc); int ufs_vnoperate(struct vop_generic_args *ap) { - return (VOCALL(ufs_vnode_vops, ap->a_desc->vdesc_offset, ap)); + return (VOCALL(ufs_vnode_vops, ap)); } /* @@ -2289,7 +2317,7 @@ ufs_vnoperate(struct vop_generic_args *ap) int ufs_vnoperatefifo(struct vop_generic_args *ap) { - return (VOCALL(ufs_fifo_vops, ap->a_desc->vdesc_offset, ap)); + return (VOCALL(ufs_fifo_vops, ap)); } /* @@ -2298,5 +2326,5 @@ ufs_vnoperatefifo(struct vop_generic_args *ap) int ufs_vnoperatespec(struct vop_generic_args *ap) { - return (VOCALL(ufs_spec_vops, ap->a_desc->vdesc_offset, ap)); + return (VOCALL(ufs_spec_vops, ap)); } diff --git a/sys/vfs/umapfs/umap.h b/sys/vfs/umapfs/umap.h index 0e0ed64097..a5cd8ae367 100644 --- a/sys/vfs/umapfs/umap.h +++ b/sys/vfs/umapfs/umap.h @@ -36,7 +36,7 @@ * @(#)umap.h 8.4 (Berkeley) 8/20/94 * * $FreeBSD: src/sys/miscfs/umapfs/umap.h,v 1.13 1999/12/29 04:54:47 peter Exp $ - * $DragonFly: src/sys/vfs/umapfs/Attic/umap.h,v 1.5 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/umapfs/Attic/umap.h,v 1.6 2004/08/17 18:57:36 dillon Exp $ */ #define MAPFILEENTRIES 64 @@ -88,5 +88,4 @@ extern struct vnode *umap_checkvp (struct vnode *vp, char *fil, int lno); #define UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp) #endif -extern struct vop_ops *umap_vnode_vops; #endif /* _KERNEL */ diff --git a/sys/vfs/umapfs/umap_subr.c b/sys/vfs/umapfs/umap_subr.c index 2241809d4d..c6294cd517 100644 --- a/sys/vfs/umapfs/umap_subr.c +++ b/sys/vfs/umapfs/umap_subr.c @@ -36,7 +36,7 @@ * @(#)umap_subr.c 8.9 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/umapfs/umap_subr.c,v 1.19 1999/09/04 11:51:41 bde Exp $ - * $DragonFly: src/sys/vfs/umapfs/Attic/umap_subr.c,v 1.9 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/umapfs/Attic/umap_subr.c,v 1.10 2004/08/17 18:57:36 dillon Exp $ */ #include @@ -197,7 +197,7 @@ umap_node_alloc(struct mount *mp, struct vnode *lowervp, struct vnode **vpp) MALLOC(xp, struct umap_node *, sizeof(struct umap_node), M_TEMP, M_WAITOK); - error = getnewvnode(VT_UMAP, mp, umap_vnode_vops, vpp); + error = getnewvnode(VT_UMAP, mp, mp->mnt_vn_ops, vpp); if (error) { FREE(xp, M_TEMP); return (error); @@ -286,17 +286,6 @@ struct vnode * umap_checkvp(struct vnode *vp, char *fil, int lno) { struct umap_node *a = VTOUMAP(vp); -#if 0 - /* - * Can't do this check because vop_reclaim runs - * with funny vop vector. - */ - if (vp->v_vops != umap_vnode_vops) { - printf ("umap_checkvp: on non-umap-node\n"); - while (umap_checkvp_barrier) /*WAIT*/ ; - panic("umap_checkvp"); - } -#endif if (a->umap_lowervp == NULL) { /* Should never happen */ int i; u_long *p; diff --git a/sys/vfs/umapfs/umap_vfsops.c b/sys/vfs/umapfs/umap_vfsops.c index f7fbd85c3e..d5106c668b 100644 --- a/sys/vfs/umapfs/umap_vfsops.c +++ b/sys/vfs/umapfs/umap_vfsops.c @@ -36,7 +36,7 @@ * @(#)umap_vfsops.c 8.8 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/umapfs/umap_vfsops.c,v 1.31.2.2 2001/09/11 09:49:53 kris Exp $ - * $DragonFly: src/sys/vfs/umapfs/Attic/umap_vfsops.c,v 1.10 2004/04/24 04:32:05 drhodus Exp $ + * $DragonFly: src/sys/vfs/umapfs/Attic/umap_vfsops.c,v 1.11 2004/08/17 18:57:36 dillon Exp $ */ /* @@ -55,6 +55,8 @@ #include "umap.h" #include +extern struct vnodeopv_entry_desc umap_vnodeop_entries[]; + static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure"); static int umapfs_fhtovp (struct mount *mp, struct fid *fidp, @@ -195,6 +197,7 @@ umapfs_mount(struct mount *mp, char *path, caddr_t data, amp->info_gmapdata[i][1]); #endif + vfs_add_vnodeops(&mp->mnt_vn_ops, umap_vnodeop_entries); /* * Save reference. Each mount also holds diff --git a/sys/vfs/umapfs/umap_vnops.c b/sys/vfs/umapfs/umap_vnops.c index 716db5da5b..ff25b7c3f7 100644 --- a/sys/vfs/umapfs/umap_vnops.c +++ b/sys/vfs/umapfs/umap_vnops.c @@ -35,7 +35,7 @@ * * @(#)umap_vnops.c 8.6 (Berkeley) 5/22/95 * $FreeBSD: src/sys/miscfs/umapfs/umap_vnops.c,v 1.30 1999/08/30 07:08:04 bde Exp $ - * $DragonFly: src/sys/vfs/umapfs/Attic/umap_vnops.c,v 1.9 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/umapfs/Attic/umap_vnops.c,v 1.10 2004/08/17 18:57:36 dillon Exp $ */ /* @@ -124,7 +124,7 @@ umap_bypass(struct vop_generic_args *ap) * that aren't. (Must map first vp or vclean fails.) */ - if (i && (*this_vp_p)->v_vops != umap_vnode_vops) { + if (i && (*this_vp_p)->v_tag != VT_UMAP) { old_vps[i] = NULL; } else { old_vps[i] = *this_vp_p; @@ -197,10 +197,11 @@ umap_bypass(struct vop_generic_args *ap) } /* - * Call the operation on the lower layer - * with the modified argument structure. + * Call the operation on the lower layer with the modified argument + * structure. We have to adjust a_fm to point at the lower layer. */ - error = VCALL(*(vps_p[0]), descp->vdesc_offset, ap); + ap->a_ops = (*(vps_p[0]))->v_ops; + error = vop_vnoperate_ap(ap); /* * Maintain the illusion of call-by-value @@ -487,8 +488,7 @@ umap_rename(struct vop_rename_args *ap) * go away with a merged buffer/block cache. * */ -struct vop_ops *umap_vnode_vops; -static struct vnodeopv_entry_desc umap_vnodeop_entries[] = { +struct vnodeopv_entry_desc umap_vnodeop_entries[] = { { &vop_default_desc, (void *) umap_bypass }, { &vop_getattr_desc, (void *) umap_getattr }, { &vop_inactive_desc, (void *) umap_inactive }, @@ -499,7 +499,4 @@ static struct vnodeopv_entry_desc umap_vnodeop_entries[] = { { &vop_unlock_desc, (void *) umap_unlock }, { NULL, NULL } }; -static struct vnodeopv_desc umap_vnodeop_opv_desc = - { &umap_vnode_vops, umap_vnodeop_entries }; -VNODEOP_SET(umap_vnodeop_opv_desc); diff --git a/sys/vfs/union/union.h b/sys/vfs/union/union.h index 00e69f1199..2f1b41fdb5 100644 --- a/sys/vfs/union/union.h +++ b/sys/vfs/union/union.h @@ -36,7 +36,7 @@ * * @(#)union.h 8.9 (Berkeley) 12/10/94 * $FreeBSD: src/sys/miscfs/union/union.h,v 1.17 1999/12/29 04:54:48 peter Exp $ - * $DragonFly: src/sys/vfs/union/union.h,v 1.6 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union.h,v 1.7 2004/08/17 18:57:36 dillon Exp $ */ struct union_args { @@ -157,7 +157,6 @@ extern void union_vm_coherency (struct vnode *, struct uio *, int); extern int (*union_dircheckp) (struct thread *, struct vnode **, struct file *); -extern struct vop_ops *union_vnode_vops; extern struct vfsops union_vfsops; extern int uniondebug; diff --git a/sys/vfs/union/union_subr.c b/sys/vfs/union/union_subr.c index 5b2ac8cc88..fd58764ab2 100644 --- a/sys/vfs/union/union_subr.c +++ b/sys/vfs/union/union_subr.c @@ -36,7 +36,7 @@ * * @(#)union_subr.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_subr.c,v 1.43.2.2 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.13 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_subr.c,v 1.14 2004/08/17 18:57:36 dillon Exp $ */ #include @@ -528,7 +528,7 @@ loop: * Create new node rather then replace old node */ - error = getnewvnode(VT_UNION, mp, union_vnode_vops, vpp); + error = getnewvnode(VT_UNION, mp, mp->mnt_vn_ops, vpp); if (error) { /* * If an error occurs clear out vnodes. @@ -1155,7 +1155,7 @@ union_dircache_r(struct vnode *vp, struct vnode ***vppp, int *cntp) { struct union_node *un; - if (vp->v_vops != union_vnode_vops) { + if (vp->v_tag != VT_UNION) { if (vppp) { vref(vp); *(*vppp)++ = vp; @@ -1270,7 +1270,7 @@ union_dircheck(struct thread *td, struct vnode **vp, struct file *fp) { int error = 0; - if ((*vp)->v_vops == union_vnode_vops) { + if ((*vp)->v_tag == VT_UNION) { struct vnode *lvp; lvp = union_dircache(*vp, td); diff --git a/sys/vfs/union/union_vfsops.c b/sys/vfs/union/union_vfsops.c index eb173f4db1..8d54a197ea 100644 --- a/sys/vfs/union/union_vfsops.c +++ b/sys/vfs/union/union_vfsops.c @@ -36,7 +36,7 @@ * * @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95 * $FreeBSD: src/sys/miscfs/union/union_vfsops.c,v 1.39.2.2 2001/10/25 19:18:53 dillon Exp $ - * $DragonFly: src/sys/vfs/union/union_vfsops.c,v 1.13 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vfsops.c,v 1.14 2004/08/17 18:57:36 dillon Exp $ */ /* @@ -55,6 +55,8 @@ #include "union.h" #include +extern struct vnodeopv_entry_desc union_vnodeop_entries[]; + static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure"); extern int union_init (struct vfsconf *); @@ -124,7 +126,7 @@ union_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, /* * Unlock lower node to avoid deadlock. */ - if (lowerrootvp->v_vops == union_vnode_vops) + if (lowerrootvp->v_tag == VT_UNION) VOP_UNLOCK(lowerrootvp, NULL, 0, td); #endif @@ -138,7 +140,7 @@ union_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, error = namei(ndp); #if 0 - if (lowerrootvp->v_vops == union_vnode_vops) + if (lowerrootvp->v_tag == VT_UNION) vn_lock(lowerrootvp, NULL, LK_EXCLUSIVE | LK_RETRY, td); #endif if (error) @@ -277,6 +279,8 @@ union_mount(struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, (void) copyinstr(args.target, cp, len - 1, &size); bzero(cp + size, len - size); + vfs_add_vnodeops(&mp->mnt_vn_ops, union_vnodeop_entries); + (void)union_statfs(mp, &mp->mnt_stat, td); UDEBUG(("union_mount: from %s, on %s\n", diff --git a/sys/vfs/union/union_vnops.c b/sys/vfs/union/union_vnops.c index 685cf14cda..59943b15e1 100644 --- a/sys/vfs/union/union_vnops.c +++ b/sys/vfs/union/union_vnops.c @@ -36,7 +36,7 @@ * * @(#)union_vnops.c 8.32 (Berkeley) 6/23/95 * $FreeBSD: src/sys/miscfs/union/union_vnops.c,v 1.72 1999/12/15 23:02:14 eivind Exp $ - * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.13 2004/08/13 17:51:14 dillon Exp $ + * $DragonFly: src/sys/vfs/union/union_vnops.c,v 1.14 2004/08/17 18:57:36 dillon Exp $ */ #include @@ -791,8 +791,9 @@ union_close(struct vop_close_args *ap) --un->un_openl; vp = un->un_lowervp; } + ap->a_head.a_ops = vp->v_ops; ap->a_vp = vp; - return (VCALL(vp, VOFFSET(vop_close), &ap->a_head)); + return(vop_close_ap(ap)); } /* @@ -830,14 +831,16 @@ union_access(struct vop_access_args *ap) } if ((vp = union_lock_upper(un, td)) != NULLVP) { + ap->a_head.a_ops = vp->v_ops; ap->a_vp = vp; - error = VCALL(vp, VOFFSET(vop_access), &ap->a_head); + error = vop_access_ap(ap); union_unlock_upper(vp, td); return(error); } if ((vp = un->un_lowervp) != NULLVP) { vn_lock(vp, NULL, LK_EXCLUSIVE | LK_RETRY, td); + ap->a_head.a_ops = vp->v_ops; ap->a_vp = vp; /* @@ -847,7 +850,7 @@ union_access(struct vop_access_args *ap) if ((un->un_vnode->v_mount->mnt_flag & MNT_RDONLY) == 0) ap->a_mode &= ~VWRITE; - error = VCALL(vp, VOFFSET(vop_access), &ap->a_head); + error = vop_access_ap(ap); if (error == 0) { struct union_mount *um; @@ -855,7 +858,7 @@ union_access(struct vop_access_args *ap) if (um->um_op == UNMNT_BELOW) { ap->a_cred = um->um_cred; - error = VCALL(vp, VOFFSET(vop_access), &ap->a_head); + error = vop_access_ap(ap); } } VOP_UNLOCK(vp, NULL, 0, td); @@ -1113,8 +1116,9 @@ union_lease(struct vop_lease_args *ap) { struct vnode *ovp = OTHERVP(ap->a_vp); + ap->a_head.a_ops = ovp->v_ops; ap->a_vp = ovp; - return (VCALL(ovp, VOFFSET(vop_lease), &ap->a_head)); + return (vop_lease_ap(ap)); } /* @@ -1126,8 +1130,9 @@ union_ioctl(struct vop_ioctl_args *ap) { struct vnode *ovp = OTHERVP(ap->a_vp); + ap->a_head.a_ops = ovp->v_ops; ap->a_vp = ovp; - return (VCALL(ovp, VOFFSET(vop_ioctl), &ap->a_head)); + return(vop_ioctl_ap(ap)); } /* @@ -1139,8 +1144,9 @@ union_poll(struct vop_poll_args *ap) { struct vnode *ovp = OTHERVP(ap->a_vp); + ap->a_head.a_ops = ovp->v_ops; ap->a_vp = ovp; - return (VCALL(ovp, VOFFSET(vop_poll), &ap->a_head)); + return(vop_poll_ap(ap)); } /* @@ -1168,8 +1174,9 @@ union_mmap(struct vop_mmap_args *ap) { struct vnode *ovp = OTHERVP(ap->a_vp); + ap->a_head.a_ops = ovp->v_ops; ap->a_vp = ovp; - return (VCALL(ovp, VOFFSET(vop_mmap), &ap->a_head)); + return (vop_mmap_ap(ap)); } /* @@ -1254,7 +1261,7 @@ union_link(struct vop_link_args *ap) struct vnode *tdvp; int error = 0; - if (ap->a_tdvp->v_vops != ap->a_vp->v_vops) { + if (ap->a_tdvp->v_ops != ap->a_vp->v_ops) { vp = ap->a_vp; } else { struct union_node *tun = VTOUNION(ap->a_vp); @@ -1326,7 +1333,7 @@ union_rename(struct vop_rename_args *ap) * replace the fdvp, release the original one and ref the new one. */ - if (fdvp->v_vops == union_vnode_vops) { /* always true */ + if (fdvp->v_tag == VT_UNION) { /* always true */ struct union_node *un = VTOUNION(fdvp); if (un->un_uppervp == NULLVP) { /* @@ -1348,7 +1355,7 @@ union_rename(struct vop_rename_args *ap) * replace the fvp, release the original one and ref the new one. */ - if (fvp->v_vops == union_vnode_vops) { /* always true */ + if (fvp->v_tag == VT_UNION) { /* always true */ struct union_node *un = VTOUNION(fvp); #if 0 struct union_mount *um = MOUNTTOUNIONMOUNT(fvp->v_mount); @@ -1406,7 +1413,7 @@ union_rename(struct vop_rename_args *ap) * reference. */ - if (tdvp->v_vops == union_vnode_vops) { + if (tdvp->v_tag == VT_UNION) { struct union_node *un = VTOUNION(tdvp); if (un->un_uppervp == NULLVP) { @@ -1436,7 +1443,7 @@ union_rename(struct vop_rename_args *ap) * file and change tvp to NULL. */ - if (tvp != NULLVP && tvp->v_vops == union_vnode_vops) { + if (tvp != NULLVP && tvp->v_tag == VT_UNION) { struct union_node *un = VTOUNION(tvp); tvp = union_lock_upper(un, ap->a_tcnp->cn_td); @@ -1577,8 +1584,9 @@ union_readdir(struct vop_readdir_args *ap) int error = 0; if ((uvp = union_lock_upper(un, td)) != NULLVP) { + ap->a_head.a_ops = uvp->v_ops; ap->a_vp = uvp; - error = VCALL(uvp, VOFFSET(vop_readdir), &ap->a_head); + error = vop_readdir_ap(ap); union_unlock_upper(uvp, td); } return(error); @@ -1599,8 +1607,9 @@ union_readlink(struct vop_readlink_args *ap) vp = union_lock_other(un, td); KASSERT(vp != NULL, ("union_readlink: backing vnode missing!")); + ap->a_head.a_ops = vp->v_ops; ap->a_vp = vp; - error = VCALL(vp, VOFFSET(vop_readlink), &ap->a_head); + error = vop_readlink_ap(ap); union_unlock_other(vp, td); return (error); @@ -1795,8 +1804,9 @@ union_pathconf(struct vop_pathconf_args *ap) vp = union_lock_other(un, td); KASSERT(vp != NULL, ("union_pathconf: backing vnode missing!")); + ap->a_head.a_ops = vp->v_ops; ap->a_vp = vp; - error = VCALL(vp, VOFFSET(vop_pathconf), &ap->a_head); + error = vop_pathconf_ap(ap); union_unlock_other(vp, td); return (error); @@ -1811,8 +1821,9 @@ union_advlock(struct vop_advlock_args *ap) { struct vnode *ovp = OTHERVP(ap->a_vp); + ap->a_head.a_ops = ovp->v_ops; ap->a_vp = ovp; - return (VCALL(ovp, VOFFSET(vop_advlock), &ap->a_head)); + return (vop_advlock_ap(ap)); } @@ -1844,8 +1855,7 @@ union_strategy(struct vop_strategy_args *ap) /* * Global vfs data structures */ -struct vop_ops *union_vnode_vops; -static struct vnodeopv_entry_desc union_vnodeop_entries[] = { +struct vnodeopv_entry_desc union_vnodeop_entries[] = { { &vop_default_desc, vop_defaultop }, { &vop_access_desc, (void *) union_access }, { &vop_advlock_desc, (void *) union_advlock }, @@ -1886,7 +1896,4 @@ static struct vnodeopv_entry_desc union_vnodeop_entries[] = { { &vop_write_desc, (void *) union_write }, { NULL, NULL } }; -static struct vnodeopv_desc union_vnodeop_opv_desc = - { &union_vnode_vops, union_vnodeop_entries }; -VNODEOP_SET(union_vnodeop_opv_desc); diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c index 9ed43f37d4..68bdf76377 100644 --- a/sys/vm/vm_contig.c +++ b/sys/vm/vm_contig.c @@ -64,7 +64,7 @@ * SUCH DAMAGE. * * from: @(#)vm_page.c 7.4 (Berkeley) 5/7/91 - * $DragonFly: src/sys/vm/vm_contig.c,v 1.8 2004/07/16 05:04:36 hmp Exp $ + * $DragonFly: src/sys/vm/vm_contig.c,v 1.9 2004/08/17 18:57:36 dillon Exp $ */ /* @@ -156,7 +156,8 @@ vm_contig_pg_clean(int queue) vn_lock(object->handle, NULL, LK_EXCLUSIVE | LK_RETRY, curthread); vm_object_page_clean(object, 0, 0, OBJPC_SYNC); - VOP_UNLOCK(object->handle, NULL, 0, curthread); + VOP_UNLOCK(((struct vnode *)object->handle), + NULL, 0, curthread); return (TRUE); } else if (object->type == OBJT_SWAP || object->type == OBJT_DEFAULT) { diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 9ddb75ece9..61cc6f8302 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -62,7 +62,7 @@ * rights to redistribute these changes. * * $FreeBSD: src/sys/vm/vm_map.c,v 1.187.2.19 2003/05/27 00:47:02 alc Exp $ - * $DragonFly: src/sys/vm/vm_map.c,v 1.31 2004/07/28 20:40:35 dillon Exp $ + * $DragonFly: src/sys/vm/vm_map.c,v 1.32 2004/08/17 18:57:36 dillon Exp $ */ /* @@ -2195,7 +2195,8 @@ vm_map_clean(vm_map_t map, vm_offset_t start, vm_offset_t end, boolean_t syncio, OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); - VOP_UNLOCK(object->handle, NULL, 0, curthread); + VOP_UNLOCK(((struct vnode *)object->handle), + NULL, 0, curthread); vm_object_deallocate(object); } if (object && invalidate && diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index e64bbcb53d..39453ac34a 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -39,7 +39,7 @@ * * from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91 * $FreeBSD: src/sys/vm/vnode_pager.c,v 1.116.2.7 2002/12/31 09:34:51 dillon Exp $ - * $DragonFly: src/sys/vm/vnode_pager.c,v 1.14 2004/05/13 17:40:19 dillon Exp $ + * $DragonFly: src/sys/vm/vnode_pager.c,v 1.15 2004/08/17 18:57:36 dillon Exp $ */ /* @@ -538,7 +538,8 @@ vnode_pager_input_old(vm_object_t object, vm_page_t m) auio.uio_resid = size; auio.uio_td = curthread; - error = VOP_READ(object->handle, &auio, 0, proc0.p_ucred); + error = VOP_READ(((struct vnode *)object->handle), + &auio, 0, proc0.p_ucred); if (!error) { int count = size - auio.uio_resid; -- 2.41.0