diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2010-12-21 20:14:45 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2010-12-21 20:14:45 +0000 |
commit | 533610cd3b12c41762f0fbaa058c868cc1458b45 (patch) | |
tree | 866b788e63499fb184820ccec149d0e2c6d410bb /sys | |
parent | b8f93236e139a325a6aec2b47b12ecbfab8aaf99 (diff) |
Bring back the "End the VOP experiment." diff, naddy's issues where
unrelated, and his alpha is much happier now.
OK deraadt@
Diffstat (limited to 'sys')
47 files changed, 1332 insertions, 1330 deletions
diff --git a/sys/conf/files b/sys/conf/files index e7d875e4c6c..81c423cbdce 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.505 2010/12/21 14:56:24 claudio Exp $ +# $OpenBSD: files,v 1.506 2010/12/21 20:14:43 thib Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -767,9 +767,9 @@ file kern/vfs_lookup.c file kern/vfs_subr.c file kern/vfs_sync.c file kern/vfs_syscalls.c +file kern/vfs_vops.c file kern/vfs_vnops.c file kern/vfs_getcwd.c -file kern/vnode_if.c file miscfs/deadfs/dead_vnops.c file miscfs/fifofs/fifo_vnops.c fifo file miscfs/portal/portal_vfsops.c portal diff --git a/sys/isofs/cd9660/cd9660_extern.h b/sys/isofs/cd9660/cd9660_extern.h index 5271afc3e3f..6f92600f12b 100644 --- a/sys/isofs/cd9660/cd9660_extern.h +++ b/sys/isofs/cd9660/cd9660_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_extern.h,v 1.10 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: cd9660_extern.h,v 1.11 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: cd9660_extern.h,v 1.1 1997/01/24 00:24:53 cgd Exp $ */ /*- @@ -99,10 +99,10 @@ int cd9660_check_export(struct mount *, struct mbuf *, int *, int cd9660_mountroot(void); -extern int (**cd9660_vnodeop_p)(void *); -extern int (**cd9660_specop_p)(void *); +extern struct vops cd9660_vops; +extern struct vops cd9660_specvops; #ifdef FIFO -extern int (**cd9660_fifoop_p)(void *); +extern struct vops cd9660_fifovops; #endif int isochar(const u_char *, const u_char *, int, u_char *); diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 135796038ba..c1306f654b1 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vfsops.c,v 1.55 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.56 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -765,7 +765,7 @@ retry: return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode(VT_ISOFS, mp, &cd9660_vops, &vp)) != 0) { *vpp = NULLVP; return (error); } @@ -907,7 +907,7 @@ retry: switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) { case VFIFO: #ifdef FIFO - vp->v_op = cd9660_fifoop_p; + vp->v_op = &cd9660_fifovops; break; #else vput(vp); @@ -922,7 +922,7 @@ retry: if (dp = iso_dmap(dev, ino, 0)) ip->inode.iso_rdev = dp->d_dev; #endif - vp->v_op = cd9660_specop_p; + vp->v_op = &cd9660_specvops; if ((nvp = checkalias(vp, ip->inode.iso_rdev, mp)) != NULL) { /* * Discard unneeded vnode, but save its iso_node. @@ -930,7 +930,7 @@ retry: */ nvp->v_data = vp->v_data; vp->v_data = NULL; - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; vrele(vp); vgone(vp); /* diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index c3a6c079ca9..3095674929a 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vnops.c,v 1.51 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.52 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: cd9660_vnops.c,v 1.42 1997/10/16 23:56:57 christos Exp $ */ /*- @@ -848,7 +848,7 @@ cd9660_strategy(v) } vp = ip->i_devvp; bp->b_dev = vp->v_rdev; - VOCALL (vp->v_op, VOFFSET(vop_strategy), ap); + (vp->v_op->vop_strategy)(ap); return (0); } @@ -931,87 +931,126 @@ cd9660_pathconf(v) #define cd9660_bwrite eopnotsupp #define cd9660_revoke vop_generic_revoke -/* - * Global vfs data structures for cd9660 - */ -int (**cd9660_vnodeop_p)(void *); -struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, cd9660_lookup }, - { &vop_create_desc, cd9660_create }, - { &vop_mknod_desc, cd9660_mknod }, - { &vop_open_desc, cd9660_open }, - { &vop_close_desc, cd9660_close }, - { &vop_access_desc, cd9660_access }, - { &vop_getattr_desc, cd9660_getattr }, - { &vop_setattr_desc, cd9660_setattr }, - { &vop_read_desc, cd9660_read }, - { &vop_write_desc, cd9660_write }, - { &vop_ioctl_desc, cd9660_ioctl }, - { &vop_poll_desc, cd9660_poll }, - { &vop_revoke_desc, cd9660_revoke }, - { &vop_fsync_desc, cd9660_fsync }, - { &vop_remove_desc, cd9660_remove }, - { &vop_link_desc, cd9660_link }, - { &vop_rename_desc, cd9660_rename }, - { &vop_mkdir_desc, cd9660_mkdir }, - { &vop_rmdir_desc, cd9660_rmdir }, - { &vop_symlink_desc, cd9660_symlink }, - { &vop_readdir_desc, cd9660_readdir }, - { &vop_readlink_desc, cd9660_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, cd9660_inactive }, - { &vop_reclaim_desc, cd9660_reclaim }, - { &vop_lock_desc, cd9660_lock }, - { &vop_unlock_desc, cd9660_unlock }, - { &vop_bmap_desc, cd9660_bmap }, - { &vop_strategy_desc, cd9660_strategy }, - { &vop_print_desc, cd9660_print }, - { &vop_islocked_desc, cd9660_islocked }, - { &vop_pathconf_desc, cd9660_pathconf }, - { &vop_advlock_desc, cd9660_advlock }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +/* Global vfs data structures for cd9660. */ +struct vops cd9660_vops = { + .vop_default = eopnotsupp, + .vop_lookup = cd9660_lookup, + .vop_create = cd9660_create, + .vop_mknod = cd9660_mknod, + .vop_open = cd9660_open, + .vop_close = cd9660_close, + .vop_access = cd9660_access, + .vop_getattr = cd9660_getattr, + .vop_setattr = cd9660_setattr, + .vop_read = cd9660_read, + .vop_write = cd9660_write, + .vop_ioctl = cd9660_ioctl, + .vop_poll = cd9660_poll, + .vop_revoke = cd9660_revoke, + .vop_fsync = cd9660_fsync, + .vop_remove = cd9660_remove, + .vop_link = cd9660_link, + .vop_rename = cd9660_rename, + .vop_mkdir = cd9660_mkdir, + .vop_rmdir = cd9660_rmdir, + .vop_symlink = cd9660_symlink, + .vop_readdir = cd9660_readdir, + .vop_readlink = cd9660_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = cd9660_inactive, + .vop_reclaim = cd9660_reclaim, + .vop_lock = cd9660_lock, + .vop_unlock = cd9660_unlock, + .vop_bmap = cd9660_bmap, + .vop_strategy = cd9660_strategy, + .vop_print = cd9660_print, + .vop_islocked = cd9660_islocked, + .vop_pathconf = cd9660_pathconf, + .vop_advlock = cd9660_advlock, + .vop_bwrite = vop_generic_bwrite }; -struct vnodeopv_desc cd9660_vnodeop_opv_desc = - { &cd9660_vnodeop_p, cd9660_vnodeop_entries }; -/* - * Special device vnode ops - */ -int (**cd9660_specop_p)(void *); -struct vnodeopv_entry_desc cd9660_specop_entries[] = { - { &vop_default_desc, spec_vnoperate }, - { &vop_access_desc, cd9660_access }, - { &vop_getattr_desc, cd9660_getattr }, - { &vop_setattr_desc, cd9660_setattr }, - { &vop_inactive_desc, cd9660_inactive }, - { &vop_reclaim_desc, cd9660_reclaim }, - { &vop_lock_desc, cd9660_lock }, - { &vop_unlock_desc, cd9660_unlock }, - { &vop_print_desc, cd9660_print }, - { &vop_islocked_desc, cd9660_islocked }, - { NULL, NULL } +/* Special device vnode ops */ +struct vops cd9660_specvops = { + .vop_default = eopnotsupp, + .vop_access = cd9660_access, + .vop_getattr = cd9660_getattr, + .vop_setattr = cd9660_setattr, + .vop_inactive = cd9660_inactive, + .vop_reclaim = cd9660_reclaim, + .vop_lock = cd9660_lock, + .vop_unlock = cd9660_unlock, + .vop_print = cd9660_print, + .vop_islocked = cd9660_islocked, + + /* XXX: Keep in sync with spec_vops. */ + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_close = spec_close, + .vop_read = spec_read, + .vop_write = spec_write, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = spec_fsync, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc cd9660_specop_opv_desc = - { &cd9660_specop_p, cd9660_specop_entries }; #ifdef FIFO -int (**cd9660_fifoop_p)(void *); -struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { - { &vop_default_desc, fifo_vnoperate }, - { &vop_access_desc, cd9660_access }, - { &vop_getattr_desc, cd9660_getattr }, - { &vop_setattr_desc, cd9660_setattr }, - { &vop_inactive_desc, cd9660_inactive }, - { &vop_reclaim_desc, cd9660_reclaim }, - { &vop_lock_desc, cd9660_lock }, - { &vop_unlock_desc, cd9660_unlock }, - { &vop_print_desc, cd9660_print }, - { &vop_islocked_desc, cd9660_islocked }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops cd9660_fifovops = { + .vop_default = eopnotsupp, + .vop_access = cd9660_access, + .vop_getattr = cd9660_getattr, + .vop_setattr = cd9660_setattr, + .vop_inactive = cd9660_inactive, + .vop_reclaim = cd9660_reclaim, + .vop_lock = cd9660_lock, + .vop_unlock = cd9660_unlock, + .vop_print = cd9660_print, + .vop_islocked = cd9660_islocked, + .vop_bwrite = vop_generic_bwrite, + + /* XXX: Keep in sync with fifo_vops. */ + .vop_lookup = vop_generic_lookup, + .vop_create = fifo_badop, + .vop_mknod = fifo_badop, + .vop_open = fifo_open, + .vop_close = fifo_close, + .vop_read = fifo_read, + .vop_write = fifo_write, + .vop_ioctl = fifo_ioctl, + .vop_poll = fifo_poll, + .vop_kqfilter = fifo_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = nullop, + .vop_remove = fifo_badop, + .vop_link = fifo_badop, + .vop_rename = fifo_badop, + .vop_mkdir = fifo_badop, + .vop_rmdir = fifo_badop, + .vop_symlink = fifo_badop, + .vop_readdir = fifo_badop, + .vop_readlink = fifo_badop, + .vop_abortop = fifo_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = fifo_badop, + .vop_pathconf = fifo_pathconf, + .vop_advlock = fifo_advlock, }; -struct vnodeopv_desc cd9660_fifoop_opv_desc = - { &cd9660_fifoop_p, cd9660_fifoop_entries }; #endif /* FIFO */ diff --git a/sys/isofs/udf/udf_extern.h b/sys/isofs/udf/udf_extern.h index 2e3d87e6d17..5665f5e3a48 100644 --- a/sys/isofs/udf/udf_extern.h +++ b/sys/isofs/udf/udf_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_extern.h,v 1.10 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: udf_extern.h,v 1.11 2010/12/21 20:14:43 thib Exp $ */ /* * Written by Pedro Martelletto <pedro@ambientworks.net> in February 2005. @@ -61,7 +61,5 @@ extern struct pool udf_trans_pool; extern struct pool unode_pool; extern struct pool udf_ds_pool; -/* - * Set of UDF vnode operations. - */ -extern int (**udf_vnodeop_p)(void *); +/* Set of UDF vnode operations.*/ +extern struct vops udf_vops; diff --git a/sys/isofs/udf/udf_vfsops.c b/sys/isofs/udf/udf_vfsops.c index 906a85dc7fa..7021039168b 100644 --- a/sys/isofs/udf/udf_vfsops.c +++ b/sys/isofs/udf/udf_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_vfsops.c,v 1.35 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: udf_vfsops.c,v 1.36 2010/12/21 20:14:43 thib Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> @@ -685,7 +685,7 @@ udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) */ nvp->v_data = vp->v_data; vp->v_data = NULL; - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; vrele(vp); vgone(vp); /* diff --git a/sys/isofs/udf/udf_vnops.c b/sys/isofs/udf/udf_vnops.c index 6a04566a9a9..401fd19021d 100644 --- a/sys/isofs/udf/udf_vnops.c +++ b/sys/isofs/udf/udf_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_vnops.c,v 1.41 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: udf_vnops.c,v 1.42 2010/12/21 20:14:43 thib Exp $ */ /* * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> @@ -57,30 +57,26 @@ int udf_bmap_internal(struct unode *, off_t, daddr64_t *, uint32_t *); -int (**udf_vnodeop_p)(void *); -struct vnodeopv_entry_desc udf_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_access_desc, udf_access }, - { &vop_bmap_desc, udf_bmap }, - { &vop_lookup_desc, udf_lookup }, - { &vop_getattr_desc, udf_getattr }, - { &vop_open_desc, udf_open }, - { &vop_close_desc, udf_close }, - { &vop_ioctl_desc, udf_ioctl }, - { &vop_read_desc, udf_read }, - { &vop_readdir_desc, udf_readdir }, - { &vop_readlink_desc, udf_readlink }, - { &vop_inactive_desc, udf_inactive }, - { &vop_reclaim_desc, udf_reclaim }, - { &vop_strategy_desc, udf_strategy }, - { &vop_lock_desc, udf_lock }, - { &vop_unlock_desc, udf_unlock }, - { &vop_islocked_desc, udf_islocked }, - { &vop_print_desc, udf_print }, - { NULL, NULL } +struct vops udf_vops = { + .vop_default = eopnotsupp, + .vop_access = udf_access, + .vop_bmap = udf_bmap, + .vop_lookup = udf_lookup, + .vop_getattr = udf_getattr, + .vop_open = udf_open, + .vop_close = udf_close, + .vop_ioctl = udf_ioctl, + .vop_read = udf_read, + .vop_readdir = udf_readdir, + .vop_readlink = udf_readlink, + .vop_inactive = udf_inactive, + .vop_reclaim = udf_reclaim, + .vop_strategy = udf_strategy, + .vop_lock = udf_lock, + .vop_unlock = udf_unlock, + .vop_islocked = udf_islocked, + .vop_print = udf_print }; -struct vnodeopv_desc udf_vnodeop_opv_desc = - { &udf_vnodeop_p, udf_vnodeop_entries }; #define UDF_INVALID_BMAP -1 @@ -165,7 +161,7 @@ udf_allocv(struct mount *mp, struct vnode **vpp, struct proc *p) int error; struct vnode *vp; - error = getnewvnode(VT_UDF, mp, udf_vnodeop_p, &vp); + error = getnewvnode(VT_UDF, mp, &udf_vops, &vp); if (error) { printf("udf_allocv: failed to allocate new vnode\n"); return (error); @@ -895,7 +891,7 @@ udf_strategy(void *v) splx(s); } else { bp->b_dev = vp->v_rdev; - VOCALL(up->u_devvp->v_op, VOFFSET(vop_strategy), ap); + (up->u_devvp->v_op->vop_strategy)(ap); } return (0); diff --git a/sys/kern/Makefile b/sys/kern/Makefile index b28aa2897e7..beb9a01d1c4 100644 --- a/sys/kern/Makefile +++ b/sys/kern/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.26 2010/09/10 16:34:08 thib Exp $ +# $OpenBSD: Makefile,v 1.27 2010/12/21 20:14:43 thib Exp $ # Makefile for kernel tags files, init_sysent, etc. @@ -8,16 +8,12 @@ ARCH= alpha amd64 armish aviion beagle hp300 \ mvme88k mvmeppc palm sgi socppc \ solbourne sparc sparc64 vax zaurus -all: init_sysent.c vnode_if.c +all: init_sysent.c SYSCALLSRC = makesyscalls.sh syscalls.conf syscalls.master init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscallargs.h: ${SYSCALLSRC} sh makesyscalls.sh syscalls.conf syscalls.master -VNODEIFSRC = vnode_if.sh vnode_if.src -vnode_if.c ../sys/vnode_if.h: ${VNODEIFSRC} - sh vnode_if.sh vnode_if.src - # Kernel tags: # tags files are built in the top-level directory for each architecture. # Links to the correct tags file are placed in each source directory. diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c index c969db0348e..2e613552f32 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.60 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.61 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -56,56 +56,44 @@ struct vnode *speclisth[SPECHSZ]; -int (**spec_vnodeop_p)(void *); -struct vnodeopv_entry_desc spec_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, vop_generic_lookup }, - { &vop_create_desc, spec_badop }, - { &vop_mknod_desc, spec_badop }, - { &vop_open_desc, spec_open }, - { &vop_close_desc, spec_close }, - { &vop_access_desc, spec_access }, - { &vop_getattr_desc, spec_getattr }, - { &vop_setattr_desc, spec_setattr }, - { &vop_read_desc, spec_read }, - { &vop_write_desc, spec_write }, - { &vop_ioctl_desc, spec_ioctl }, - { &vop_poll_desc, spec_poll }, - { &vop_kqfilter_desc, spec_kqfilter }, - { &vop_revoke_desc, vop_generic_revoke }, - { &vop_fsync_desc, spec_fsync }, - { &vop_remove_desc, spec_badop }, - { &vop_link_desc, spec_badop }, - { &vop_rename_desc, spec_badop }, - { &vop_mkdir_desc, spec_badop }, - { &vop_rmdir_desc, spec_badop }, - { &vop_symlink_desc, spec_badop }, - { &vop_readdir_desc, spec_badop }, - { &vop_readlink_desc, spec_badop }, - { &vop_abortop_desc, spec_badop }, - { &vop_inactive_desc, spec_inactive }, - { &vop_reclaim_desc, nullop }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_bmap_desc, vop_generic_bmap }, - { &vop_strategy_desc, spec_strategy }, - { &vop_print_desc, spec_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_pathconf_desc, spec_pathconf }, - { &vop_advlock_desc, spec_advlock }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops spec_vops = { + .vop_default = eopnotsupp, + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_close = spec_close, + .vop_access = spec_access, + .vop_getattr = spec_getattr, + .vop_setattr = spec_setattr, + .vop_read = spec_read, + .vop_write = spec_write, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = spec_fsync, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_inactive = spec_inactive, + .vop_reclaim = nullop, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_islocked = vop_generic_islocked, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_print = spec_print, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc spec_vnodeop_opv_desc = - { &spec_vnodeop_p, spec_vnodeop_entries }; - -int -spec_vnoperate(void *v) -{ - struct vop_generic_args *ap = v; - - return (VOCALL(spec_vnodeop_p, ap->a_desc->vdesc_offset, ap)); -} /* * Open a special file. diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c index 52506656f46..a71bf4ac355 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_conf.c,v 1.39 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: vfs_conf.c,v 1.40 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: vfs_conf.c,v 1.21.4.1 1995/11/01 00:06:26 jtc Exp $ */ /* @@ -186,93 +186,3 @@ static struct vfsconf vfsconflist[] = { */ int maxvfsconf = sizeof(vfsconflist) / sizeof(struct vfsconf); struct vfsconf *vfsconf = vfsconflist; - - -/* - * vfs_opv_descs enumerates the list of vnode classes, each with its own - * vnode operation vector. It is consulted at system boot to build operation - * vectors. It is NULL terminated. - */ -extern struct vnodeopv_desc sync_vnodeop_opv_desc; -extern struct vnodeopv_desc ffs_vnodeop_opv_desc; -extern struct vnodeopv_desc ffs_specop_opv_desc; -extern struct vnodeopv_desc ffs_fifoop_opv_desc; -extern struct vnodeopv_desc mfs_vnodeop_opv_desc; -extern struct vnodeopv_desc dead_vnodeop_opv_desc; -extern struct vnodeopv_desc fifo_vnodeop_opv_desc; -extern struct vnodeopv_desc spec_vnodeop_opv_desc; -extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc; -extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc; -extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc; -extern struct vnodeopv_desc portal_vnodeop_opv_desc; -extern struct vnodeopv_desc procfs_vnodeop_opv_desc; -extern struct vnodeopv_desc cd9660_vnodeop_opv_desc; -extern struct vnodeopv_desc cd9660_specop_opv_desc; -extern struct vnodeopv_desc cd9660_fifoop_opv_desc; -extern struct vnodeopv_desc msdosfs_vnodeop_opv_desc; -extern struct vnodeopv_desc ext2fs_vnodeop_opv_desc; -extern struct vnodeopv_desc ext2fs_specop_opv_desc; -extern struct vnodeopv_desc ext2fs_fifoop_opv_desc; -extern struct vnodeopv_desc nnpfs_vnodeop_opv_desc; -extern struct vnodeopv_desc ntfs_vnodeop_opv_desc; -extern struct vnodeopv_desc udf_vnodeop_opv_desc; - -struct vnodeopv_desc *vfs_opv_descs[] = { - &sync_vnodeop_opv_desc, -#ifdef FFS - &ffs_vnodeop_opv_desc, - &ffs_specop_opv_desc, -#ifdef FIFO - &ffs_fifoop_opv_desc, -#endif -#endif - &dead_vnodeop_opv_desc, -#ifdef FIFO - &fifo_vnodeop_opv_desc, -#endif - &spec_vnodeop_opv_desc, -#ifdef MFS - &mfs_vnodeop_opv_desc, -#endif -#ifdef NFSCLIENT - &nfsv2_vnodeop_opv_desc, - &spec_nfsv2nodeop_opv_desc, -#ifdef FIFO - &fifo_nfsv2nodeop_opv_desc, -#endif -#endif -#ifdef PORTAL - &portal_vnodeop_opv_desc, -#endif -#ifdef PROCFS - &procfs_vnodeop_opv_desc, -#endif -#ifdef CD9660 - &cd9660_vnodeop_opv_desc, - &cd9660_specop_opv_desc, -#ifdef FIFO - &cd9660_fifoop_opv_desc, -#endif -#endif -#ifdef MSDOSFS - &msdosfs_vnodeop_opv_desc, -#endif -#ifdef EXT2FS - &ext2fs_vnodeop_opv_desc, - &ext2fs_specop_opv_desc, -#ifdef FIFO - &ext2fs_fifoop_opv_desc, -#endif -#endif -#ifdef NNPFS - &nnpfs_vnodeop_opv_desc, -#endif -#ifdef NTFS - &ntfs_vnodeop_opv_desc, -#endif -#ifdef UDF - &udf_vnodeop_opv_desc, -#endif - - NULL -}; diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index c44cace347e..839af0e74e2 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_init.c,v 1.27 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: vfs_init.c,v 1.28 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: vfs_init.c,v 1.6 1996/02/09 19:00:58 christos Exp $ */ /* @@ -50,150 +50,9 @@ #include <sys/pool.h> #include <sys/systm.h> -/* a list of lists of vnodeops defns */ -extern struct vnodeopv_desc *vfs_opv_descs[]; - -/* and the operations they perform */ -extern struct vnodeop_desc *vfs_op_descs[]; - struct pool namei_pool; -/* - * This code doesn't work if the defn is **vnodop_defns with cc. - * The problem is because of the compiler sometimes putting in an - * extra level of indirection for arrays. It's an interesting - * "feature" of C. - */ -int vfs_opv_numops; - -typedef int (*PFI)(void *); - -/* - * vfs_init.c - * - * Allocate and fill in operations vectors. - * - * An undocumented feature of this approach to defining operations is that - * there can be multiple entries in vfs_opv_descs for the same operations - * vector. This allows third parties to extend the set of operations - * supported by another layer in a binary compatible way. For example, - * assume that NFS needed to be modified to support Ficus. NFS has an entry - * (probably nfs_vnopdeop_decls) declaring all the operations NFS supports by - * default. Ficus could add another entry (ficus_nfs_vnodeop_decl_entensions) - * listing those new operations Ficus adds to NFS, all without modifying the - * NFS code. (Of course, the OTW NFS protocol still needs to be munged, but - * that is a(whole)nother story.) This is a feature. - */ - -/* - * Allocate and init the vector, if it needs it. - * Also handle backwards compatibility. - */ -void -vfs_opv_init_explicit(struct vnodeopv_desc *vfs_opv_desc) -{ - int (**opv_desc_vector)(void *); - struct vnodeopv_entry_desc *opve_descp; - - opv_desc_vector = *(vfs_opv_desc->opv_desc_vector_p); - - if (opv_desc_vector == NULL) { - /* XXX - shouldn't be M_VNODE */ - opv_desc_vector = malloc(vfs_opv_numops * sizeof(PFI), - M_VNODE, M_WAITOK|M_ZERO); - *(vfs_opv_desc->opv_desc_vector_p) = opv_desc_vector; - } - - for (opve_descp = vfs_opv_desc->opv_desc_ops; - opve_descp->opve_op; opve_descp++) { - /* - * Sanity check: is this operation listed - * in the list of operations? We check this - * by seeing if its offset is zero. Since - * the default routine should always be listed - * first, it should be the only one with a zero - * offset. Any other operation with a zero - * offset is probably not listed in - * vfs_op_descs, and so is probably an error. - * - * A panic here means the layer programmer - * has committed the all-too common bug - * of adding a new operation to the layer's - * list of vnode operations but - * not adding the operation to the system-wide - * list of supported operations. - */ - if (opve_descp->opve_op->vdesc_offset == 0 && - opve_descp->opve_op != VDESC(vop_default)) { - printf("operation %s not listed in %s.\n", - opve_descp->opve_op->vdesc_name, "vfs_op_descs"); - panic ("vfs_opv_init: bad operation"); - } - - /* - * Fill in this entry. - */ - opv_desc_vector[opve_descp->opve_op->vdesc_offset] = - opve_descp->opve_impl; - } -} - -void -vfs_opv_init_default(struct vnodeopv_desc *vfs_opv_desc) -{ - int j; - int (**opv_desc_vector)(void *); - - opv_desc_vector = *(vfs_opv_desc->opv_desc_vector_p); - - /* - * Force every operations vector to have a default routine. - */ - if (opv_desc_vector[VOFFSET(vop_default)] == NULL) - panic("vfs_opv_init: operation vector without default routine."); - - for (j = 0; j < vfs_opv_numops; j++) - if (opv_desc_vector[j] == NULL) - opv_desc_vector[j] = - opv_desc_vector[VOFFSET(vop_default)]; -} - -/* Initialize known vnode operations vectors. */ -void -vfs_op_init(void) -{ - int i; - - /* Set all vnode vectors to a well known value. */ - for (i = 0; vfs_opv_descs[i]; i++) - *(vfs_opv_descs[i]->opv_desc_vector_p) = NULL; - - /* - * Figure out how many ops there are by counting the table, - * and assign each its offset. - */ - for (vfs_opv_numops = 0, i = 0; vfs_op_descs[i]; i++) { - vfs_op_descs[i]->vdesc_offset = vfs_opv_numops; - vfs_opv_numops++; - } - - /* Allocate the dynamic vectors and fill them in. */ - for (i = 0; vfs_opv_descs[i]; i++) - vfs_opv_init_explicit(vfs_opv_descs[i]); - - /* - * Finally, go back and replace unfilled routines - * with their default. - */ - for (i = 0; vfs_opv_descs[i]; i++) - vfs_opv_init_default(vfs_opv_descs[i]); - -} - - -/* - * Initialize the vnode structures and initialize each file system type. - */ +/* Initialize the vnode structures and initialize each file system type. */ void vfsinit(void) { @@ -204,18 +63,11 @@ vfsinit(void) pool_init(&namei_pool, MAXPATHLEN, 0, 0, 0, "namei", &pool_allocator_nointr); - /* - * Initialize the vnode table - */ + /* Initialize the vnode table. */ vntblinit(); - /* - * Initialize the vnode name cache - */ + + /* Initialize the vnode name cache. */ nchinit(); - /* - * Build vnode operation vectors. - */ - vfs_op_init(); /* * Stop using vfsconf and maxvfsconf as a temporary storage, diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index f3488ca71e2..bbd8b34d690 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.192 2010/12/06 18:44:49 jasper Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.193 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -301,14 +301,13 @@ vattr_null(struct vattr *vap) /* * Routines having to do with the management of the vnode table. */ -extern int (**dead_vnodeop_p)(void *); long numvnodes; /* * Return the next vnode from the free list. */ int -getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *), +getnewvnode(enum vtagtype tag, struct mount *mp, struct vops *vops, struct vnode **vpp) { struct proc *p = curproc; @@ -464,7 +463,7 @@ getdevvp(dev_t dev, struct vnode **vpp, enum vtype type) *vpp = NULLVP; return (0); } - error = getnewvnode(VT_NON, NULL, spec_vnodeop_p, &nvp); + error = getnewvnode(VT_NON, NULL, &spec_vops, &nvp); if (error) { *vpp = NULLVP; return (error); @@ -861,7 +860,7 @@ vflush_vnode(struct vnode *vp, void *arg) { vgonel(vp, p); } else { vclean(vp, 0, p); - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; insmntque(vp, (struct mount *)0); } return (0); @@ -967,7 +966,7 @@ vclean(struct vnode *vp, int flags, struct proc *p) /* * Done with purge, notify sleepers of the grim news. */ - vp->v_op = dead_vnodeop_p; + vp->v_op = &dead_vops; VN_KNOTE(vp, NOTE_REVOKE); vp->v_tag = VT_NON; vp->v_flag &= ~VXLOCK; diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c index f197497b61f..a326e9297e1 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.48 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.49 2010/12/21 20:14:43 thib Exp $ */ /* * Portions of this code are: @@ -254,33 +254,21 @@ speedup_syncer(void) return 0; } -/* - * Routine to create and manage a filesystem syncer vnode. - */ -#define sync_close nullop +/* Routine to create and manage a filesystem syncer vnode. */ int sync_fsync(void *); int sync_inactive(void *); -#define sync_reclaim nullop -#define sync_lock vop_generic_lock -#define sync_unlock vop_generic_unlock int sync_print(void *); -#define sync_islocked vop_generic_islocked - -int (**sync_vnodeop_p)(void *); -struct vnodeopv_entry_desc sync_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_close_desc, sync_close }, - { &vop_fsync_desc, sync_fsync }, - { &vop_inactive_desc, sync_inactive }, - { &vop_reclaim_desc, sync_reclaim }, - { &vop_lock_desc, sync_lock }, - { &vop_unlock_desc, sync_unlock }, - { &vop_print_desc, sync_print }, - { &vop_islocked_desc, sync_islocked }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } -}; -struct vnodeopv_desc sync_vnodeop_opv_desc = { - &sync_vnodeop_p, sync_vnodeop_entries + +struct vops sync_vops = { + .vop_default = eopnotsupp, + .vop_close = nullop, + .vop_fsync = sync_fsync, + .vop_inactive = sync_inactive, + .vop_reclaim = nullop, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_islocked = vop_generic_islocked, + .vop_print = sync_print }; /* @@ -294,7 +282,7 @@ vfs_allocate_syncvnode(struct mount *mp) int error; /* Allocate a new vnode */ - if ((error = getnewvnode(VT_VFS, mp, sync_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode(VT_VFS, mp, &sync_vops, &vp)) != 0) { mp->mnt_syncer = NULL; return (error); } diff --git a/sys/miscfs/deadfs/dead_vnops.c b/sys/miscfs/deadfs/dead_vnops.c index d2d5d6c216b..2c3e9520969 100644 --- a/sys/miscfs/deadfs/dead_vnops.c +++ b/sys/miscfs/deadfs/dead_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dead_vnops.c,v 1.24 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: dead_vnops.c,v 1.25 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: dead_vnops.c,v 1.16 1996/02/13 13:12:48 mycroft Exp $ */ /* @@ -60,47 +60,42 @@ int dead_print(void *); int chkvnlock(struct vnode *); -int (**dead_vnodeop_p)(void *); - -struct vnodeopv_entry_desc dead_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, vop_generic_lookup }, - { &vop_create_desc, dead_badop }, - { &vop_mknod_desc, dead_badop }, - { &vop_open_desc, dead_open }, - { &vop_close_desc, nullop }, - { &vop_access_desc, dead_ebadf }, - { &vop_getattr_desc, dead_ebadf }, - { &vop_setattr_desc, dead_ebadf }, - { &vop_read_desc, dead_read }, - { &vop_write_desc, dead_write }, - { &vop_ioctl_desc, dead_ioctl }, - { &vop_poll_desc, dead_poll }, - { &vop_fsync_desc, nullop }, - { &vop_remove_desc, dead_badop }, - { &vop_link_desc, dead_badop }, - { &vop_rename_desc, dead_badop }, - { &vop_mkdir_desc, dead_badop }, - { &vop_rmdir_desc, dead_badop }, - { &vop_symlink_desc, dead_badop }, - { &vop_readdir_desc, dead_ebadf }, - { &vop_readlink_desc, dead_ebadf }, - { &vop_abortop_desc, dead_badop }, - { &vop_inactive_desc, nullop }, - { &vop_reclaim_desc, nullop }, - { &vop_lock_desc, dead_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_bmap_desc, dead_bmap }, - { &vop_strategy_desc, dead_strategy }, - { &vop_print_desc, dead_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_pathconf_desc, dead_ebadf }, - { &vop_advlock_desc, dead_ebadf }, - { &vop_bwrite_desc, nullop }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } +struct vops dead_vops = { + .vop_default = eopnotsupp, + .vop_lookup = vop_generic_lookup, + .vop_create = dead_badop, + .vop_mknod = dead_badop, + .vop_open = dead_open, + .vop_close = nullop, + .vop_access = dead_ebadf, + .vop_getattr = dead_ebadf, + .vop_setattr = dead_ebadf, + .vop_read = dead_read, + .vop_write = dead_write, + .vop_ioctl = dead_ioctl, + .vop_poll = dead_poll, + .vop_fsync = nullop, + .vop_remove = dead_badop, + .vop_link = dead_badop, + .vop_rename = dead_badop, + .vop_mkdir = dead_badop, + .vop_rmdir = dead_badop, + .vop_symlink = dead_badop, + .vop_readdir = dead_ebadf, + .vop_readlink = dead_ebadf, + .vop_abortop = dead_badop, + .vop_inactive = nullop, + .vop_reclaim = nullop, + .vop_lock = dead_lock, + .vop_unlock = vop_generic_unlock, + .vop_bmap = dead_bmap, + .vop_strategy = dead_strategy, + .vop_print = dead_print, + .vop_islocked = vop_generic_islocked, + .vop_pathconf = dead_ebadf, + .vop_advlock = dead_ebadf, + .vop_bwrite = nullop, }; -struct vnodeopv_desc dead_vnodeop_opv_desc = - { &dead_vnodeop_p, dead_vnodeop_entries }; /* * Open always fails as if device did not exist. @@ -156,7 +151,7 @@ dead_ioctl(void *v) if (!chkvnlock(ap->a_vp)) return (EBADF); - return (VCALL(ap->a_vp, VOFFSET(vop_ioctl), ap)); + return ((ap->a_vp->v_op->vop_ioctl)(ap)); } /* ARGSUSED */ @@ -204,7 +199,7 @@ dead_lock(void *v) if (ap->a_flags & LK_DRAIN || !chkvnlock(vp)) return (0); - return (VCALL(vp, VOFFSET(vop_lock), ap)); + return ((vp->v_op->vop_lock)(ap)); } /* diff --git a/sys/miscfs/fifofs/fifo.h b/sys/miscfs/fifofs/fifo.h index 624ecbaadef..140563c52f1 100644 --- a/sys/miscfs/fifofs/fifo.h +++ b/sys/miscfs/fifofs/fifo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo.h,v 1.21 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: fifo.h,v 1.22 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: fifo.h,v 1.10 1996/02/09 22:40:15 christos Exp $ */ /* @@ -53,8 +53,4 @@ int fifo_pathconf(void *); int fifo_advlock(void *); void fifo_printinfo(struct vnode *); -int fifo_vnoperate(void *); - -extern int (**fifo_vnodeop_p)(void *); - #endif /* FIFO */ diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index fd24c082f4a..f00851c0713 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.33 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.34 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -61,58 +61,45 @@ struct fifoinfo { long fi_writers; }; -int (**fifo_vnodeop_p)(void *); -struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, vop_generic_lookup }, - { &vop_create_desc, fifo_badop }, - { &vop_mknod_desc, fifo_badop }, - { &vop_open_desc, fifo_open }, - { &vop_close_desc, fifo_close }, - { &vop_access_desc, fifo_ebadf }, - { &vop_getattr_desc, fifo_ebadf }, - { &vop_setattr_desc, fifo_ebadf }, - { &vop_read_desc, fifo_read }, - { &vop_write_desc, fifo_write }, - { &vop_ioctl_desc, fifo_ioctl }, - { &vop_poll_desc, fifo_poll }, - { &vop_kqfilter_desc, fifo_kqfilter }, - { &vop_revoke_desc, vop_generic_revoke }, - { &vop_fsync_desc, nullop }, - { &vop_remove_desc, fifo_badop }, - { &vop_link_desc, fifo_badop }, - { &vop_rename_desc, fifo_badop }, - { &vop_mkdir_desc, fifo_badop }, - { &vop_rmdir_desc, fifo_badop }, - { &vop_symlink_desc, fifo_badop }, - { &vop_readdir_desc, fifo_badop }, - { &vop_readlink_desc, fifo_badop }, - { &vop_abortop_desc, fifo_badop }, - { &vop_inactive_desc, fifo_inactive }, - { &vop_reclaim_desc, fifo_reclaim }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_bmap_desc, vop_generic_bmap }, - { &vop_strategy_desc, fifo_badop }, - { &vop_print_desc, fifo_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_pathconf_desc, fifo_pathconf }, - { &vop_advlock_desc, fifo_advlock }, - { &vop_bwrite_desc, nullop }, - { NULL, NULL } +struct vops fifo_vops = { + .vop_default = eopnotsupp, + .vop_lookup = vop_generic_lookup, + .vop_create = fifo_badop, + .vop_mknod = fifo_badop, + .vop_open = fifo_open, + .vop_close = fifo_close, + .vop_access = fifo_ebadf, + .vop_getattr = fifo_ebadf, + .vop_setattr = fifo_ebadf, + .vop_read = fifo_read, + .vop_write = fifo_write, + .vop_ioctl = fifo_ioctl, + .vop_poll = fifo_poll, + .vop_kqfilter = fifo_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = nullop, + .vop_remove = fifo_badop, + .vop_link = fifo_badop, + .vop_rename = fifo_badop, + .vop_mkdir = fifo_badop, + .vop_rmdir = fifo_badop, + .vop_symlink = fifo_badop, + .vop_readdir = fifo_badop, + .vop_readlink = fifo_badop, + .vop_abortop = fifo_badop, + .vop_inactive = fifo_inactive, + .vop_reclaim = fifo_reclaim, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_bmap = vop_generic_bmap, + .vop_strategy = fifo_badop, + .vop_print = fifo_print, + .vop_islocked = vop_generic_islocked, + .vop_pathconf = fifo_pathconf, + .vop_advlock = fifo_advlock, + .vop_bwrite = nullop }; -struct vnodeopv_desc fifo_vnodeop_opv_desc = - { &fifo_vnodeop_p, fifo_vnodeop_entries }; - -int -fifo_vnoperate(void *v) -{ - struct vop_generic_args *ap = v; - - return (VOCALL(fifo_vnodeop_p, ap->a_desc->vdesc_offset, ap)); -} - void filt_fifordetach(struct knote *kn); int filt_fiforead(struct knote *kn, long hint); void filt_fifowdetach(struct knote *kn); diff --git a/sys/miscfs/procfs/procfs.h b/sys/miscfs/procfs/procfs.h index 4e858b65661..02b2efab39a 100644 --- a/sys/miscfs/procfs/procfs.h +++ b/sys/miscfs/procfs/procfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs.h,v 1.26 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: procfs.h,v 1.27 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: procfs.h,v 1.17 1996/02/12 15:01:41 christos Exp $ */ /* @@ -135,7 +135,7 @@ int procfs_rw(void *); #define PROCFS_LOCKED 0x01 #define PROCFS_WANT 0x02 -extern int (**procfs_vnodeop_p)(void *); +extern struct vops procfs_vops; extern const struct vfsops procfs_vfsops; struct vfsconf; diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 2b1985e098f..bb504a860aa 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_subr.c,v 1.33 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: procfs_subr.c,v 1.34 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */ /* @@ -111,7 +111,7 @@ loop: } } - if ((error = getnewvnode(VT_PROCFS, mp, procfs_vnodeop_p, vpp)) != 0) + if ((error = getnewvnode(VT_PROCFS, mp, &procfs_vops, vpp)) != 0) goto out; vp = *vpp; diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index c8cfed6fde2..da9edb7c185 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.49 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.50 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -138,45 +138,41 @@ static pid_t atopid(const char *, u_int); /* * procfs vnode operations. */ -int (**procfs_vnodeop_p)(void *); -struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, procfs_lookup }, - { &vop_create_desc, procfs_badop }, - { &vop_mknod_desc, procfs_badop }, - { &vop_open_desc, procfs_open }, - { &vop_close_desc, procfs_close }, - { &vop_access_desc, procfs_access }, - { &vop_getattr_desc, procfs_getattr }, - { &vop_setattr_desc, procfs_setattr }, - { &vop_read_desc, procfs_rw }, - { &vop_write_desc, procfs_rw }, - { &vop_ioctl_desc, procfs_ioctl }, - { &vop_poll_desc, procfs_poll }, - { &vop_fsync_desc, procfs_badop}, - { &vop_remove_desc, procfs_badop }, - { &vop_link_desc, procfs_link }, - { &vop_rename_desc, procfs_badop }, - { &vop_mkdir_desc, procfs_badop }, - { &vop_rmdir_desc, procfs_badop }, - { &vop_symlink_desc, procfs_symlink }, - { &vop_readdir_desc, procfs_readdir }, - { &vop_readlink_desc, procfs_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, procfs_inactive }, - { &vop_reclaim_desc, procfs_reclaim }, - { &vop_lock_desc, nullop }, - { &vop_unlock_desc, nullop }, - { &vop_bmap_desc, vop_generic_bmap }, - { &vop_strategy_desc, procfs_badop }, - { &vop_print_desc, procfs_print }, - { &vop_islocked_desc, nullop }, - { &vop_pathconf_desc, procfs_pathconf }, - { &vop_advlock_desc, procfs_badop }, - { NULL, NULL } +struct vops procfs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = procfs_lookup, + .vop_create = procfs_badop, + .vop_mknod = procfs_badop, + .vop_open = procfs_open, + .vop_close = procfs_close, + .vop_access = procfs_access, + .vop_getattr = procfs_getattr, + .vop_setattr = procfs_setattr, + .vop_read = procfs_rw, + .vop_write = procfs_rw, + .vop_ioctl = procfs_ioctl, + .vop_poll = procfs_poll, + .vop_fsync = procfs_badop, + .vop_remove = procfs_badop, + .vop_link = procfs_link, + .vop_rename = procfs_badop, + .vop_mkdir = procfs_badop, + .vop_rmdir = procfs_badop, + .vop_symlink = procfs_symlink, + .vop_readdir = procfs_readdir, + .vop_readlink = procfs_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = procfs_inactive, + .vop_reclaim = procfs_reclaim, + .vop_lock = nullop, + .vop_unlock = nullop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = procfs_badop, + .vop_print = procfs_print, + .vop_islocked = nullop, + .vop_pathconf = procfs_pathconf, + .vop_advlock = procfs_badop, }; -struct vnodeopv_desc procfs_vnodeop_opv_desc = - { &procfs_vnodeop_p, procfs_vnodeop_entries }; /* * set things up for doing i/o on * the pfsnode (vp). (vp) is locked diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index c969db0348e..2e613552f32 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.60 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.61 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -56,56 +56,44 @@ struct vnode *speclisth[SPECHSZ]; -int (**spec_vnodeop_p)(void *); -struct vnodeopv_entry_desc spec_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, vop_generic_lookup }, - { &vop_create_desc, spec_badop }, - { &vop_mknod_desc, spec_badop }, - { &vop_open_desc, spec_open }, - { &vop_close_desc, spec_close }, - { &vop_access_desc, spec_access }, - { &vop_getattr_desc, spec_getattr }, - { &vop_setattr_desc, spec_setattr }, - { &vop_read_desc, spec_read }, - { &vop_write_desc, spec_write }, - { &vop_ioctl_desc, spec_ioctl }, - { &vop_poll_desc, spec_poll }, - { &vop_kqfilter_desc, spec_kqfilter }, - { &vop_revoke_desc, vop_generic_revoke }, - { &vop_fsync_desc, spec_fsync }, - { &vop_remove_desc, spec_badop }, - { &vop_link_desc, spec_badop }, - { &vop_rename_desc, spec_badop }, - { &vop_mkdir_desc, spec_badop }, - { &vop_rmdir_desc, spec_badop }, - { &vop_symlink_desc, spec_badop }, - { &vop_readdir_desc, spec_badop }, - { &vop_readlink_desc, spec_badop }, - { &vop_abortop_desc, spec_badop }, - { &vop_inactive_desc, spec_inactive }, - { &vop_reclaim_desc, nullop }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_bmap_desc, vop_generic_bmap }, - { &vop_strategy_desc, spec_strategy }, - { &vop_print_desc, spec_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_pathconf_desc, spec_pathconf }, - { &vop_advlock_desc, spec_advlock }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops spec_vops = { + .vop_default = eopnotsupp, + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_close = spec_close, + .vop_access = spec_access, + .vop_getattr = spec_getattr, + .vop_setattr = spec_setattr, + .vop_read = spec_read, + .vop_write = spec_write, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = spec_fsync, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_inactive = spec_inactive, + .vop_reclaim = nullop, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_islocked = vop_generic_islocked, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_print = spec_print, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc spec_vnodeop_opv_desc = - { &spec_vnodeop_p, spec_vnodeop_entries }; - -int -spec_vnoperate(void *v) -{ - struct vop_generic_args *ap = v; - - return (VOCALL(spec_vnodeop_p, ap->a_desc->vdesc_offset, ap)); -} /* * Open a special file. diff --git a/sys/miscfs/specfs/specdev.h b/sys/miscfs/specfs/specdev.h index daad3235132..66662c95919 100644 --- a/sys/miscfs/specfs/specdev.h +++ b/sys/miscfs/specfs/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.28 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: specdev.h,v 1.29 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ /* @@ -82,7 +82,7 @@ extern struct vnode *speclisth[SPECHSZ]; /* * Prototypes for special file operations on vnodes. */ -extern int (**spec_vnodeop_p)(void *); +extern struct vops spec_vops; struct nameidata; struct componentname; struct ucred; @@ -108,8 +108,6 @@ int spec_print(void *); int spec_pathconf(void *); int spec_advlock(void *); -int spec_vnoperate(void *); - /* spec_subr.c */ int spec_open_clone(struct vop_open_args *); int spec_close_clone(struct vop_close_args *); diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index a746e145b1e..1aa3c82400e 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_denode.c,v 1.41 2010/10/27 19:16:17 deraadt Exp $ */ +/* $OpenBSD: msdosfs_denode.c,v 1.42 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.23 1997/10/17 11:23:58 ws Exp $ */ /*- @@ -168,7 +168,7 @@ deget(struct msdosfsmount *pmp, uint32_t dirclust, uint32_t diroffset, struct denode **depp) { int error; - extern int (**msdosfs_vnodeop_p)(void *); + extern struct vops msdosfs_vops; struct direntry *direntptr; struct denode *ldep; struct vnode *nvp; @@ -211,8 +211,7 @@ retry: * copy it from the passed disk buffer. */ /* getnewvnode() does a vref() on the vnode */ - error = getnewvnode(VT_MSDOSFS, pmp->pm_mountp, - msdosfs_vnodeop_p, &nvp); + error = getnewvnode(VT_MSDOSFS, pmp->pm_mountp, &msdosfs_vops, &nvp); if (error) { *depp = 0; return (error); diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index d274098342d..ed972c4bc32 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.75 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.76 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -1729,7 +1729,7 @@ msdosfs_strategy(void *v) vp = dep->de_devvp; bp->b_dev = vp->v_rdev; - VOCALL(vp->v_op, VOFFSET(vop_strategy), ap); + (vp->v_op->vop_strategy)(ap); return (0); } @@ -1815,43 +1815,39 @@ fileidhash(uint64_t fileid) } /* Global vfs data structures for msdosfs */ -int (**msdosfs_vnodeop_p)(void *); -struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, msdosfs_lookup }, - { &vop_create_desc, msdosfs_create }, - { &vop_mknod_desc, msdosfs_mknod }, - { &vop_open_desc, msdosfs_open }, - { &vop_close_desc, msdosfs_close }, - { &vop_access_desc, msdosfs_access }, - { &vop_getattr_desc, msdosfs_getattr }, - { &vop_setattr_desc, msdosfs_setattr }, - { &vop_read_desc, msdosfs_read }, - { &vop_write_desc, msdosfs_write }, - { &vop_ioctl_desc, msdosfs_ioctl }, - { &vop_poll_desc, msdosfs_poll }, - { &vop_fsync_desc, msdosfs_fsync }, - { &vop_remove_desc, msdosfs_remove }, - { &vop_link_desc, msdosfs_link }, - { &vop_rename_desc, msdosfs_rename }, - { &vop_mkdir_desc, msdosfs_mkdir }, - { &vop_rmdir_desc, msdosfs_rmdir }, - { &vop_symlink_desc, msdosfs_symlink }, - { &vop_readdir_desc, msdosfs_readdir }, - { &vop_readlink_desc, msdosfs_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, msdosfs_inactive }, - { &vop_reclaim_desc, msdosfs_reclaim }, - { &vop_lock_desc, msdosfs_lock }, - { &vop_unlock_desc, msdosfs_unlock }, - { &vop_bmap_desc, msdosfs_bmap }, - { &vop_strategy_desc, msdosfs_strategy }, - { &vop_print_desc, msdosfs_print }, - { &vop_islocked_desc, msdosfs_islocked }, - { &vop_pathconf_desc, msdosfs_pathconf }, - { &vop_advlock_desc, msdosfs_advlock }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc *)NULL, (int (*)(void *))NULL } +struct vops msdosfs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = msdosfs_lookup, + .vop_create = msdosfs_create, + .vop_mknod = msdosfs_mknod, + .vop_open = msdosfs_open, + .vop_close = msdosfs_close, + .vop_access = msdosfs_access, + .vop_getattr = msdosfs_getattr, + .vop_setattr = msdosfs_setattr, + .vop_read = msdosfs_read, + .vop_write = msdosfs_write, + .vop_ioctl = msdosfs_ioctl, + .vop_poll = msdosfs_poll, + .vop_fsync = msdosfs_fsync, + .vop_remove = msdosfs_remove, + .vop_link = msdosfs_link, + .vop_rename = msdosfs_rename, + .vop_mkdir = msdosfs_mkdir, + .vop_rmdir = msdosfs_rmdir, + .vop_symlink = msdosfs_symlink, + .vop_readdir = msdosfs_readdir, + .vop_readlink = msdosfs_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = msdosfs_inactive, + .vop_reclaim = msdosfs_reclaim, + .vop_lock = msdosfs_lock, + .vop_unlock = msdosfs_unlock, + .vop_bmap = msdosfs_bmap, + .vop_strategy = msdosfs_strategy, + .vop_print = msdosfs_print, + .vop_islocked = msdosfs_islocked, + .vop_pathconf = msdosfs_pathconf, + .vop_advlock = msdosfs_advlock, + .vop_bwrite = vop_generic_bwrite }; -struct vnodeopv_desc msdosfs_vnodeop_opv_desc = - { &msdosfs_vnodeop_p, msdosfs_vnodeop_entries }; diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index c340d136b61..9c7efe60679 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.54 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.55 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */ /* @@ -60,6 +60,9 @@ extern int prtactive; struct rwlock nfs_hashlock = RWLOCK_INITIALIZER("nfshshlk"); +/* XXX */ +extern struct vops nfs_vops; + /* filehandle to node lookup. */ static __inline int nfsnode_cmp(const struct nfsnode *a, const struct nfsnode *b) @@ -81,7 +84,6 @@ RB_GENERATE(nfs_nodetree, nfsnode, n_entry, nfsnode_cmp); int nfs_nget(struct mount *mnt, nfsfh_t *fh, int fhsize, struct nfsnode **npp) { - extern int (**nfsv2_vnodeop_p)(void *); /* XXX */ struct nfsmount *nmp; struct nfsnode *np, find, *np2; struct vnode *vp, *nvp; @@ -114,7 +116,7 @@ loop: * the lock. */ rw_exit_write(&nfs_hashlock); - error = getnewvnode(VT_NFS, mnt, nfsv2_vnodeop_p, &nvp); + error = getnewvnode(VT_NFS, mnt, &nfs_vops, &nvp); /* note that we don't have this vnode set up completely yet */ rw_enter_write(&nfs_hashlock); if (error) { diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 4dfa67f9b32..a97633354e5 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.111 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.112 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -940,7 +940,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, struct vnode *vp = *vpp; struct vattr *vap; struct nfs_fattr *fp; - extern int (**spec_nfsv2nodeop_p)(void *); + extern struct vops nfs_specvops; struct nfsnode *np; int32_t t1; caddr_t cp2; @@ -996,12 +996,12 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, #ifndef FIFO return (EOPNOTSUPP); #else - extern int (**fifo_nfsv2nodeop_p)(void *); - vp->v_op = fifo_nfsv2nodeop_p; + extern struct vops nfs_fifovops; + vp->v_op = &nfs_fifovops; #endif /* FIFO */ } if (vp->v_type == VCHR || vp->v_type == VBLK) { - vp->v_op = spec_nfsv2nodeop_p; + vp->v_op = &nfs_specvops; nvp = checkalias(vp, (dev_t)rdev, vp->v_mount); if (nvp) { /* @@ -1012,7 +1012,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, nvp->v_data = vp->v_data; vp->v_data = NULL; - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; vrele(vp); vgone(vp); /* diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 866ca5c11fd..60d37c01b97 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.132 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.133 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -83,98 +83,129 @@ void nfs_cache_enter(struct vnode *, struct vnode *, struct componentname *); -/* - * Global vfs data structures for nfs - */ -int (**nfsv2_vnodeop_p)(void *); -struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, nfs_lookup }, - { &vop_create_desc, nfs_create }, - { &vop_mknod_desc, nfs_mknod }, - { &vop_open_desc, nfs_open }, - { &vop_close_desc, nfs_close }, - { &vop_access_desc, nfs_access }, - { &vop_getattr_desc, nfs_getattr }, - { &vop_setattr_desc, nfs_setattr }, - { &vop_read_desc, nfs_read }, - { &vop_write_desc, nfs_write }, - { &vop_ioctl_desc, nfs_ioctl }, - { &vop_poll_desc, nfs_poll }, - { &vop_kqfilter_desc, nfs_kqfilter }, - { &vop_revoke_desc, vop_generic_revoke }, - { &vop_fsync_desc, nfs_fsync }, - { &vop_remove_desc, nfs_remove }, - { &vop_link_desc, nfs_link }, - { &vop_rename_desc, nfs_rename }, - { &vop_mkdir_desc, nfs_mkdir }, - { &vop_rmdir_desc, nfs_rmdir }, - { &vop_symlink_desc, nfs_symlink }, - { &vop_readdir_desc, nfs_readdir }, - { &vop_readlink_desc, nfs_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, nfs_inactive }, - { &vop_reclaim_desc, nfs_reclaim }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_bmap_desc, nfs_bmap }, - { &vop_strategy_desc, nfs_strategy }, - { &vop_print_desc, nfs_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_pathconf_desc, nfs_pathconf }, - { &vop_advlock_desc, nfs_advlock }, - { &vop_bwrite_desc, nfs_bwrite }, - { NULL, NULL } +/* Global vfs data structures for nfs. */ +struct vops nfs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = nfs_lookup, + .vop_create = nfs_create, + .vop_mknod = nfs_mknod, + .vop_open = nfs_open, + .vop_close = nfs_close, + .vop_access = nfs_access, + .vop_getattr = nfs_getattr, + .vop_setattr = nfs_setattr, + .vop_read = nfs_read, + .vop_write = nfs_write, + .vop_ioctl = nfs_ioctl, + .vop_poll = nfs_poll, + .vop_kqfilter = nfs_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = nfs_fsync, + .vop_remove = nfs_remove, + .vop_link = nfs_link, + .vop_rename = nfs_rename, + .vop_mkdir = nfs_mkdir, + .vop_rmdir = nfs_rmdir, + .vop_symlink = nfs_symlink, + .vop_readdir = nfs_readdir, + .vop_readlink = nfs_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = nfs_inactive, + .vop_reclaim = nfs_reclaim, + .vop_lock = vop_generic_lock, /* XXX: beck@ must fix this. */ + .vop_unlock = vop_generic_unlock, + .vop_bmap = nfs_bmap, + .vop_strategy = nfs_strategy, + .vop_print = nfs_print, + .vop_islocked = vop_generic_islocked, + .vop_pathconf = nfs_pathconf, + .vop_advlock = nfs_advlock, + .vop_bwrite = nfs_bwrite }; -struct vnodeopv_desc nfsv2_vnodeop_opv_desc = - { &nfsv2_vnodeop_p, nfsv2_vnodeop_entries }; -/* - * Special device vnode ops - */ -int (**spec_nfsv2nodeop_p)(void *); -struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = { - { &vop_default_desc, spec_vnoperate }, - { &vop_close_desc, nfsspec_close }, - { &vop_access_desc, nfsspec_access }, - { &vop_getattr_desc, nfs_getattr }, - { &vop_setattr_desc, nfs_setattr }, - { &vop_read_desc, nfsspec_read }, - { &vop_write_desc, nfsspec_write }, - { &vop_fsync_desc, nfs_fsync }, - { &vop_inactive_desc, nfs_inactive }, - { &vop_reclaim_desc, nfs_reclaim }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_print_desc, nfs_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { NULL, NULL } +/* Special device vnode ops. */ +struct vops nfs_specvops = { + .vop_default = eopnotsupp, + .vop_close = nfsspec_close, + .vop_access = nfsspec_access, + .vop_getattr = nfs_getattr, + .vop_setattr = nfs_setattr, + .vop_read = nfsspec_read, + .vop_write = nfsspec_write, + .vop_fsync = nfs_fsync, + .vop_inactive = nfs_inactive, + .vop_reclaim = nfs_reclaim, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_print = nfs_print, + .vop_islocked = vop_generic_islocked, + + /* XXX: Keep in sync with spec_vops. */ + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc spec_nfsv2nodeop_opv_desc = - { &spec_nfsv2nodeop_p, spec_nfsv2nodeop_entries }; #ifdef FIFO -int (**fifo_nfsv2nodeop_p)(void *); -struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = { - { &vop_default_desc, fifo_vnoperate }, - { &vop_close_desc, nfsfifo_close }, - { &vop_access_desc, nfsspec_access }, - { &vop_getattr_desc, nfs_getattr }, - { &vop_setattr_desc, nfs_setattr }, - { &vop_read_desc, nfsfifo_read }, - { &vop_write_desc, nfsfifo_write }, - { &vop_fsync_desc, nfs_fsync }, - { &vop_inactive_desc, nfs_inactive }, - { &vop_reclaim_desc, nfsfifo_reclaim }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_print_desc, nfs_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops nfs_fifovops = { + .vop_default = eopnotsupp, + .vop_close = nfsfifo_close, + .vop_access = nfsspec_access, + .vop_getattr = nfs_getattr, + .vop_setattr = nfs_setattr, + .vop_read = nfsfifo_read, + .vop_write = nfsfifo_write, + .vop_fsync = nfs_fsync, + .vop_inactive = nfs_inactive, + .vop_reclaim = nfsfifo_reclaim, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_print = nfs_print, + .vop_islocked = vop_generic_islocked, + .vop_bwrite = vop_generic_bwrite, + + /* XXX: Keep in sync with fifo_vops. */ + .vop_lookup = vop_generic_lookup, + .vop_create = fifo_badop, + .vop_mknod = fifo_badop, + .vop_open = fifo_open, + .vop_ioctl = fifo_ioctl, + .vop_poll = fifo_poll, + .vop_kqfilter = fifo_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = fifo_badop, + .vop_link = fifo_badop, + .vop_rename = fifo_badop, + .vop_mkdir = fifo_badop, + .vop_rmdir = fifo_badop, + .vop_symlink = fifo_badop, + .vop_readdir = fifo_badop, + .vop_readlink = fifo_badop, + .vop_abortop = fifo_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = fifo_badop, + .vop_pathconf = fifo_pathconf, + .vop_advlock = fifo_advlock, }; -struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc = - { &fifo_nfsv2nodeop_p, fifo_nfsv2nodeop_entries }; #endif /* FIFO */ /* @@ -3127,7 +3158,7 @@ nfsspec_read(void *v) */ np->n_flag |= NACC; getnanotime(&np->n_atim); - return (VOCALL(spec_vnodeop_p, VOFFSET(vop_read), ap)); + return (spec_read(ap)); } /* @@ -3144,7 +3175,7 @@ nfsspec_write(void *v) */ np->n_flag |= NUPD; getnanotime(&np->n_mtim); - return (VOCALL(spec_vnodeop_p, VOFFSET(vop_write), ap)); + return (spec_write(ap)); } /* @@ -3172,7 +3203,7 @@ nfsspec_close(void *v) (void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_p); } } - return (VOCALL(spec_vnodeop_p, VOFFSET(vop_close), ap)); + return (spec_close(ap)); } #ifdef FIFO @@ -3183,7 +3214,6 @@ int nfsfifo_read(void *v) { struct vop_read_args *ap = v; - extern int (**fifo_vnodeop_p)(void *); struct nfsnode *np = VTONFS(ap->a_vp); /* @@ -3191,7 +3221,7 @@ nfsfifo_read(void *v) */ np->n_flag |= NACC; getnanotime(&np->n_atim); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap)); + return (fifo_read(ap)); } /* @@ -3201,7 +3231,6 @@ int nfsfifo_write(void *v) { struct vop_write_args *ap = v; - extern int (**fifo_vnodeop_p)(void *); struct nfsnode *np = VTONFS(ap->a_vp); /* @@ -3209,7 +3238,7 @@ nfsfifo_write(void *v) */ np->n_flag |= NUPD; getnanotime(&np->n_mtim); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap)); + return (fifo_write(ap)); } /* @@ -3224,7 +3253,6 @@ nfsfifo_close(void *v) struct vnode *vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); struct vattr vattr; - extern int (**fifo_vnodeop_p)(void *); if (np->n_flag & (NACC | NUPD)) { if (np->n_flag & NACC) { @@ -3244,7 +3272,7 @@ nfsfifo_close(void *v) (void)VOP_SETATTR(vp, &vattr, ap->a_cred, ap->a_p); } } - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_close(ap)); } int diff --git a/sys/nnpfs/nnpfs_node-bsd.c b/sys/nnpfs/nnpfs_node-bsd.c index f2e9179a915..2a86bd08ece 100644 --- a/sys/nnpfs/nnpfs_node-bsd.c +++ b/sys/nnpfs/nnpfs_node-bsd.c @@ -40,7 +40,7 @@ RCSID("$arla: nnpfs_node-bsd.c,v 1.70 2003/02/28 02:01:06 lha Exp $"); -extern vop_t **nnpfs_vnodeop_p; +extern struct vops nnpfs_vops; #ifndef LK_NOPAUSE #define LK_NOPAUSE 0 @@ -58,7 +58,7 @@ nnpfs_getnewvnode(struct nnpfs *nnpfsp, struct vnode **vpp, struct nnpfs_node *result, *check; int error; - error = getnewvnode(VT_NNPFS, NNPFS_TO_VFS(nnpfsp), nnpfs_vnodeop_p, vpp); + error = getnewvnode(VT_NNPFS, NNPFS_TO_VFS(nnpfsp), &nnpfs_vops, vpp); if (error) return error; diff --git a/sys/nnpfs/nnpfs_vfsops-openbsd.c b/sys/nnpfs/nnpfs_vfsops-openbsd.c index e5a99b731c7..24100c7c2a5 100644 --- a/sys/nnpfs/nnpfs_vfsops-openbsd.c +++ b/sys/nnpfs/nnpfs_vfsops-openbsd.c @@ -44,7 +44,15 @@ RCSID("$arla: nnpfs_vfsops-openbsd.c,v 1.16 2003/06/02 18:26:50 lha Exp $"); #include <nnpfs/nnpfs_vfsops-bsd.h> #include <nnpfs/nnpfs_vnodeops.h> -static vop_t **nnpfs_dead_vnodeop_p; + +struct vops nnpfs_deadvops = { + .vop_default = (vop_t *)nnpfs_eopnotsupp, + .vop_lookup = (vop_t *)nnpfs_dead_lookup, + .vop_reclaim = (vop_t *)nnpfs_returnzero, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_islocked = vop_generic_islocked +}; int nnpfs_make_dead_vnode(struct mount *mp, struct vnode **vpp) @@ -52,31 +60,13 @@ nnpfs_make_dead_vnode(struct mount *mp, struct vnode **vpp) NNPFSDEB(XDEBNODE, ("make_dead_vnode mp = %lx\n", (unsigned long)mp)); - return getnewvnode(VT_NON, mp, nnpfs_dead_vnodeop_p, vpp); + return getnewvnode(VT_NON, mp, &nnpfs_deadvops, vpp); } -static struct vnodeopv_entry_desc nnpfs_dead_vnodeop_entries[] = { - {&vop_default_desc, (vop_t *) nnpfs_eopnotsupp}, - {&vop_lookup_desc, (vop_t *) nnpfs_dead_lookup}, - {&vop_reclaim_desc, (vop_t *) nnpfs_returnzero}, - {&vop_lock_desc, (vop_t *) vop_generic_lock}, - {&vop_unlock_desc, (vop_t *) vop_generic_unlock}, - {&vop_islocked_desc,(vop_t *) vop_generic_islocked}, - {NULL, NULL}}; - -static struct vnodeopv_desc nnpfs_dead_vnodeop_opv_desc = -{&nnpfs_dead_vnodeop_p, nnpfs_dead_vnodeop_entries}; - -extern struct vnodeopv_desc nnpfs_vnodeop_opv_desc; - static int nnpfs_init(struct vfsconf *vfs) { NNPFSDEB(XDEBVFOPS, ("nnpfs_init\n")); - vfs_opv_init_explicit(&nnpfs_vnodeop_opv_desc); - vfs_opv_init_default(&nnpfs_vnodeop_opv_desc); - vfs_opv_init_explicit(&nnpfs_dead_vnodeop_opv_desc); - vfs_opv_init_default(&nnpfs_dead_vnodeop_opv_desc); return 0; } diff --git a/sys/nnpfs/nnpfs_vnodeops-bsd.c b/sys/nnpfs/nnpfs_vnodeops-bsd.c index e293154a270..0fa50213ad2 100644 --- a/sys/nnpfs/nnpfs_vnodeops-bsd.c +++ b/sys/nnpfs/nnpfs_vnodeops-bsd.c @@ -1393,42 +1393,34 @@ nnpfs_pushdirty(struct vnode *vp, struct ucred *cred, d_thread_t *p) } - -static struct vnodeopv_entry_desc nnpfs_vnodeop_entries[] = { - {&vop_default_desc, (vop_t *) nnpfs_eopnotsupp}, +struct vops nnpfs_vops = { + .vop_default = (vop_t *)nnpfs_eopnotsupp, #ifdef HAVE_VOP_LOOKUP -#ifdef HAVE_KERNEL_VFS_CACHE_LOOKUP - {&vop_lookup_desc, (vop_t *) vfs_cache_lookup }, -#else - {&vop_lookup_desc, (vop_t *) nnpfs_lookup }, -#endif -#endif -#ifdef HAVE_VOP_CACHEDLOOKUP - {&vop_cachedlookup_desc, (vop_t *) nnpfs_cachedlookup }, + .vop_lookup = (vop_t *)nnpfs_lookup, #endif #ifdef HAVE_VOP_OPEN - {&vop_open_desc, (vop_t *) nnpfs_open }, + .vop_open = (vop_t *)nnpfs_open, #endif #ifdef HAVE_VOP_FSYNC - {&vop_fsync_desc, (vop_t *) nnpfs_fsync }, + .vop_fsync = (vop_t *)nnpfs_fsync, #endif #ifdef HAVE_VOP_CLOSE - {&vop_close_desc, (vop_t *) nnpfs_close }, + .vop_close = (vop_t *)nnpfs_close, #endif #ifdef HAVE_VOP_READ - {&vop_read_desc, (vop_t *) nnpfs_read }, + .vop_read = (vop_t *)nnpfs_read, #endif #ifdef HAVE_VOP_WRITE - {&vop_write_desc, (vop_t *) nnpfs_write }, + .vop_write = (vop_t *)nnpfs_write, #endif #ifdef HAVE_VOP_MMAP - {&vop_mmap_desc, (vop_t *) nnpfs_mmap }, + .vop_bwrite = (vop_t *)nnpfs_bwrite, #endif #ifdef HAVE_VOP_BMAP - {&vop_bmap_desc, (vop_t *) nnpfs_bmap }, + .vop_bmap = (vop_t *)nnpfs_bmap, #endif #ifdef HAVE_VOP_IOCTL - {&vop_ioctl_desc, (vop_t *) nnpfs_ioctl }, + .vop_ioctl = (vop_t *)nnpfs_ioctl, #endif #ifdef HAVE_VOP_SELECT {&vop_select_desc, (vop_t *) nnpfs_select }, @@ -1437,61 +1429,61 @@ static struct vnodeopv_entry_desc nnpfs_vnodeop_entries[] = { {&vop_seek_desc, (vop_t *) nnpfs_seek }, #endif #ifdef HAVE_VOP_POLL - {&vop_poll_desc, (vop_t *) nnpfs_poll }, + .vop_poll = (vop_t *)nnpfs_poll, #endif #ifdef HAVE_VOP_GETATTR - {&vop_getattr_desc, (vop_t *) nnpfs_getattr }, + .vop_getattr = (vop_t *)nnpfs_getattr, #endif #ifdef HAVE_VOP_SETATTR - {&vop_setattr_desc, (vop_t *) nnpfs_setattr }, + .vop_setattr = (vop_t *)nnpfs_setattr, #endif #ifdef HAVE_VOP_ACCESS - {&vop_access_desc, (vop_t *) nnpfs_access }, + .vop_access = (vop_t *)nnpfs_access, #endif #ifdef HAVE_VOP_CREATE - {&vop_create_desc, (vop_t *) nnpfs_create }, + .vop_create = (vop_t *)nnpfs_create, #endif #ifdef HAVE_VOP_REMOVE - {&vop_remove_desc, (vop_t *) nnpfs_remove }, + .vop_remove = (vop_t *)nnpfs_remove, #endif #ifdef HAVE_VOP_LINK - {&vop_link_desc, (vop_t *) nnpfs_link }, + .vop_link = (vop_t *)nnpfs_link, #endif #ifdef HAVE_VOP_RENAME - {&vop_rename_desc, (vop_t *) nnpfs_rename }, + .vop_rename = (vop_t *)nnpfs_rename, #endif #ifdef HAVE_VOP_MKDIR - {&vop_mkdir_desc, (vop_t *) nnpfs_mkdir }, + .vop_mkdir = (vop_t *)nnpfs_mkdir, #endif #ifdef HAVE_VOP_RMDIR - {&vop_rmdir_desc, (vop_t *) nnpfs_rmdir }, + .vop_rmdir = (vop_t *)nnpfs_rmdir, #endif #ifdef HAVE_VOP_READDIR - {&vop_readdir_desc, (vop_t *) nnpfs_readdir }, + .vop_readdir = (vop_t *)nnpfs_readdir, #endif #ifdef HAVE_VOP_SYMLINK - {&vop_symlink_desc, (vop_t *) nnpfs_symlink }, + .vop_symlink = (vop_t *)nnpfs_symlink, #endif #ifdef HAVE_VOP_READLINK - {&vop_readlink_desc, (vop_t *) nnpfs_readlink }, + .vop_readlink = (vop_t *)nnpfs_readlink, #endif #ifdef HAVE_VOP_INACTIVE - {&vop_inactive_desc, (vop_t *) nnpfs_inactive }, + .vop_inactive = (vop_t *)nnpfs_inactive, #endif #ifdef HAVE_VOP_RECLAIM - {&vop_reclaim_desc, (vop_t *) nnpfs_reclaim }, + .vop_reclaim = (vop_t *)nnpfs_reclaim, #endif #ifdef HAVE_VOP_LOCK - {&vop_lock_desc, (vop_t *) nnpfs_lock }, + .vop_lock = (vop_t *)nnpfs_lock, #endif #ifdef HAVE_VOP_UNLOCK - {&vop_unlock_desc, (vop_t *) nnpfs_unlock }, + .vop_unlock = (vop_t *)nnpfs_unlock, #endif #ifdef HAVE_VOP_ISLOCKED - {&vop_islocked_desc, (vop_t *) nnpfs_islocked }, + .vop_islocked = (vop_t *)nnpfs_islocked, #endif #ifdef HAVE_VOP_ABORTOP - {&vop_abortop_desc, (vop_t *) nnpfs_abortop }, + .vop_abortop = (vop_t *)nnpfs_abortop, #endif #ifdef HAVE_VOP_GETPAGES {&vop_getpages_desc, (vop_t *) nnpfs_getpages }, @@ -1500,13 +1492,13 @@ static struct vnodeopv_entry_desc nnpfs_vnodeop_entries[] = { {&vop_putpages_desc, (vop_t *) nnpfs_putpages }, #endif #ifdef HAVE_VOP_REVOKE - {&vop_revoke_desc, (vop_t *) nnpfs_revoke }, + .vop_revoke = (vop_t *)nnpfs_revoke, #endif #ifdef HAVE_VOP_PRINT - {&vop_print_desc, (vop_t *) nnpfs_print}, + .vop_print = (vop_t *)nnpfs_print, #endif #ifdef HAVE_VOP_ADVLOCK - {&vop_advlock_desc, (vop_t *) nnpfs_advlock }, + .vop_advlock = (vop_t *)nnpfs_advlock, #endif #ifdef HAVE_VOP_PAGEIN {&vop_pagein_desc, (vop_t *) nnpfs_pagein }, @@ -1524,14 +1516,6 @@ static struct vnodeopv_entry_desc nnpfs_vnodeop_entries[] = { {&vop_getvobject_desc, (vop_t *) nnpfs_getvobject }, #endif #ifdef HAVE_VOP_PATHCONF - {&vop_pathconf_desc, (vop_t *) nnpfs_pathconf }, + .vop_pathconf = (vop_t *)nnpfs_pathconf, #endif - {(struct vnodeop_desc *) NULL, (int (*) (void *)) NULL} }; - -struct vnodeopv_desc nnpfs_vnodeop_opv_desc = -{&nnpfs_vnodeop_p, nnpfs_vnodeop_entries}; - -#ifdef VNODEOP_SET -VNODEOP_SET(nnpfs_vnodeop_opv_desc); -#endif diff --git a/sys/ntfs/ntfs.h b/sys/ntfs/ntfs.h index b84aea76517..8220e750d39 100644 --- a/sys/ntfs/ntfs.h +++ b/sys/ntfs/ntfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs.h,v 1.11 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ntfs.h,v 1.12 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: ntfs.h,v 1.5 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -282,8 +282,6 @@ struct ntfsmount { #define ntfs_btocnoff(off) (off_t)((off) % ((ntmp)->ntm_spc * (ntmp)->ntm_bps)) #define ntfs_bntob(bn) (int32_t)((bn) * (ntmp)->ntm_bps) -typedef int (vop_t)(void *); - #if defined(NTFS_DEBUG) extern int ntfs_debug; #define DPRINTF(X, Y) do { if(ntfs_debug >= (X)) printf Y; } while(0) @@ -295,4 +293,4 @@ extern int ntfs_debug; #define ddprintf(a) #endif -extern vop_t **ntfs_vnodeop_p; +extern struct vops ntfs_vops; diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c index e6fc2ebfdf9..dcb41b4d63b 100644 --- a/sys/ntfs/ntfs_vfsops.c +++ b/sys/ntfs/ntfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vfsops.c,v 1.23 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ntfs_vfsops.c,v 1.24 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: ntfs_vfsops.c,v 1.7 2003/04/24 07:50:19 christos Exp $ */ /*- @@ -831,7 +831,7 @@ ntfs_vgetex( } } - error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, ntfs_vnodeop_p, &vp); + error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, &ntfs_vops, &vp); if(error) { ntfs_frele(fp); ntfs_ntput(ip, p); @@ -869,13 +869,6 @@ ntfs_vget( LK_EXCLUSIVE | LK_RETRY, 0, curproc, vpp); /* XXX */ } -extern const struct vnodeopv_desc ntfs_vnodeop_opv_desc; - -const struct vnodeopv_desc * const ntfs_vnodeopv_descs[] = { - &ntfs_vnodeop_opv_desc, - NULL, -}; - const struct vfsops ntfs_vfsops = { ntfs_mount, ntfs_start, diff --git a/sys/ntfs/ntfs_vnops.c b/sys/ntfs/ntfs_vnops.c index fd719230bd3..94afc01488a 100644 --- a/sys/ntfs/ntfs_vnops.c +++ b/sys/ntfs/ntfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntfs_vnops.c,v 1.21 2010/11/18 21:18:07 miod Exp $ */ +/* $OpenBSD: ntfs_vnops.c,v 1.22 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: ntfs_vnops.c,v 1.6 2003/04/10 21:57:26 jdolecek Exp $ */ /* @@ -57,21 +57,20 @@ #include <sys/unistd.h> /* for pathconf(2) constants */ -static int ntfs_bypass(struct vop_generic_args *ap); -static int ntfs_read(struct vop_read_args *); -static int ntfs_write(struct vop_write_args *ap); -static int ntfs_getattr(struct vop_getattr_args *ap); -static int ntfs_inactive(struct vop_inactive_args *ap); -static int ntfs_print(struct vop_print_args *ap); -static int ntfs_reclaim(struct vop_reclaim_args *ap); -static int ntfs_strategy(struct vop_strategy_args *ap); -static int ntfs_access(struct vop_access_args *ap); -static int ntfs_open(struct vop_open_args *ap); -static int ntfs_close(struct vop_close_args *ap); -static int ntfs_readdir(struct vop_readdir_args *ap); -static int ntfs_lookup(struct vop_lookup_args *ap); -static int ntfs_bmap(struct vop_bmap_args *ap); -static int ntfs_fsync(struct vop_fsync_args *ap); +static int ntfs_read(void *); +static int ntfs_write(void *); +static int ntfs_getattr(void *); +static int ntfs_inactive(void *); +static int ntfs_print(void *); +static int ntfs_reclaim(void *); +static int ntfs_strategy(void *); +static int ntfs_access(void *); +static int ntfs_open(void *); +static int ntfs_close(void *); +static int ntfs_readdir(void *); +static int ntfs_lookup(void *); +static int ntfs_bmap(void *); +static int ntfs_fsync(void *); static int ntfs_pathconf(void *); int ntfs_prtactive = 1; /* 1 => print out reclaim of active vnodes */ @@ -80,9 +79,9 @@ int ntfs_prtactive = 1; /* 1 => print out reclaim of active vnodes */ * This is a noop, simply returning what one has been given. */ int -ntfs_bmap(ap) - struct vop_bmap_args *ap; +ntfs_bmap(void *v) { + struct vop_bmap_args *ap = v; dprintf(("ntfs_bmap: vn: %p, blk: %d\n", ap->a_vp,(u_int32_t)ap->a_bn)); if (ap->a_vpp != NULL) *ap->a_vpp = ap->a_vp; @@ -94,9 +93,9 @@ ntfs_bmap(ap) } static int -ntfs_read(ap) - struct vop_read_args *ap; +ntfs_read(void *v) { + struct vop_read_args *ap = v; struct vnode *vp = ap->a_vp; struct fnode *fp = VTOF(vp); struct ntnode *ip = FTONT(fp); @@ -131,19 +130,9 @@ ntfs_read(ap) } static int -ntfs_bypass(ap) - struct vop_generic_args *ap; -{ - int error = ENOTTY; - dprintf(("ntfs_bypass: %s\n", ap->a_desc->vdesc_name)); - return (error); -} - - -static int -ntfs_getattr(ap) - struct vop_getattr_args *ap; +ntfs_getattr(void *v) { + struct vop_getattr_args *ap = v; struct vnode *vp = ap->a_vp; struct fnode *fp = VTOF(vp); struct ntnode *ip = FTONT(fp); @@ -176,9 +165,9 @@ ntfs_getattr(ap) * Last reference to an ntnode. If necessary, write or delete it. */ int -ntfs_inactive(ap) - struct vop_inactive_args *ap; +ntfs_inactive(void *v) { + struct vop_inactive_args *ap = v; struct vnode *vp = ap->a_vp; struct proc *p = ap->a_p; #ifdef NTFS_DEBUG @@ -204,9 +193,9 @@ ntfs_inactive(ap) * Reclaim an fnode/ntnode so that it can be used for other purposes. */ int -ntfs_reclaim(ap) - struct vop_reclaim_args *ap; +ntfs_reclaim(void *v) { + struct vop_reclaim_args *ap = v; struct vnode *vp = ap->a_vp; struct fnode *fp = VTOF(vp); struct ntnode *ip = FTONT(fp); @@ -235,9 +224,9 @@ ntfs_reclaim(ap) } static int -ntfs_print(ap) - struct vop_print_args *ap; +ntfs_print(void *v) { + struct vop_print_args *ap = v; struct ntnode *ip = VTONT(ap->a_vp); printf("tag VT_NTFS, ino %u, flag %#x, usecount %d, nlink %ld\n", @@ -251,9 +240,9 @@ ntfs_print(ap) * then call the device strategy routine. */ int -ntfs_strategy(ap) - struct vop_strategy_args *ap; +ntfs_strategy(void *v) { + struct vop_strategy_args *ap = v; struct buf *bp = ap->a_bp; struct vnode *vp = bp->b_vp; struct fnode *fp = VTOF(vp); @@ -324,9 +313,9 @@ ntfs_strategy(ap) } static int -ntfs_write(ap) - struct vop_write_args *ap; +ntfs_write(void *v) { + struct vop_write_args *ap = v; struct vnode *vp = ap->a_vp; struct fnode *fp = VTOF(vp); struct ntnode *ip = FTONT(fp); @@ -359,9 +348,9 @@ ntfs_write(ap) } int -ntfs_access(ap) - struct vop_access_args *ap; +ntfs_access(void *v) { + struct vop_access_args *ap = v; struct vnode *vp = ap->a_vp; struct ntnode *ip = VTONT(vp); struct ucred *cred = ap->a_cred; @@ -433,10 +422,10 @@ ntfs_access(ap) */ /* ARGSUSED */ static int -ntfs_open(ap) - struct vop_open_args *ap; +ntfs_open(void *v) { #if NTFS_DEBUG + struct vop_open_args *ap = v; struct vnode *vp = ap->a_vp; struct ntnode *ip = VTONT(vp); @@ -457,10 +446,10 @@ ntfs_open(ap) */ /* ARGSUSED */ static int -ntfs_close(ap) - struct vop_close_args *ap; +ntfs_close(void *v) { #if NTFS_DEBUG + struct vop_close_args *ap = v; struct vnode *vp = ap->a_vp; struct ntnode *ip = VTONT(vp); @@ -471,9 +460,9 @@ ntfs_close(ap) } int -ntfs_readdir(ap) - struct vop_readdir_args *ap; +ntfs_readdir(void *v) { + struct vop_readdir_args *ap = v; struct vnode *vp = ap->a_vp; struct fnode *fp = VTOF(vp); struct ntnode *ip = FTONT(fp); @@ -607,9 +596,9 @@ ntfs_readdir(ap) } int -ntfs_lookup(ap) - struct vop_lookup_args *ap; +ntfs_lookup(void *v) { + struct vop_lookup_args *ap = v; struct vnode *dvp = ap->a_dvp; struct ntnode *dip = VTONT(dvp); struct ntfsmount *ntmp = dip->i_mp; @@ -713,8 +702,7 @@ ntfs_lookup(ap) * could just do a sync if they try an fsync on a directory file. */ static int -ntfs_fsync(ap) - struct vop_fsync_args *ap; +ntfs_fsync(void *v) { return (0); } @@ -723,8 +711,7 @@ ntfs_fsync(ap) * Return POSIX pathconf information applicable to NTFS filesystem */ static int -ntfs_pathconf(v) - void *v; +ntfs_pathconf(void *v) { struct vop_pathconf_args *ap = v; @@ -753,36 +740,25 @@ ntfs_pathconf(v) /* * Global vfs data structures */ -vop_t **ntfs_vnodeop_p; -static -struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *)ntfs_bypass }, - - { &vop_getattr_desc, (vop_t *)ntfs_getattr }, - { &vop_inactive_desc, (vop_t *)ntfs_inactive }, - { &vop_reclaim_desc, (vop_t *)ntfs_reclaim }, - { &vop_print_desc, (vop_t *)ntfs_print }, - { &vop_pathconf_desc, ntfs_pathconf }, - - { &vop_islocked_desc, (vop_t *)vop_generic_islocked }, - { &vop_unlock_desc, (vop_t *)vop_generic_unlock }, - { &vop_lock_desc, (vop_t *)vop_generic_lock }, - { &vop_lookup_desc, (vop_t *)ntfs_lookup }, - - { &vop_access_desc, (vop_t *)ntfs_access }, - { &vop_close_desc, (vop_t *)ntfs_close }, - { &vop_open_desc, (vop_t *)ntfs_open }, - { &vop_readdir_desc, (vop_t *)ntfs_readdir }, - { &vop_fsync_desc, (vop_t *)ntfs_fsync }, - - { &vop_bmap_desc, (vop_t *)ntfs_bmap }, - { &vop_strategy_desc, (vop_t *)ntfs_strategy }, - { &vop_bwrite_desc, (vop_t *)vop_generic_bwrite }, - { &vop_read_desc, (vop_t *)ntfs_read }, - { &vop_write_desc, (vop_t *)ntfs_write }, - - { NULL, NULL } +struct vops ntfs_vops = { + .vop_default = eopnotsupp, + .vop_getattr = ntfs_getattr, + .vop_inactive = ntfs_inactive, + .vop_reclaim = ntfs_reclaim, + .vop_print = ntfs_print, + .vop_pathconf = ntfs_pathconf, + .vop_islocked = vop_generic_islocked, + .vop_unlock = vop_generic_unlock, + .vop_lock = vop_generic_lock, + .vop_lookup = ntfs_lookup, + .vop_access = ntfs_access, + .vop_close = ntfs_close, + .vop_open = ntfs_open, + .vop_readdir = ntfs_readdir, + .vop_fsync = ntfs_fsync, + .vop_bmap = ntfs_bmap, + .vop_strategy = ntfs_strategy, + .vop_bwrite = vop_generic_bwrite, + .vop_read = ntfs_read, + .vop_write = ntfs_write, }; - -const struct vnodeopv_desc ntfs_vnodeop_opv_desc = - { &ntfs_vnodeop_p, ntfs_vnodeop_entries }; diff --git a/sys/sys/specdev.h b/sys/sys/specdev.h index daad3235132..66662c95919 100644 --- a/sys/sys/specdev.h +++ b/sys/sys/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.28 2010/09/10 16:34:08 thib Exp $ */ +/* $OpenBSD: specdev.h,v 1.29 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ /* @@ -82,7 +82,7 @@ extern struct vnode *speclisth[SPECHSZ]; /* * Prototypes for special file operations on vnodes. */ -extern int (**spec_vnodeop_p)(void *); +extern struct vops spec_vops; struct nameidata; struct componentname; struct ucred; @@ -108,8 +108,6 @@ int spec_print(void *); int spec_pathconf(void *); int spec_advlock(void *); -int spec_vnoperate(void *); - /* spec_subr.c */ int spec_open_clone(struct vop_open_args *); int spec_close_clone(struct vop_close_args *); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 6c8ef2c5b20..a1c50a28332 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.106 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: vnode.h,v 1.107 2010/12/21 20:14:43 thib Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -87,7 +87,7 @@ RB_HEAD(namecache_rb_cache, namecache); struct vnode { struct uvm_vnode v_uvm; /* uvm data */ - int (**v_op)(void *); /* vnode operations vector */ + struct vops *v_op; /* vnode operations vector */ enum vtype v_type; /* vnode type */ u_int v_flag; /* vnode flags (see below) */ u_int v_usecount; /* reference count of users */ @@ -258,90 +258,367 @@ extern void vhold(struct vnode *); extern void vdrop(struct vnode *); #endif /* _KERNEL */ -/* - * Mods for exensibility. - */ +/* vnode operations */ +struct vops { + int (*vop_default)(void *); + int (*vop_lock)(void *); + int (*vop_unlock)(void *); + int (*vop_islocked)(void *); + int (*vop_abortop)(void *); + int (*vop_access)(void *); + int (*vop_advlock)(void *); + int (*vop_bmap)(void *); + int (*vop_bwrite)(void *); + int (*vop_close)(void *); + int (*vop_create)(void *); + int (*vop_fsync)(void *); + int (*vop_getattr)(void *); + int (*vop_inactive)(void *); + int (*vop_ioctl)(void *); + int (*vop_link)(void *); + int (*vop_lookup)(void *); + int (*vop_mknod)(void *); + int (*vop_open)(void *); + int (*vop_pathconf)(void *); + int (*vop_poll)(void *); + int (*vop_print)(void *); + int (*vop_read)(void *); + int (*vop_readdir)(void *); + int (*vop_readlink)(void *); + int (*vop_reallocblks)(void *); + int (*vop_reclaim)(void *); + int (*vop_remove)(void *); + int (*vop_rename)(void *); + int (*vop_revoke)(void *); + int (*vop_mkdir)(void *); + int (*vop_rmdir)(void *); + int (*vop_setattr)(void *); + int (*vop_strategy)(void *); + int (*vop_symlink)(void *); + int (*vop_write)(void *); + int (*vop_kqfilter)(void *); +}; -/* - * Flags for vdesc_flags: - */ -#define VDESC_MAX_VPS 16 -/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */ -#define VDESC_VP0_WILLRELE 0x00000001 -#define VDESC_VP1_WILLRELE 0x00000002 -#define VDESC_VP2_WILLRELE 0x00000004 -#define VDESC_VP3_WILLRELE 0x00000008 -#define VDESC_VP0_WILLUNLOCK 0x00000100 -#define VDESC_VP1_WILLUNLOCK 0x00000200 -#define VDESC_VP2_WILLUNLOCK 0x00000400 -#define VDESC_VP3_WILLUNLOCK 0x00000800 -#define VDESC_VP0_WILLPUT 0x00000101 -#define VDESC_VP1_WILLPUT 0x00000202 -#define VDESC_VP2_WILLPUT 0x00000404 -#define VDESC_VP3_WILLPUT 0x00000808 -#define VDESC_NOMAP_VPP 0x00010000 -#define VDESC_VPP_WILLRELE 0x00020000 +#ifdef _KERNEL +extern struct vops dead_vops; +extern struct vops spec_vops; + +struct vop_generic_args { + void *a_garbage; + /* Other data probably follows; */ +}; -/* - * This structure describes the vnode operation taking place. - */ -struct vnodeop_desc { - int vdesc_offset; /* offset in vector--first for speed */ - char *vdesc_name; /* a readable name for debugging */ - int vdesc_flags; /* VDESC_* flags */ +struct vop_islocked_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; }; +int VOP_ISLOCKED(struct vnode *); -#ifdef _KERNEL -/* - * A list of all the operation descs. - */ -extern struct vnodeop_desc *vnodeop_descs[]; +struct vop_lookup_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; +}; +int VOP_LOOKUP(struct vnode *, struct vnode **, struct componentname *); +struct vop_create_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; +}; +int VOP_CREATE(struct vnode *, struct vnode **, struct componentname *, + struct vattr *); -/* - * This structure is used to configure the new vnodeops vector. - */ -struct vnodeopv_entry_desc { - struct vnodeop_desc *opve_op; /* which operation this is */ - int (*opve_impl)(void *); /* code implementing this operation */ +struct vop_mknod_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; }; -struct vnodeopv_desc { - /* ptr to the ptr to the vector where op should go */ - int (***opv_desc_vector_p)(void *); - struct vnodeopv_entry_desc *opv_desc_ops; /* null terminated list */ +int VOP_MKNOD(struct vnode *, struct vnode **, struct componentname *, + struct vattr *); + +struct vop_open_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_mode; + struct ucred *a_cred; + struct proc *a_p; }; +int VOP_OPEN(struct vnode *, int, struct ucred *, struct proc *); -/* - * A generic structure. - * This can be used by bypass routines to identify generic arguments. - */ -struct vop_generic_args { +struct vop_close_args { struct vnodeop_desc *a_desc; - /* other random data follows, presumably */ + struct vnode *a_vp; + int a_fflag; + struct ucred *a_cred; + struct proc *a_p; }; +int VOP_CLOSE(struct vnode *, int, struct ucred *, struct proc *); -/* - * VOCALL calls an op given an ops vector. We break it out because BSD's - * vclean changes the ops vector and then wants to call ops with the old - * vector. - */ -#define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP)) +struct vop_access_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_mode; + struct ucred *a_cred; + struct proc *a_p; +}; +int VOP_ACCESS(struct vnode *, int, struct ucred *, struct proc *); -/* - * This call works for vnodes in the kernel. - */ -#define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP)) -#define VDESC(OP) (& __CONCAT(OP,_desc)) -#define VOFFSET(OP) (VDESC(OP)->vdesc_offset) +struct vop_getattr_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; +}; +int VOP_GETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *); -/* - * Finally, include the default set of vnode operations. - */ -#include <sys/vnode_if.h> +struct vop_setattr_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct vattr *a_vap; + struct ucred *a_cred; + struct proc *a_p; +}; +int VOP_SETATTR(struct vnode *, struct vattr *, struct ucred *, struct proc *); -/* - * Public vnode manipulation functions. - */ +struct vop_read_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; +}; +int VOP_READ(struct vnode *, struct uio *, int, struct ucred *); + +struct vop_write_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; +}; +int VOP_WRITE(struct vnode *, struct uio *, int, struct ucred *); + +struct vop_ioctl_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + u_long a_command; + void *a_data; + int a_fflag; + struct ucred *a_cred; + struct proc *a_p; +}; +int VOP_IOCTL(struct vnode *, u_long, void *, int, struct ucred *, + struct proc *); + +struct vop_poll_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_events; + struct proc *a_p; +}; +int VOP_POLL(struct vnode *, int, struct proc *); + +struct vop_kqfilter_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct knote *a_kn; +}; +int VOP_KQFILTER(struct vnode *, struct knote *); + +struct vop_revoke_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_flags; +}; +int VOP_REVOKE(struct vnode *, int); + +struct vop_fsync_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct ucred *a_cred; + int a_waitfor; + struct proc *a_p; +}; +int VOP_FSYNC(struct vnode *, struct ucred *, int, struct proc *); + +struct vop_remove_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode *a_vp; + struct componentname *a_cnp; +}; +int VOP_REMOVE(struct vnode *, struct vnode *, struct componentname *); + +struct vop_link_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode *a_vp; + struct componentname *a_cnp; +}; +int VOP_LINK(struct vnode *, struct vnode *, struct componentname *); + +struct vop_rename_args { + struct vnodeop_desc *a_desc; + struct vnode *a_fdvp; + struct vnode *a_fvp; + struct componentname *a_fcnp; + struct vnode *a_tdvp; + struct vnode *a_tvp; + struct componentname *a_tcnp; +}; +int VOP_RENAME(struct vnode *, struct vnode *, struct componentname *, + struct vnode *, struct vnode *, struct componentname *); + +struct vop_mkdir_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; +}; +int VOP_MKDIR(struct vnode *, struct vnode **, struct componentname *, + struct vattr *); + +struct vop_rmdir_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode *a_vp; + struct componentname *a_cnp; +}; +int VOP_RMDIR(struct vnode *, struct vnode *, struct componentname *); + +struct vop_symlink_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; + char *a_target; +}; +int VOP_SYMLINK(struct vnode *, struct vnode **, struct componentname *, + struct vattr *, char *); + +struct vop_readdir_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct uio *a_uio; + struct ucred *a_cred; + int *a_eofflag; + int *a_ncookies; + u_long **a_cookies; +}; +int VOP_READDIR(struct vnode *, struct uio *, struct ucred *, int *, int *, + u_long **); + +struct vop_readlink_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct uio *a_uio; + struct ucred *a_cred; +}; +int VOP_READLINK(struct vnode *, struct uio *, struct ucred *); + +struct vop_abortop_args { + struct vnodeop_desc *a_desc; + struct vnode *a_dvp; + struct componentname *a_cnp; +}; +int VOP_ABORTOP(struct vnode *, struct componentname *); + +struct vop_inactive_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct proc *a_p; +}; +int VOP_INACTIVE(struct vnode *, struct proc *); + +struct vop_reclaim_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct proc *a_p; +}; +int VOP_RECLAIM(struct vnode *, struct proc *); + +struct vop_lock_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_flags; + struct proc *a_p; +}; +int VOP_LOCK(struct vnode *, int, struct proc *); + +struct vop_unlock_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_flags; + struct proc *a_p; +}; +int VOP_UNLOCK(struct vnode *, int, struct proc *); + +struct vop_bmap_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + daddr64_t a_bn; + struct vnode **a_vpp; + daddr64_t *a_bnp; + int *a_runp; +}; +int VOP_BMAP(struct vnode *, daddr64_t, struct vnode **, daddr64_t *, int *); + +struct vop_print_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; +}; +int VOP_PRINT(struct vnode *); + +struct vop_pathconf_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + int a_name; + register_t *a_retval; +}; +int VOP_PATHCONF(struct vnode *, int, register_t *); + +struct vop_advlock_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + void *a_id; + int a_op; + struct flock *a_fl; + int a_flags; +}; +int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int); + +struct vop_reallocblks_args { + struct vnodeop_desc *a_desc; + struct vnode *a_vp; + struct cluster_save *a_buflist; +}; +int VOP_REALLOCBLKS(struct vnode *, struct cluster_save *); + +/* Special cases: */ +struct vop_strategy_args { + struct vnodeop_desc *a_desc; + struct buf *a_bp; +}; +int VOP_STRATEGY(struct buf *); + +struct vop_bwrite_args { + struct vnodeop_desc *a_desc; + struct buf *a_bp; +}; +int VOP_BWRITE(struct buf *); +/* End of special cases. */ + + +/* Public vnode manipulation functions. */ struct file; struct filedesc; struct mount; @@ -358,7 +635,7 @@ struct vnode; int bdevvp(dev_t, struct vnode **); int cdevvp(dev_t, struct vnode **); struct vnode *checkalias(struct vnode *, dev_t, struct mount *); -int getnewvnode(enum vtagtype, struct mount *, int (**vops)(void *), +int getnewvnode(enum vtagtype, struct mount *, struct vops *, struct vnode **); int vaccess(enum vtype, mode_t, uid_t, gid_t, mode_t, struct ucred *); void vattr_null(struct vattr *); diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 0a7cedfd75a..8edd0c47eeb 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_extern.h,v 1.28 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ext2fs_extern.h,v 1.29 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */ /*- @@ -97,7 +97,7 @@ int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *); /* ext2fs_subr.c */ int ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **); -int ext2fs_vinit(struct mount *, int (**)(void *), int (**)(void *), +int ext2fs_vinit(struct mount *, struct vops *, struct vops *, struct vnode **); void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int); #ifdef DIAGNOSTIC @@ -151,11 +151,11 @@ __END_DECLS #define IS_EXT2_VNODE(vp) (vp->v_tag == VT_EXT2FS) -extern int (**ext2fs_vnodeop_p)(void *); -extern int (**ext2fs_specop_p)(void *); +extern struct vops ext2fs_vops; +extern struct vops ext2fs_specvops; #ifdef FIFO -extern int (**ext2fs_fifoop_p)(void *); -#define EXT2FS_FIFOOPS ext2fs_fifoop_p +extern struct vops ext2fs_fifovops; +#define EXT2FS_FIFOOPS &ext2fs_fifovops #else #define EXT2FS_FIFOOPS NULL #endif diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c index 73ee5f8d6ff..a25a6d9a73e 100644 --- a/sys/ufs/ext2fs/ext2fs_subr.c +++ b/sys/ufs/ext2fs/ext2fs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_subr.c,v 1.22 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ext2fs_subr.c,v 1.23 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_subr.c,v 1.1 1997/06/11 09:34:03 bouyer Exp $ */ /* @@ -136,8 +136,8 @@ ext2fs_checkoverlap(struct buf *bp, struct inode *ip) * Initialize the vnode associated with a new inode, handle aliased vnodes. */ int -ext2fs_vinit(struct mount *mp, int (**specops)(void *), - int (**fifoops)(void *), struct vnode **vpp) +ext2fs_vinit(struct mount *mp, struct vops *specops, + struct vops *fifoops, struct vnode **vpp) { struct inode *ip; struct vnode *vp, *nvp; @@ -161,7 +161,7 @@ ext2fs_vinit(struct mount *mp, int (**specops)(void *), */ nvp->v_data = vp->v_data; vp->v_data = NULL; - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; #ifdef VFSDEBUG vp->v_flag &= ~VLOCKSWORK; #endif diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 3cbdf8b8a98..5452bf05998 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.58 2010/09/23 18:40:00 oga Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.59 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -70,21 +70,6 @@ extern struct lock ufs_hashlock; int ext2fs_sbupdate(struct ufsmount *, int); static int ext2fs_checksb(struct ext2fs *, int); -extern struct vnodeopv_desc ext2fs_vnodeop_opv_desc; -extern struct vnodeopv_desc ext2fs_specop_opv_desc; -#ifdef FIFO -extern struct vnodeopv_desc ext2fs_fifoop_opv_desc; -#endif - -struct vnodeopv_desc *ext2fs_vnodeopv_descs[] = { - &ext2fs_vnodeop_opv_desc, - &ext2fs_specop_opv_desc, -#ifdef FIFO - &ext2fs_fifoop_opv_desc, -#endif - NULL, -}; - const struct vfsops ext2fs_vfsops = { ext2fs_mount, ufs_start, @@ -824,7 +809,7 @@ ext2fs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) return (0); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode(VT_EXT2FS, mp, ext2fs_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode(VT_EXT2FS, mp, &ext2fs_vops, &vp)) != 0) { *vpp = NULL; return (error); } @@ -903,7 +888,7 @@ ext2fs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - error = ext2fs_vinit(mp, ext2fs_specop_p, EXT2FS_FIFOOPS, &vp); + error = ext2fs_vinit(mp, &ext2fs_specvops, EXT2FS_FIFOOPS, &vp); if (error) { vput(vp); *vpp = NULL; diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index cc029be03dd..1d3d8806013 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vnops.c,v 1.57 2010/09/23 18:49:39 oga Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.58 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* @@ -1254,91 +1254,126 @@ ext2fs_reclaim(void *v) } /* Global vfs data structures for ext2fs. */ -int (**ext2fs_vnodeop_p)(void *); -struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, ext2fs_lookup }, - { &vop_create_desc, ext2fs_create }, - { &vop_mknod_desc, ext2fs_mknod }, - { &vop_open_desc, ext2fs_open }, - { &vop_close_desc, ufs_close }, - { &vop_access_desc, ext2fs_access }, - { &vop_getattr_desc, ext2fs_getattr }, - { &vop_setattr_desc, ext2fs_setattr }, - { &vop_read_desc, ext2fs_read }, - { &vop_write_desc, ext2fs_write }, - { &vop_ioctl_desc, ufs_ioctl }, - { &vop_poll_desc, ufs_poll }, - { &vop_kqfilter_desc, vop_generic_kqfilter }, - { &vop_fsync_desc, ext2fs_fsync }, - { &vop_remove_desc, ext2fs_remove }, - { &vop_link_desc, ext2fs_link }, - { &vop_rename_desc, ext2fs_rename }, - { &vop_mkdir_desc, ext2fs_mkdir }, - { &vop_rmdir_desc, ext2fs_rmdir }, - { &vop_symlink_desc, ext2fs_symlink }, - { &vop_readdir_desc, ext2fs_readdir }, - { &vop_readlink_desc, ext2fs_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, ext2fs_inactive }, - { &vop_reclaim_desc, ext2fs_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_bmap_desc, ext2fs_bmap }, - { &vop_strategy_desc, ufs_strategy }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { &vop_pathconf_desc, ufs_pathconf }, - { &vop_advlock_desc, ext2fs_advlock }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops ext2fs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = ext2fs_lookup, + .vop_create = ext2fs_create, + .vop_mknod = ext2fs_mknod, + .vop_open = ext2fs_open, + .vop_close = ufs_close, + .vop_access = ext2fs_access, + .vop_getattr = ext2fs_getattr, + .vop_setattr = ext2fs_setattr, + .vop_read = ext2fs_read, + .vop_write = ext2fs_write, + .vop_ioctl = ufs_ioctl, + .vop_poll = ufs_poll, + .vop_kqfilter = vop_generic_kqfilter, + .vop_fsync = ext2fs_fsync, + .vop_remove = ext2fs_remove, + .vop_link = ext2fs_link, + .vop_rename = ext2fs_rename, + .vop_mkdir = ext2fs_mkdir, + .vop_rmdir = ext2fs_rmdir, + .vop_symlink = ext2fs_symlink, + .vop_readdir = ext2fs_readdir, + .vop_readlink = ext2fs_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = ext2fs_inactive, + .vop_reclaim = ext2fs_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_bmap = ext2fs_bmap, + .vop_strategy = ufs_strategy, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + .vop_pathconf = ufs_pathconf, + .vop_advlock = ext2fs_advlock, + .vop_bwrite = vop_generic_bwrite }; -struct vnodeopv_desc ext2fs_vnodeop_opv_desc = - { &ext2fs_vnodeop_p, ext2fs_vnodeop_entries }; - -int (**ext2fs_specop_p)(void *); -struct vnodeopv_entry_desc ext2fs_specop_entries[] = { - { &vop_default_desc, spec_vnoperate }, - { &vop_close_desc, ufsspec_close }, - { &vop_access_desc, ext2fs_access }, - { &vop_getattr_desc, ext2fs_getattr }, - { &vop_setattr_desc, ext2fs_setattr }, - { &vop_read_desc, ufsspec_read }, - { &vop_write_desc, ufsspec_write }, - { &vop_fsync_desc, ext2fs_fsync }, - { &vop_inactive_desc, ext2fs_inactive }, - { &vop_reclaim_desc, ext2fs_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { NULL, NULL } + +struct vops ext2fs_specvops = { + .vop_default = eopnotsupp, + .vop_close = ufsspec_close, + .vop_access = ext2fs_access, + .vop_getattr = ext2fs_getattr, + .vop_setattr = ext2fs_setattr, + .vop_read = ufsspec_read, + .vop_write = ufsspec_write, + .vop_fsync = ext2fs_fsync, + .vop_inactive = ext2fs_inactive, + .vop_reclaim = ext2fs_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + + /* XXX: Keep in sync with spec_vops. */ + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc ext2fs_specop_opv_desc = - { &ext2fs_specop_p, ext2fs_specop_entries }; #ifdef FIFO -int (**ext2fs_fifoop_p)(void *); -struct vnodeopv_entry_desc ext2fs_fifoop_entries[] = { - { &vop_default_desc, fifo_vnoperate }, - { &vop_close_desc, ufsfifo_close }, - { &vop_access_desc, ext2fs_access }, - { &vop_getattr_desc, ext2fs_getattr }, - { &vop_setattr_desc, ext2fs_setattr }, - { &vop_read_desc, ufsfifo_read }, - { &vop_write_desc, ufsfifo_write }, - { &vop_fsync_desc, ext2fs_fsync }, - { &vop_inactive_desc, ext2fs_inactive }, - { &vop_reclaim_desc, ext2fsfifo_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops ext2fs_fifovops = { + .vop_default = eopnotsupp, + .vop_close = ufsfifo_close, + .vop_access = ufsfifo_close, + .vop_getattr = ext2fs_getattr, + .vop_setattr = ext2fs_setattr, + .vop_read = ufsfifo_read, + .vop_write = ufsfifo_write, + .vop_fsync = ext2fs_fsync, + .vop_inactive = ext2fs_inactive, + .vop_reclaim = ext2fsfifo_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + .vop_bwrite = vop_generic_bwrite, + + /* XXX: Keep in sync with fifo_vops */ + .vop_lookup = vop_generic_lookup, + .vop_create = fifo_badop, + .vop_mknod = fifo_badop, + .vop_open = fifo_open, + .vop_ioctl = fifo_ioctl, + .vop_poll = fifo_poll, + .vop_kqfilter = fifo_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = fifo_badop, + .vop_link = fifo_badop, + .vop_rename = fifo_badop, + .vop_mkdir = fifo_badop, + .vop_rmdir = fifo_badop, + .vop_symlink = fifo_badop, + .vop_readdir = fifo_badop, + .vop_readlink = fifo_badop, + .vop_abortop = fifo_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = fifo_badop, + .vop_pathconf = fifo_pathconf, + .vop_advlock = fifo_advlock, }; -struct vnodeopv_desc ext2fs_fifoop_opv_desc = - { &ext2fs_fifoop_p, ext2fs_fifoop_entries }; int ext2fsfifo_reclaim(void *v) diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index ea4adf55f0e..ea96622c4fc 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_extern.h,v 1.36 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ffs_extern.h,v 1.37 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */ /* @@ -94,7 +94,9 @@ struct mbuf; struct cg; struct vop_vfree_args; -__BEGIN_DECLS +extern struct vops ffs_vops; +extern struct vops ffs_specvops; +extern struct vops ffs_fifovops; /* ffs_alloc.c */ int ffs_alloc(struct inode *, daddr64_t, daddr64_t , int, struct ucred *, @@ -186,13 +188,9 @@ void softdep_setup_allocindir_page(struct inode *, daddr64_t, void softdep_fsync_mountdev(struct vnode *, int); int softdep_sync_metadata(struct vop_fsync_args *); int softdep_fsync(struct vnode *); -__END_DECLS -extern int (**ffs_vnodeop_p)(void *); -extern int (**ffs_specop_p)(void *); #ifdef FIFO -extern int (**ffs_fifoop_p)(void *); -#define FFS_FIFOOPS ffs_fifoop_p +#define FFS_FIFOOPS &ffs_fifovops #else #define FFS_FIFOOPS NULL #endif diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index e7102f11860..b0cd1556cee 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.127 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.128 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -1259,7 +1259,7 @@ retry: return (0); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode(VT_UFS, mp, &ffs_vops, &vp)) != 0) { *vpp = NULL; return (error); } @@ -1339,7 +1339,7 @@ retry: * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - error = ufs_vinit(mp, ffs_specop_p, FFS_FIFOOPS, &vp); + error = ufs_vinit(mp, &ffs_specvops, FFS_FIFOOPS, &vp); if (error) { vput(vp); *vpp = NULL; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index bcb56067e09..fa5bb6ca808 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.58 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.59 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -62,97 +62,130 @@ #include <ufs/ffs/fs.h> #include <ufs/ffs/ffs_extern.h> -/* Global vfs data structures for ufs. */ -int (**ffs_vnodeop_p)(void *); -struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, ufs_lookup }, - { &vop_create_desc, ufs_create }, - { &vop_mknod_desc, ufs_mknod }, - { &vop_open_desc, ufs_open }, - { &vop_close_desc, ufs_close }, - { &vop_access_desc, ufs_access }, - { &vop_getattr_desc, ufs_getattr }, - { &vop_setattr_desc, ufs_setattr }, - { &vop_read_desc, ffs_read }, - { &vop_write_desc, ffs_write }, - { &vop_ioctl_desc, ufs_ioctl }, - { &vop_poll_desc, ufs_poll }, - { &vop_kqfilter_desc, ufs_kqfilter }, - { &vop_revoke_desc, ufs_revoke }, - { &vop_fsync_desc, ffs_fsync }, - { &vop_remove_desc, ufs_remove }, - { &vop_link_desc, ufs_link }, - { &vop_rename_desc, ufs_rename }, - { &vop_mkdir_desc, ufs_mkdir }, - { &vop_rmdir_desc, ufs_rmdir }, - { &vop_symlink_desc, ufs_symlink }, - { &vop_readdir_desc, ufs_readdir }, - { &vop_readlink_desc, ufs_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, ufs_inactive }, - { &vop_reclaim_desc, ffs_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_bmap_desc, ufs_bmap }, - { &vop_strategy_desc, ufs_strategy }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { &vop_pathconf_desc, ufs_pathconf }, - { &vop_advlock_desc, ufs_advlock }, - { &vop_reallocblks_desc, ffs_reallocblks }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops ffs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = ufs_lookup, + .vop_create = ufs_create, + .vop_mknod = ufs_mknod, + .vop_open = ufs_open, + .vop_close = ufs_close, + .vop_access = ufs_access, + .vop_getattr = ufs_getattr, + .vop_setattr = ufs_setattr, + .vop_read = ffs_read, + .vop_write = ffs_write, + .vop_ioctl = ufs_ioctl, + .vop_poll = ufs_poll, + .vop_kqfilter = ufs_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_fsync = ffs_fsync, + .vop_remove = ufs_remove, + .vop_link = ufs_link, + .vop_rename = ufs_rename, + .vop_mkdir = ufs_mkdir, + .vop_rmdir = ufs_rmdir, + .vop_symlink = ufs_symlink, + .vop_readdir = ufs_readdir, + .vop_readlink = ufs_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = ufs_inactive, + .vop_reclaim = ffs_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_bmap = ufs_bmap, + .vop_strategy = ufs_strategy, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + .vop_pathconf = ufs_pathconf, + .vop_advlock = ufs_advlock, + .vop_reallocblks = ffs_reallocblks, + .vop_bwrite = vop_generic_bwrite }; -struct vnodeopv_desc ffs_vnodeop_opv_desc = - { &ffs_vnodeop_p, ffs_vnodeop_entries }; - -int (**ffs_specop_p)(void *); -struct vnodeopv_entry_desc ffs_specop_entries[] = { - { &vop_default_desc, spec_vnoperate }, - { &vop_close_desc, ufsspec_close }, - { &vop_access_desc, ufs_access }, - { &vop_getattr_desc, ufs_getattr }, - { &vop_setattr_desc, ufs_setattr }, - { &vop_read_desc, ufsspec_read }, - { &vop_write_desc, ufsspec_write }, - { &vop_fsync_desc, ffs_fsync }, - { &vop_inactive_desc, ufs_inactive }, - { &vop_reclaim_desc, ffs_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { NULL, NULL } +/* OK. Matches. */ +struct vops ffs_specvops = { + .vop_default = eopnotsupp, + .vop_close = ufsspec_close, + .vop_access = ufs_access, + .vop_getattr = ufs_getattr, + .vop_setattr = ufs_setattr, + .vop_read = ufsspec_read, + .vop_write = ufsspec_write, + .vop_fsync = ffs_fsync, + .vop_inactive = ufs_inactive, + .vop_reclaim = ffs_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + + /* XXX: Keep in sync with spec_vops */ + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc ffs_specop_opv_desc = - { &ffs_specop_p, ffs_specop_entries }; - #ifdef FIFO -int (**ffs_fifoop_p)(void *); -struct vnodeopv_entry_desc ffs_fifoop_entries[] = { - { &vop_default_desc, fifo_vnoperate }, - { &vop_close_desc, ufsfifo_close }, - { &vop_access_desc, ufs_access }, - { &vop_getattr_desc, ufs_getattr }, - { &vop_setattr_desc, ufs_setattr }, - { &vop_read_desc, ufsfifo_read }, - { &vop_write_desc, ufsfifo_write }, - { &vop_fsync_desc, ffs_fsync }, - { &vop_inactive_desc, ufs_inactive }, - { &vop_reclaim_desc, ffsfifo_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +/* OK. Matches. */ +struct vops ffs_fifovops = { + .vop_default = eopnotsupp, + .vop_close = ufsfifo_close, + .vop_access = ufs_access, + .vop_getattr = ufs_getattr, + .vop_setattr = ufs_setattr, + .vop_read = ufsfifo_read, + .vop_write = ufsfifo_write, + .vop_fsync = ffs_fsync, + .vop_inactive = ufs_inactive, + .vop_reclaim = ffsfifo_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + .vop_bwrite = vop_generic_bwrite, + + /* XXX: Keep in sync with fifo_vops */ + .vop_lookup = vop_generic_lookup, + .vop_create = fifo_badop, + .vop_mknod = fifo_badop, + .vop_open = fifo_open, + .vop_ioctl = fifo_ioctl, + .vop_poll = fifo_poll, + .vop_kqfilter = fifo_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = fifo_badop, + .vop_link = fifo_badop, + .vop_rename = fifo_badop, + .vop_mkdir = fifo_badop, + .vop_rmdir = fifo_badop, + .vop_symlink = fifo_badop, + .vop_readdir = fifo_badop, + .vop_readlink = fifo_badop, + .vop_abortop = fifo_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = fifo_badop, + .vop_pathconf = fifo_pathconf, + .vop_advlock = fifo_advlock }; - -struct vnodeopv_desc ffs_fifoop_opv_desc = - { &ffs_fifoop_p, ffs_fifoop_entries }; #endif /* FIFO */ /* diff --git a/sys/ufs/mfs/mfs_extern.h b/sys/ufs/mfs/mfs_extern.h index 2f6d498ce39..5af62fa15ee 100644 --- a/sys/ufs/mfs/mfs_extern.h +++ b/sys/ufs/mfs/mfs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_extern.h,v 1.17 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: mfs_extern.h,v 1.18 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: mfs_extern.h,v 1.4 1996/02/09 22:31:27 christos Exp $ */ /*- @@ -43,7 +43,8 @@ struct vfsconf; struct mbuf; struct mfsnode; -__BEGIN_DECLS +extern struct vops mfs_vops; + /* mfs_vfsops.c */ int mfs_mount(struct mount *, const char *, void *, struct nameidata *, struct proc *); @@ -64,4 +65,3 @@ int mfs_print(void *); #define mfs_revoke vop_generic_revoke int mfs_badop(void *); -__END_DECLS diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 763bbef813f..ab362a02ef8 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vfsops.c,v 1.41 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.42 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */ /* @@ -57,8 +57,6 @@ static int mfs_minor; /* used for building internal dev_t */ -extern int (**mfs_vnodeop_p)(void *); - /* * mfs vfs operations. */ @@ -124,7 +122,7 @@ mfs_mount(struct mount *mp, const char *path, void *data, #endif return (0); } - error = getnewvnode(VT_MFS, (struct mount *)0, mfs_vnodeop_p, &devvp); + error = getnewvnode(VT_MFS, NULL, &mfs_vops, &devvp); if (error) return (error); devvp->v_type = VBLK; diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c index 246135e31e0..47bf2f3fa4b 100644 --- a/sys/ufs/mfs/mfs_vnops.c +++ b/sys/ufs/mfs/mfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vnops.c,v 1.39 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: mfs_vnops.c,v 1.40 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: mfs_vnops.c,v 1.8 1996/03/17 02:16:32 christos Exp $ */ /* @@ -48,50 +48,44 @@ #include <ufs/mfs/mfsnode.h> #include <ufs/mfs/mfs_extern.h> -/* - * mfs vnode operations. - */ -int (**mfs_vnodeop_p)(void *); -struct vnodeopv_entry_desc mfs_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, mfs_badop }, - { &vop_create_desc, mfs_badop }, - { &vop_mknod_desc, mfs_badop }, - { &vop_open_desc, mfs_open }, - { &vop_close_desc, mfs_close }, - { &vop_access_desc, mfs_badop }, - { &vop_getattr_desc, mfs_badop }, - { &vop_setattr_desc, mfs_badop }, - { &vop_read_desc, mfs_badop }, - { &vop_write_desc, mfs_badop }, - { &vop_ioctl_desc, mfs_ioctl }, - { &vop_poll_desc, mfs_badop }, - { &vop_revoke_desc, mfs_revoke }, - { &vop_fsync_desc, spec_fsync }, - { &vop_remove_desc, mfs_badop }, - { &vop_link_desc, mfs_badop }, - { &vop_rename_desc, mfs_badop }, - { &vop_mkdir_desc, mfs_badop }, - { &vop_rmdir_desc, mfs_badop }, - { &vop_symlink_desc, mfs_badop }, - { &vop_readdir_desc, mfs_badop }, - { &vop_readlink_desc, mfs_badop }, - { &vop_abortop_desc, mfs_badop }, - { &vop_inactive_desc, mfs_inactive }, - { &vop_reclaim_desc, mfs_reclaim }, - { &vop_lock_desc, vop_generic_lock }, - { &vop_unlock_desc, vop_generic_unlock }, - { &vop_bmap_desc, vop_generic_bmap }, - { &vop_strategy_desc, mfs_strategy }, - { &vop_print_desc, mfs_print }, - { &vop_islocked_desc, vop_generic_islocked }, - { &vop_pathconf_desc, mfs_badop }, - { &vop_advlock_desc, mfs_badop }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +/* mfs vnode operations. */ +struct vops mfs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = mfs_badop, + .vop_create = mfs_badop, + .vop_mknod = mfs_badop, + .vop_open = mfs_open, + .vop_close = mfs_close, + .vop_access = mfs_badop, + .vop_getattr = mfs_badop, + .vop_setattr = mfs_badop, + .vop_read = mfs_badop, + .vop_write = mfs_badop, + .vop_ioctl = mfs_ioctl, + .vop_poll = mfs_badop, + .vop_revoke = mfs_revoke, + .vop_fsync = spec_fsync, + .vop_remove = mfs_badop, + .vop_link = mfs_badop, + .vop_rename = mfs_badop, + .vop_mkdir = mfs_badop, + .vop_rmdir = mfs_badop, + .vop_symlink = mfs_badop, + .vop_readdir = mfs_badop, + .vop_readlink = mfs_badop, + .vop_abortop = mfs_badop, + .vop_inactive = mfs_inactive, + .vop_reclaim = mfs_reclaim, + .vop_lock = vop_generic_lock, + .vop_unlock = vop_generic_unlock, + .vop_bmap = vop_generic_bmap, + .vop_strategy = mfs_strategy, + .vop_print = mfs_print, + .vop_islocked = vop_generic_islocked, + .vop_pathconf = mfs_badop, + .vop_advlock = mfs_badop, + .vop_bwrite = vop_generic_bwrite }; -struct vnodeopv_desc mfs_vnodeop_opv_desc = - { &mfs_vnodeop_p, mfs_vnodeop_entries }; /* * Vnode Operations. diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index 73d4db9b21a..23da91929ec 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_extern.h,v 1.31 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ufs_extern.h,v 1.32 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */ /*- @@ -53,7 +53,6 @@ struct vattr; struct vfsconf; struct vnode; -__BEGIN_DECLS int ufs_access(void *); int ufs_advlock(void *); int ufs_bmap(void *); @@ -76,7 +75,6 @@ int ufs_readdir(void *); int ufs_readlink(void *); int ufs_remove(void *); int ufs_rename(void *); -#define ufs_revoke vop_generic_revoke int ufs_rmdir(void *); int ufs_poll(void *); int ufs_kqfilter(void *); @@ -132,8 +130,7 @@ int ufs_check_export(struct mount *, struct mbuf *, int *, struct ucred **); /* ufs_vnops.c */ -int ufs_vinit(struct mount *, int (**)(void *), - int (**)(void *), struct vnode **); +int ufs_vinit(struct mount *, struct vops *, struct vops *, struct vnode **); int ufs_makeinode(int, struct vnode *, struct vnode **, struct componentname *); @@ -151,5 +148,3 @@ void softdep_setup_directory_change(struct buf *, struct inode *, struct inode *, long, int); void softdep_change_linkcnt(struct inode *, int); int softdep_slowdown(struct vnode *); - -__END_DECLS diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 40f2afc8f93..48c540604e3 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vnops.c,v 1.96 2010/09/23 18:49:39 oga Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.97 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */ /* @@ -1570,7 +1570,7 @@ ufs_strategy(void *v) } vp = ip->i_devvp; bp->b_dev = vp->v_rdev; - VOCALL(vp->v_op, VOFFSET(vop_strategy), ap); + (vp->v_op->vop_strategy)(ap); return (0); } @@ -1617,7 +1617,7 @@ ufsspec_read(void *v) * Set access flag. */ VTOI(ap->a_vp)->i_flag |= IN_ACCESS; - return (VOCALL (spec_vnodeop_p, VOFFSET(vop_read), ap)); + return (spec_read(ap)); } /* @@ -1632,7 +1632,7 @@ ufsspec_write(void *v) * Set update and change flags. */ VTOI(ap->a_vp)->i_flag |= IN_CHANGE | IN_UPDATE; - return (VOCALL (spec_vnodeop_p, VOFFSET(vop_write), ap)); + return (spec_write(ap)); } /* @@ -1653,7 +1653,7 @@ ufsspec_close(void *v) getmicrotime(&tv); ITIMES(ip, &tv, &tv); } - return (VOCALL (spec_vnodeop_p, VOFFSET(vop_close), ap)); + return (spec_close(ap)); } #ifdef FIFO @@ -1664,13 +1664,12 @@ int ufsfifo_read(void *v) { struct vop_read_args *ap = v; - extern int (**fifo_vnodeop_p)(void *); /* * Set access flag. */ VTOI(ap->a_vp)->i_flag |= IN_ACCESS; - return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_read), ap)); + return (fifo_read(ap)); } /* @@ -1680,13 +1679,12 @@ int ufsfifo_write(void *v) { struct vop_write_args *ap = v; - extern int (**fifo_vnodeop_p)(void *); /* * Set update and change flags. */ VTOI(ap->a_vp)->i_flag |= IN_CHANGE | IN_UPDATE; - return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_write), ap)); + return (fifo_write(ap)); } /* @@ -1698,7 +1696,6 @@ int ufsfifo_close(void *v) { struct vop_close_args *ap = v; - extern int (**fifo_vnodeop_p)(void *); struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); @@ -1708,7 +1705,7 @@ ufsfifo_close(void *v) getmicrotime(&tv); ITIMES(ip, &tv, &tv); } - return (VOCALL (fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_close(ap)); } #endif /* FIFO */ @@ -1763,8 +1760,8 @@ ufs_advlock(void *v) * vnodes. */ int -ufs_vinit(struct mount *mntp, int (**specops)(void *), - int (**fifoops)(void *), struct vnode **vpp) +ufs_vinit(struct mount *mntp, struct vops *specops, struct vops *fifoops, + struct vnode **vpp) { struct inode *ip; struct vnode *vp, *nvp; @@ -1784,7 +1781,7 @@ ufs_vinit(struct mount *mntp, int (**specops)(void *), */ nvp->v_data = vp->v_data; vp->v_data = NULL; - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; #ifdef VFSDEBUG vp->v_flag &= ~VLOCKSWORK; #endif diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index 7a30c02d79a..3a93811ea88 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.c,v 1.99 2010/12/04 05:18:10 jsing Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.100 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */ /* @@ -898,7 +898,7 @@ swap_on(struct proc *p, struct swapdev *sdp) long addr; struct vattr va; #if defined(NFSCLIENT) - extern int (**nfsv2_vnodeop_p)(void *); + extern struct vops nfs_vops; #endif /* defined(NFSCLIENT) */ dev_t dev; UVMHIST_FUNC("swap_on"); UVMHIST_CALLED(pdhist); @@ -959,7 +959,7 @@ swap_on(struct proc *p, struct swapdev *sdp) * at any one time. take it easy on NFS servers. */ #if defined(NFSCLIENT) - if (vp->v_op == nfsv2_vnodeop_p) + if (vp->v_op == &nfs_vops) sdp->swd_maxactive = 2; /* XXX */ else #endif /* defined(NFSCLIENT) */ |