From 533610cd3b12c41762f0fbaa058c868cc1458b45 Mon Sep 17 00:00:00 2001 From: "Thordur I. Bjornsson" Date: Tue, 21 Dec 2010 20:14:45 +0000 Subject: Bring back the "End the VOP experiment." diff, naddy's issues where unrelated, and his alpha is much happier now. OK deraadt@ --- sys/ufs/ext2fs/ext2fs_extern.h | 12 +-- sys/ufs/ext2fs/ext2fs_subr.c | 8 +- sys/ufs/ext2fs/ext2fs_vfsops.c | 21 +---- sys/ufs/ext2fs/ext2fs_vnops.c | 197 ++++++++++++++++++++++++----------------- 4 files changed, 129 insertions(+), 109 deletions(-) (limited to 'sys/ufs/ext2fs') diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 0a7cedfd75a..8edd0c47eeb 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_extern.h,v 1.28 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ext2fs_extern.h,v 1.29 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */ /*- @@ -97,7 +97,7 @@ int ext2fs_checkpath(struct inode *, struct inode *, struct ucred *); /* ext2fs_subr.c */ int ext2fs_bufatoff(struct inode *, off_t, char **, struct buf **); -int ext2fs_vinit(struct mount *, int (**)(void *), int (**)(void *), +int ext2fs_vinit(struct mount *, struct vops *, struct vops *, struct vnode **); void ext2fs_fragacct(struct m_ext2fs *, int, int32_t[], int); #ifdef DIAGNOSTIC @@ -151,11 +151,11 @@ __END_DECLS #define IS_EXT2_VNODE(vp) (vp->v_tag == VT_EXT2FS) -extern int (**ext2fs_vnodeop_p)(void *); -extern int (**ext2fs_specop_p)(void *); +extern struct vops ext2fs_vops; +extern struct vops ext2fs_specvops; #ifdef FIFO -extern int (**ext2fs_fifoop_p)(void *); -#define EXT2FS_FIFOOPS ext2fs_fifoop_p +extern struct vops ext2fs_fifovops; +#define EXT2FS_FIFOOPS &ext2fs_fifovops #else #define EXT2FS_FIFOOPS NULL #endif diff --git a/sys/ufs/ext2fs/ext2fs_subr.c b/sys/ufs/ext2fs/ext2fs_subr.c index 73ee5f8d6ff..a25a6d9a73e 100644 --- a/sys/ufs/ext2fs/ext2fs_subr.c +++ b/sys/ufs/ext2fs/ext2fs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_subr.c,v 1.22 2010/09/10 16:34:09 thib Exp $ */ +/* $OpenBSD: ext2fs_subr.c,v 1.23 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_subr.c,v 1.1 1997/06/11 09:34:03 bouyer Exp $ */ /* @@ -136,8 +136,8 @@ ext2fs_checkoverlap(struct buf *bp, struct inode *ip) * Initialize the vnode associated with a new inode, handle aliased vnodes. */ int -ext2fs_vinit(struct mount *mp, int (**specops)(void *), - int (**fifoops)(void *), struct vnode **vpp) +ext2fs_vinit(struct mount *mp, struct vops *specops, + struct vops *fifoops, struct vnode **vpp) { struct inode *ip; struct vnode *vp, *nvp; @@ -161,7 +161,7 @@ ext2fs_vinit(struct mount *mp, int (**specops)(void *), */ nvp->v_data = vp->v_data; vp->v_data = NULL; - vp->v_op = spec_vnodeop_p; + vp->v_op = &spec_vops; #ifdef VFSDEBUG vp->v_flag &= ~VLOCKSWORK; #endif diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 3cbdf8b8a98..5452bf05998 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.58 2010/09/23 18:40:00 oga Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.59 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -70,21 +70,6 @@ extern struct lock ufs_hashlock; int ext2fs_sbupdate(struct ufsmount *, int); static int ext2fs_checksb(struct ext2fs *, int); -extern struct vnodeopv_desc ext2fs_vnodeop_opv_desc; -extern struct vnodeopv_desc ext2fs_specop_opv_desc; -#ifdef FIFO -extern struct vnodeopv_desc ext2fs_fifoop_opv_desc; -#endif - -struct vnodeopv_desc *ext2fs_vnodeopv_descs[] = { - &ext2fs_vnodeop_opv_desc, - &ext2fs_specop_opv_desc, -#ifdef FIFO - &ext2fs_fifoop_opv_desc, -#endif - NULL, -}; - const struct vfsops ext2fs_vfsops = { ext2fs_mount, ufs_start, @@ -824,7 +809,7 @@ ext2fs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) return (0); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode(VT_EXT2FS, mp, ext2fs_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode(VT_EXT2FS, mp, &ext2fs_vops, &vp)) != 0) { *vpp = NULL; return (error); } @@ -903,7 +888,7 @@ ext2fs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - error = ext2fs_vinit(mp, ext2fs_specop_p, EXT2FS_FIFOOPS, &vp); + error = ext2fs_vinit(mp, &ext2fs_specvops, EXT2FS_FIFOOPS, &vp); if (error) { vput(vp); *vpp = NULL; diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index cc029be03dd..1d3d8806013 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vnops.c,v 1.57 2010/09/23 18:49:39 oga Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.58 2010/12/21 20:14:44 thib Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* @@ -1254,91 +1254,126 @@ ext2fs_reclaim(void *v) } /* Global vfs data structures for ext2fs. */ -int (**ext2fs_vnodeop_p)(void *); -struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = { - { &vop_default_desc, eopnotsupp }, - { &vop_lookup_desc, ext2fs_lookup }, - { &vop_create_desc, ext2fs_create }, - { &vop_mknod_desc, ext2fs_mknod }, - { &vop_open_desc, ext2fs_open }, - { &vop_close_desc, ufs_close }, - { &vop_access_desc, ext2fs_access }, - { &vop_getattr_desc, ext2fs_getattr }, - { &vop_setattr_desc, ext2fs_setattr }, - { &vop_read_desc, ext2fs_read }, - { &vop_write_desc, ext2fs_write }, - { &vop_ioctl_desc, ufs_ioctl }, - { &vop_poll_desc, ufs_poll }, - { &vop_kqfilter_desc, vop_generic_kqfilter }, - { &vop_fsync_desc, ext2fs_fsync }, - { &vop_remove_desc, ext2fs_remove }, - { &vop_link_desc, ext2fs_link }, - { &vop_rename_desc, ext2fs_rename }, - { &vop_mkdir_desc, ext2fs_mkdir }, - { &vop_rmdir_desc, ext2fs_rmdir }, - { &vop_symlink_desc, ext2fs_symlink }, - { &vop_readdir_desc, ext2fs_readdir }, - { &vop_readlink_desc, ext2fs_readlink }, - { &vop_abortop_desc, vop_generic_abortop }, - { &vop_inactive_desc, ext2fs_inactive }, - { &vop_reclaim_desc, ext2fs_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_bmap_desc, ext2fs_bmap }, - { &vop_strategy_desc, ufs_strategy }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { &vop_pathconf_desc, ufs_pathconf }, - { &vop_advlock_desc, ext2fs_advlock }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops ext2fs_vops = { + .vop_default = eopnotsupp, + .vop_lookup = ext2fs_lookup, + .vop_create = ext2fs_create, + .vop_mknod = ext2fs_mknod, + .vop_open = ext2fs_open, + .vop_close = ufs_close, + .vop_access = ext2fs_access, + .vop_getattr = ext2fs_getattr, + .vop_setattr = ext2fs_setattr, + .vop_read = ext2fs_read, + .vop_write = ext2fs_write, + .vop_ioctl = ufs_ioctl, + .vop_poll = ufs_poll, + .vop_kqfilter = vop_generic_kqfilter, + .vop_fsync = ext2fs_fsync, + .vop_remove = ext2fs_remove, + .vop_link = ext2fs_link, + .vop_rename = ext2fs_rename, + .vop_mkdir = ext2fs_mkdir, + .vop_rmdir = ext2fs_rmdir, + .vop_symlink = ext2fs_symlink, + .vop_readdir = ext2fs_readdir, + .vop_readlink = ext2fs_readlink, + .vop_abortop = vop_generic_abortop, + .vop_inactive = ext2fs_inactive, + .vop_reclaim = ext2fs_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_bmap = ext2fs_bmap, + .vop_strategy = ufs_strategy, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + .vop_pathconf = ufs_pathconf, + .vop_advlock = ext2fs_advlock, + .vop_bwrite = vop_generic_bwrite }; -struct vnodeopv_desc ext2fs_vnodeop_opv_desc = - { &ext2fs_vnodeop_p, ext2fs_vnodeop_entries }; - -int (**ext2fs_specop_p)(void *); -struct vnodeopv_entry_desc ext2fs_specop_entries[] = { - { &vop_default_desc, spec_vnoperate }, - { &vop_close_desc, ufsspec_close }, - { &vop_access_desc, ext2fs_access }, - { &vop_getattr_desc, ext2fs_getattr }, - { &vop_setattr_desc, ext2fs_setattr }, - { &vop_read_desc, ufsspec_read }, - { &vop_write_desc, ufsspec_write }, - { &vop_fsync_desc, ext2fs_fsync }, - { &vop_inactive_desc, ext2fs_inactive }, - { &vop_reclaim_desc, ext2fs_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { NULL, NULL } + +struct vops ext2fs_specvops = { + .vop_default = eopnotsupp, + .vop_close = ufsspec_close, + .vop_access = ext2fs_access, + .vop_getattr = ext2fs_getattr, + .vop_setattr = ext2fs_setattr, + .vop_read = ufsspec_read, + .vop_write = ufsspec_write, + .vop_fsync = ext2fs_fsync, + .vop_inactive = ext2fs_inactive, + .vop_reclaim = ext2fs_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + + /* XXX: Keep in sync with spec_vops. */ + .vop_lookup = vop_generic_lookup, + .vop_create = spec_badop, + .vop_mknod = spec_badop, + .vop_open = spec_open, + .vop_ioctl = spec_ioctl, + .vop_poll = spec_poll, + .vop_kqfilter = spec_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = spec_badop, + .vop_link = spec_badop, + .vop_rename = spec_badop, + .vop_mkdir = spec_badop, + .vop_rmdir = spec_badop, + .vop_symlink = spec_badop, + .vop_readdir = spec_badop, + .vop_readlink = spec_badop, + .vop_abortop = spec_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = spec_strategy, + .vop_pathconf = spec_pathconf, + .vop_advlock = spec_advlock, + .vop_bwrite = vop_generic_bwrite, }; -struct vnodeopv_desc ext2fs_specop_opv_desc = - { &ext2fs_specop_p, ext2fs_specop_entries }; #ifdef FIFO -int (**ext2fs_fifoop_p)(void *); -struct vnodeopv_entry_desc ext2fs_fifoop_entries[] = { - { &vop_default_desc, fifo_vnoperate }, - { &vop_close_desc, ufsfifo_close }, - { &vop_access_desc, ext2fs_access }, - { &vop_getattr_desc, ext2fs_getattr }, - { &vop_setattr_desc, ext2fs_setattr }, - { &vop_read_desc, ufsfifo_read }, - { &vop_write_desc, ufsfifo_write }, - { &vop_fsync_desc, ext2fs_fsync }, - { &vop_inactive_desc, ext2fs_inactive }, - { &vop_reclaim_desc, ext2fsfifo_reclaim }, - { &vop_lock_desc, ufs_lock }, - { &vop_unlock_desc, ufs_unlock }, - { &vop_print_desc, ufs_print }, - { &vop_islocked_desc, ufs_islocked }, - { &vop_bwrite_desc, vop_generic_bwrite }, - { NULL, NULL } +struct vops ext2fs_fifovops = { + .vop_default = eopnotsupp, + .vop_close = ufsfifo_close, + .vop_access = ufsfifo_close, + .vop_getattr = ext2fs_getattr, + .vop_setattr = ext2fs_setattr, + .vop_read = ufsfifo_read, + .vop_write = ufsfifo_write, + .vop_fsync = ext2fs_fsync, + .vop_inactive = ext2fs_inactive, + .vop_reclaim = ext2fsfifo_reclaim, + .vop_lock = ufs_lock, + .vop_unlock = ufs_unlock, + .vop_print = ufs_print, + .vop_islocked = ufs_islocked, + .vop_bwrite = vop_generic_bwrite, + + /* XXX: Keep in sync with fifo_vops */ + .vop_lookup = vop_generic_lookup, + .vop_create = fifo_badop, + .vop_mknod = fifo_badop, + .vop_open = fifo_open, + .vop_ioctl = fifo_ioctl, + .vop_poll = fifo_poll, + .vop_kqfilter = fifo_kqfilter, + .vop_revoke = vop_generic_revoke, + .vop_remove = fifo_badop, + .vop_link = fifo_badop, + .vop_rename = fifo_badop, + .vop_mkdir = fifo_badop, + .vop_rmdir = fifo_badop, + .vop_symlink = fifo_badop, + .vop_readdir = fifo_badop, + .vop_readlink = fifo_badop, + .vop_abortop = fifo_badop, + .vop_bmap = vop_generic_bmap, + .vop_strategy = fifo_badop, + .vop_pathconf = fifo_pathconf, + .vop_advlock = fifo_advlock, }; -struct vnodeopv_desc ext2fs_fifoop_opv_desc = - { &ext2fs_fifoop_p, ext2fs_fifoop_entries }; int ext2fsfifo_reclaim(void *v) -- cgit v1.2.3