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/ufs | |
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/ufs')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_extern.h | 12 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_subr.c | 8 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vfsops.c | 21 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vnops.c | 197 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_extern.h | 12 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 205 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_extern.h | 6 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vnops.c | 82 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_extern.h | 9 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 25 |
12 files changed, 312 insertions, 277 deletions
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 |