diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2010-09-06 23:44:12 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2010-09-06 23:44:12 +0000 |
commit | 87f3d58d3064a78c9b29faa668f1d98225f01e71 (patch) | |
tree | bbc6c4fb3c1748ac72b8b1b8bab76b4e91896fd0 /sys | |
parent | a41bd31e53cce764c5bc6861ce6be4074cc59551 (diff) |
End the VOP experiment. Instead of the ridicolusly complicated operation
vector setup that has questionable features (that have, as far as I can
tell never been used in practice, atleast not in OpenBSD), remove all
the gunk and favor a simple struct full of function pointers that get
set directly by each of the filesystems.
Removes gobs of ugly code and makes things simpler by a magnitude.
The only downside of this is that we loose the vnoperate feature so
the spec/fifo operations of the filesystems need to be kept in sync
with specfs and fifofs, this is no big deal as the API it self is pretty
static.
Many thanks to armani@ who pulled an earlier version of this diff to
current after c2k10 and Gabriel Kihlman on tech@ for testing.
Liked by many. "come on, find your balls" deraadt@.
Diffstat (limited to 'sys')
45 files changed, 1824 insertions, 1230 deletions
diff --git a/sys/conf/files b/sys/conf/files index 2a9f3db6141..07a1b47f752 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.499 2010/07/31 08:33:19 ratchov Exp $ +# $OpenBSD: files,v 1.500 2010/09/06 23:44:10 thib Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -766,9 +766,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 bc92a78c854..07456363118 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.8 2003/06/02 23:28:05 millert Exp $ */ +/* $OpenBSD: cd9660_extern.h,v 1.9 2010/09/06 23:44:10 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 30056271f4a..369799e3794 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.53 2009/12/19 00:27:17 krw Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.54 2010/09/06 23:44:10 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 f68450f0007..4deb7cc6074 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.49 2010/01/11 07:13:30 krw Exp $ */ +/* $OpenBSD: cd9660_vnops.c,v 1.50 2010/09/06 23:44:10 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 3eb12f828ed..e0b80bc2f27 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.8 2007/12/09 20:54:01 jmc Exp $ */ +/* $OpenBSD: udf_extern.h,v 1.9 2010/09/06 23:44:10 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 627c79be718..abebc4b79af 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.33 2010/06/29 04:09:32 tedu Exp $ */ +/* $OpenBSD: udf_vfsops.c,v 1.34 2010/09/06 23:44:10 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 be03375a6cd..0cdb2b5398c 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.39 2009/08/27 23:14:47 jolan Exp $ */ +/* $OpenBSD: udf_vnops.c,v 1.40 2010/09/06 23:44:10 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 5c22814b01f..c4e910b2918 100644 --- a/sys/kern/Makefile +++ b/sys/kern/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.24 2010/07/01 17:30:25 tedu Exp $ +# $OpenBSD: Makefile,v 1.25 2010/09/06 23:44:10 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 11fde4c819b..2b613924840 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.58 2010/07/26 01:56:27 guenther Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.59 2010/09/06 23:44:10 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 00b00c24939..793881754af 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_conf.c,v 1.37 2010/04/20 22:05:43 tedu Exp $ */ +/* $OpenBSD: vfs_conf.c,v 1.38 2010/09/06 23:44:10 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 523aa8d4a55..34680ef087a 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_init.c,v 1.25 2010/01/14 23:12:11 schwarze Exp $ */ +/* $OpenBSD: vfs_init.c,v 1.26 2010/09/06 23:44:10 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 9de92d955a1..f8b89c02730 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.189 2010/08/12 15:00:17 oga Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.190 2010/09/06 23:44:10 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 fe8b76f987e..180d6a22d42 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.46 2010/07/03 03:45:16 thib Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.47 2010/09/06 23:44:10 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/kern/vfs_vops.c b/sys/kern/vfs_vops.c new file mode 100644 index 00000000000..07b854b9ea0 --- /dev/null +++ b/sys/kern/vfs_vops.c @@ -0,0 +1,595 @@ +/* + * Copyright (c) 2010 Thordur I. Bjornsson <thib@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/mount.h> +#include <sys/vnode.h> + +#ifdef VFSDEBUG +#define ASSERT_VP_ISLOCKED(vp) do { \ + if (((vp)->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) \ + VOP_PRINT(vp); \ + panic("vp not locked"); \ +} while (0) +#else +#define ASSERT_VP_ISLOCKED(vp) /* nothing */ +#endif + +int +VOP_ISLOCKED(struct vnode *vp) +{ + struct vop_islocked_args a; + a.a_vp = vp; + + if (vp->v_op->vop_islocked == NULL) + return ((vp->v_op->vop_default)(&a)); + + return ((vp->v_op->vop_islocked)(&a)); +} + +int +VOP_LOOKUP(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp) +{ + struct vop_lookup_args a; + a.a_dvp = dvp; + a.a_vpp = vpp; + a.a_cnp = cnp; + + if (dvp->v_op->vop_lookup == NULL) + return ((dvp->v_op->vop_default)(&a)); + + return ((dvp->v_op->vop_lookup)(&a)); +} + +int +VOP_CREATE(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp, struct vattr *vap) +{ + struct vop_create_args a; + a.a_dvp = dvp; + a.a_vpp = vpp; + a.a_cnp = cnp; + a.a_vap = vap; + + ASSERT_VP_ISLOCKED(dvp); + + if (dvp->v_op->vop_create == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_create)(&a)); +} + +int +VOP_MKNOD(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp, struct vattr *vap) +{ + struct vop_mknod_args a; + a.a_dvp = dvp; + a.a_vpp = vpp; + a.a_cnp = cnp; + a.a_vap = vap; + + ASSERT_VP_ISLOCKED(dvp); + + if (dvp->v_op->vop_mknod == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_mknod)(&a)); +} + +int +VOP_OPEN(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) +{ + struct vop_open_args a; + a.a_vp = vp; + a.a_mode = mode; + a.a_cred = cred; + a.a_p = p; + + if (vp->v_op->vop_open == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_open)(&a)); +} + +int +VOP_CLOSE(struct vnode *vp, int fflag, struct ucred *cred, struct proc *p) +{ + struct vop_close_args a; + a.a_vp = vp; + a.a_fflag = fflag; + a.a_cred = cred; + a.a_p = p; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_close == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_close)(&a)); +} + +int +VOP_ACCESS(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) +{ + struct vop_access_args a; + a.a_vp = vp; + a.a_mode = mode; + a.a_cred = cred; + a.a_p = p; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_access == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_access)(&a)); +} + +int +VOP_GETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, + struct proc *p) +{ + struct vop_getattr_args a; + a.a_vp = vp; + a.a_vap = vap; + a.a_cred = cred; + a.a_p = p; + + if (vp->v_op->vop_getattr == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_getattr)(&a)); +} + +int +VOP_SETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, + struct proc *p) +{ + struct vop_setattr_args a; + a.a_vp = vp; + a.a_vap = vap; + a.a_cred = cred; + a.a_p = p; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_setattr == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_setattr)(&a)); +} + +int +VOP_READ(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) +{ + struct vop_read_args a; + a.a_vp = vp; + a.a_uio = uio; + a.a_ioflag = ioflag; + a.a_cred = cred; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_read == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_read)(&a)); +} + +int +VOP_WRITE(struct vnode *vp, struct uio *uio, int ioflag, + struct ucred *cred) +{ + struct vop_write_args a; + a.a_vp = vp; + a.a_uio = uio; + a.a_ioflag = ioflag; + a.a_cred = cred; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_write == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_write)(&a)); +} + +int +VOP_IOCTL(struct vnode *vp, u_long command, void *data, int fflag, + struct ucred *cred, struct proc *p) +{ + struct vop_ioctl_args a; + a.a_vp = vp; + a.a_command = command; + a.a_data = data; + a.a_fflag = fflag; + a.a_cred = cred; + a.a_p = p; + + if (vp->v_op->vop_ioctl == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_ioctl)(&a)); +} + +int +VOP_POLL(struct vnode *vp, int events, struct proc *p) +{ + struct vop_poll_args a; + a.a_vp = vp; + a.a_events = events; + a.a_p = p; + + if (vp->v_op->vop_poll == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_poll)(&a)); +} + +int +VOP_KQFILTER(struct vnode *vp, struct knote *kn) +{ + struct vop_kqfilter_args a; + a.a_vp = vp; + a.a_kn = kn; + + if (vp->v_op->vop_kqfilter == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_kqfilter)(&a)); +} + +int +VOP_REVOKE(struct vnode *vp, int flags) +{ + struct vop_revoke_args a; + a.a_vp = vp; + a.a_flags = flags; + + if (vp->v_op->vop_revoke == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_revoke)(&a)); +} + +int +VOP_FSYNC(struct vnode *vp, struct ucred *cred, int waitfor, + struct proc *p) +{ + struct vop_fsync_args a; + a.a_vp = vp; + a.a_cred = cred; + a.a_waitfor = waitfor; + a.a_p = p; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_fsync == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_fsync)(&a)); +} + +int +VOP_REMOVE(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + struct vop_remove_args a; + a.a_dvp = dvp; + a.a_vp = vp; + a.a_cnp = cnp; + + ASSERT_VP_ISLOCKED(dvp); + ASSERT_VP_ISLOCKED(vp); + + if (dvp->v_op->vop_remove == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_remove)(&a)); +} + +int +VOP_LINK(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + struct vop_link_args a; + a.a_dvp = dvp; + a.a_vp = vp; + a.a_cnp = cnp; + + ASSERT_VP_ISLOCKED(dvp); + + if (dvp->v_op->vop_link == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_link)(&a)); +} + +int +VOP_RENAME(struct vnode *fdvp, struct vnode *fvp, + struct componentname *fcnp, struct vnode *tdvp, struct vnode *tvp, + struct componentname *tcnp) +{ + struct vop_rename_args a; + a.a_fdvp = fdvp; + a.a_fvp = fvp; + a.a_fcnp = fcnp; + a.a_tdvp = tdvp; + a.a_tvp = tvp; + a.a_tcnp = tcnp; + + ASSERT_VP_ISLOCKED(tdvp); + + if (fdvp->v_op->vop_rename == NULL) + return ((fdvp->v_op->vop_default)(&a)); + return ((fdvp->v_op->vop_rename)(&a)); +} + +int +VOP_MKDIR(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp, struct vattr *vap) +{ + struct vop_mkdir_args a; + a.a_dvp = dvp; + a.a_vpp = vpp; + a.a_cnp = cnp; + a.a_vap = vap; + + ASSERT_VP_ISLOCKED(dvp); + + if (dvp->v_op->vop_mkdir == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_mkdir)(&a)); +} + +int +VOP_RMDIR(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + struct vop_rmdir_args a; + a.a_dvp = dvp; + a.a_vp = vp; + a.a_cnp = cnp; + + ASSERT_VP_ISLOCKED(dvp); + ASSERT_VP_ISLOCKED(vp); + + if (dvp->v_op->vop_rmdir == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_rmdir)(&a)); +} + +int +VOP_SYMLINK(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp, struct vattr *vap, char *target) +{ + struct vop_symlink_args a; + a.a_dvp = dvp; + a.a_vpp = vpp; + a.a_cnp = cnp; + a.a_vap = vap; + a.a_target = target; + + ASSERT_VP_ISLOCKED(dvp); + + if (dvp->v_op->vop_symlink == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_symlink)(&a)); +} + +int +VOP_READDIR(struct vnode *vp, struct uio *uio, struct ucred *cred, + int *eofflag, int *ncookies, u_long **cookies) +{ + struct vop_readdir_args a; + a.a_vp = vp; + a.a_uio = uio; + a.a_cred = cred; + a.a_eofflag = eofflag; + a.a_ncookies = ncookies; + a.a_cookies = cookies; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_readdir == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_readdir)(&a)); +} + +int +VOP_READLINK(struct vnode *vp, struct uio *uio, struct ucred *cred) +{ + struct vop_readlink_args a; + a.a_vp = vp; + a.a_uio = uio; + a.a_cred = cred; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_readlink == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_readlink)(&a)); +} + +int +VOP_ABORTOP(struct vnode *dvp, struct componentname *cnp) +{ + struct vop_abortop_args a; + a.a_dvp = dvp; + a.a_cnp = cnp; + + if (dvp->v_op->vop_abortop == NULL) + return ((dvp->v_op->vop_default)(&a)); + return ((dvp->v_op->vop_abortop)(&a)); +} + +int +VOP_INACTIVE(struct vnode *vp, struct proc *p) +{ + struct vop_inactive_args a; + a.a_vp = vp; + a.a_p = p; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_inactive == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_inactive)(&a)); +} + +int +VOP_RECLAIM(struct vnode *vp, struct proc *p) +{ + struct vop_reclaim_args a; + a.a_vp = vp; + a.a_p = p; + + if (vp->v_op->vop_reclaim == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_reclaim)(&a)); +} + +int +VOP_LOCK(struct vnode *vp, int flags, struct proc *p) +{ + struct vop_lock_args a; + a.a_vp = vp; + a.a_flags = flags; + a.a_p = p; + + if (vp->v_op->vop_lock == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_lock)(&a)); +} + +int +VOP_UNLOCK(struct vnode *vp, int flags, struct proc *p) +{ + struct vop_unlock_args a; + a.a_vp = vp; + a.a_flags = flags; + a.a_p = p; + + if (vp->v_op->vop_unlock == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_unlock)(&a)); +} + +int +VOP_BMAP(struct vnode *vp, daddr64_t bn, struct vnode **vpp, + daddr64_t *bnp, int *runp) +{ + struct vop_bmap_args a; + a.a_vp = vp; + a.a_bn = bn; + a.a_vpp = vpp; + a.a_bnp = bnp; + a.a_runp = runp; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_bmap == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_bmap)(&a)); +} + +int +VOP_PRINT(struct vnode *vp) +{ + struct vop_print_args a; + a.a_vp = vp; + + if (vp->v_op->vop_print == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_print)(&a)); +} + +int +VOP_PATHCONF(struct vnode *vp, int name, register_t *retval) +{ + struct vop_pathconf_args a; + a.a_vp = vp; + a.a_name = name; + a.a_retval = retval; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_pathconf == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_pathconf)(&a)); +} + +int +VOP_ADVLOCK(struct vnode *vp, void *id, int op, struct flock *fl, int flags) +{ + struct vop_advlock_args a; + a.a_vp = vp; + a.a_id = id; + a.a_op = op; + a.a_fl = fl; + a.a_flags = flags; + + if (vp->v_op->vop_advlock == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_advlock)(&a)); +} + +int +VOP_REALLOCBLKS(struct vnode *vp, struct cluster_save *buflist) +{ + struct vop_reallocblks_args a; + a.a_vp = vp; + a.a_buflist = buflist; + + ASSERT_VP_ISLOCKED(vp); + + if (vp->v_op->vop_reallocblks == NULL) + return ((vp->v_op->vop_default)(&a)); + return ((vp->v_op->vop_reallocblks)(&a)); +} + +int +VOP_STRATEGY(struct buf *bp) +{ + struct vop_strategy_args a; + a.a_bp = bp; + + if (bp->b_vp->v_op->vop_strategy == NULL) + return ((bp->b_vp->v_op->vop_default)(&a)); + return ((bp->b_vp->v_op->vop_strategy)(&a)); +} + +int +VOP_BWRITE(struct buf *bp) +{ + struct vop_bwrite_args a; + a.a_bp = bp; + + if (bp->b_vp->v_op->vop_bwrite == NULL) + return ((bp->b_vp->v_op->vop_default)(&a)); + return ((bp->b_vp->v_op->vop_bwrite)(&a)); +} +/* End of special cases. */ diff --git a/sys/miscfs/deadfs/dead_vnops.c b/sys/miscfs/deadfs/dead_vnops.c index 1bb277609cb..141f9385f51 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.22 2009/08/13 15:00:13 jasper Exp $ */ +/* $OpenBSD: dead_vnops.c,v 1.23 2010/09/06 23:44:10 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 77a8a4c52c9..e0172ce1dfe 100644 --- a/sys/miscfs/fifofs/fifo.h +++ b/sys/miscfs/fifofs/fifo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo.h,v 1.19 2008/05/03 14:41:29 thib Exp $ */ +/* $OpenBSD: fifo.h,v 1.20 2010/09/06 23:44:10 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 d5884f20bef..6a8c984fa8d 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.31 2009/08/13 15:00:14 jasper Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.32 2010/09/06 23:44:10 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 361fe46d574..cfb4a18ecc0 100644 --- a/sys/miscfs/procfs/procfs.h +++ b/sys/miscfs/procfs/procfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs.h,v 1.24 2007/06/22 09:38:53 jasper Exp $ */ +/* $OpenBSD: procfs.h,v 1.25 2010/09/06 23:44:10 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 9bbe103393b..e57ed21d404 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.31 2009/08/10 14:55:11 oga Exp $ */ +/* $OpenBSD: procfs_subr.c,v 1.32 2010/09/06 23:44:10 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 e9056953ec7..848f0e85214 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.47 2009/08/13 15:00:14 jasper Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.48 2010/09/06 23:44:10 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 11fde4c819b..2b613924840 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.58 2010/07/26 01:56:27 guenther Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.59 2010/09/06 23:44:10 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 7e1a83a7648..98f917b6a09 100644 --- a/sys/miscfs/specfs/specdev.h +++ b/sys/miscfs/specfs/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.26 2010/07/17 19:24:58 guenther Exp $ */ +/* $OpenBSD: specdev.h,v 1.27 2010/09/06 23:44:10 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 1166a2d9785..9f52bab9a84 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_denode.c,v 1.38 2010/03/29 23:33:39 krw Exp $ */ +/* $OpenBSD: msdosfs_denode.c,v 1.39 2010/09/06 23:44:10 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 998d946911d..571d8695bd1 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.72 2009/08/14 11:35:03 jasper Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.73 2010/09/06 23:44:10 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 fb6501c31a3..9845914f46d 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.52 2010/08/07 03:50:02 krw Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.53 2010/09/06 23:44:10 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 eea422228d7..b28f1caa2e1 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.108 2010/05/19 08:31:23 thib Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.109 2010/09/06 23:44:10 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 e2dde9025f0..68120717431 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.130 2010/05/19 08:31:23 thib Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.131 2010/09/06 23:44:10 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/sys/specdev.h b/sys/sys/specdev.h index 7e1a83a7648..98f917b6a09 100644 --- a/sys/sys/specdev.h +++ b/sys/sys/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.26 2010/07/17 19:24:58 guenther Exp $ */ +/* $OpenBSD: specdev.h,v 1.27 2010/09/06 23:44:10 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 76eea0e99d8..687fc0c1286 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.104 2009/12/17 16:30:45 beck Exp $ */ +/* $OpenBSD: vnode.h,v 1.105 2010/09/06 23:44:10 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,331 @@ 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 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 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 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 *); + +struct vop_mknod_args { + struct vnode *a_dvp; + struct vnode **a_vpp; + struct componentname *a_cnp; + struct vattr *a_vap; +}; +int VOP_MKNOD(struct vnode *, struct vnode **, struct componentname *, + struct vattr *); + +struct vop_open_args { + 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 *); -/* - * 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_close_args { + 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 *); + +struct vop_access_args { + struct vnode *a_vp; + int a_mode; + struct ucred *a_cred; + struct proc *a_p; }; -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_ACCESS(struct vnode *, int, struct ucred *, struct proc *); + +struct vop_getattr_args { + 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 *); -/* - * A generic structure. - * This can be used by bypass routines to identify generic arguments. - */ -struct vop_generic_args { - struct vnodeop_desc *a_desc; - /* other random data follows, presumably */ +struct vop_setattr_args { + 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 *); -/* - * 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_read_args { + 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 *); -/* - * 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_write_args { + 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 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 *); -/* - * Finally, include the default set of vnode operations. - */ -#include <sys/vnode_if.h> +struct vop_poll_args { + struct vnode *a_vp; + int a_events; + struct proc *a_p; +}; +int VOP_POLL(struct vnode *, int, struct proc *); -/* - * Public vnode manipulation functions. - */ +struct vop_kqfilter_args { + struct vnode *a_vp; + struct knote *a_kn; +}; +int VOP_KQFILTER(struct vnode *, struct knote *); + +struct vop_revoke_args { + struct vnode *a_vp; + int a_flags; +}; +int VOP_REVOKE(struct vnode *, int); + +struct vop_fsync_args { + 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 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 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 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 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 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 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 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 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 vnode *a_dvp; + struct componentname *a_cnp; +}; +int VOP_ABORTOP(struct vnode *, struct componentname *); + +struct vop_inactive_args { + struct vnode *a_vp; + struct proc *a_p; +}; +int VOP_INACTIVE(struct vnode *, struct proc *); + +struct vop_reclaim_args { + struct vnode *a_vp; + struct proc *a_p; +}; +int VOP_RECLAIM(struct vnode *, struct proc *); + +struct vop_lock_args { + struct vnode *a_vp; + int a_flags; + struct proc *a_p; +}; +int VOP_LOCK(struct vnode *, int, struct proc *); + +struct vop_unlock_args { + struct vnode *a_vp; + int a_flags; + struct proc *a_p; +}; +int VOP_UNLOCK(struct vnode *, int, struct proc *); + +struct vop_bmap_args { + 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 vnode *a_vp; +}; +int VOP_PRINT(struct vnode *); + +struct vop_pathconf_args { + struct vnode *a_vp; + int a_name; + register_t *a_retval; +}; +int VOP_PATHCONF(struct vnode *, int, register_t *); + +struct vop_advlock_args { + 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 vnode *a_vp; + struct cluster_save *a_buflist; +}; +int VOP_REALLOCBLKS(struct vnode *, struct cluster_save *); + +/* Special cases: */ +struct vop_strategy_args { + struct buf *a_bp; +}; +int VOP_STRATEGY(struct buf *); + +struct vop_bwrite_args { + 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 +599,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 abbb68ecc47..27c5db868a4 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.26 2008/01/05 19:49:26 otto Exp $ */ +/* $OpenBSD: ext2fs_extern.h,v 1.27 2010/09/06 23:44:10 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 4fc593f38bd..3508d7a6962 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.20 2009/08/21 11:38:18 jasper Exp $ */ +/* $OpenBSD: ext2fs_subr.c,v 1.21 2010/09/06 23:44:10 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 2babcfad0ac..939a03d81e2 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.55 2010/05/18 04:41:14 dlg Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.56 2010/09/06 23:44:10 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, @@ -826,7 +811,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); } @@ -905,7 +890,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 a6f71915d49..e3653f07e25 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.53 2010/08/02 02:03:22 matthew Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.54 2010/09/06 23:44:10 thib Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* @@ -1255,91 +1255,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 928f738985d..3b7595da171 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.34 2009/08/14 13:05:08 jasper Exp $ */ +/* $OpenBSD: ffs_extern.h,v 1.35 2010/09/06 23:44:10 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 90c5a56518e..d88fd275299 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.125 2010/07/23 17:31:54 ray Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.126 2010/09/06 23:44:10 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 c69f21448ae..cacb571e93f 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.56 2010/06/29 14:48:08 thib Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.57 2010/09/06 23:44:10 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 7065d8f93e1..7dbd68e9028 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.15 2008/05/03 14:41:29 thib Exp $ */ +/* $OpenBSD: mfs_extern.h,v 1.16 2010/09/06 23:44:10 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 bb1683e5f64..37b5dcdbdbc 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.39 2007/12/16 21:21:25 otto Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.40 2010/09/06 23:44:10 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 9052a41a80a..ad7e4d0df83 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.37 2009/08/13 15:00:14 jasper Exp $ */ +/* $OpenBSD: mfs_vnops.c,v 1.38 2010/09/06 23:44:10 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 d2fa799ed85..d7eab50a920 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.29 2008/01/05 19:49:26 otto Exp $ */ +/* $OpenBSD: ufs_extern.h,v 1.30 2010/09/06 23:44:10 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 5a98875f46c..db815995baa 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.92 2010/08/02 02:03:21 matthew Exp $ */ +/* $OpenBSD: ufs_vnops.c,v 1.93 2010/09/06 23:44:11 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 252e6ff2efc..289e27942d1 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.c,v 1.95 2010/09/06 16:33:41 thib Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.96 2010/09/06 23:44:11 thib Exp $ */ /* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */ /* @@ -904,7 +904,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); @@ -965,7 +965,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) */ |