diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-11-08 04:34:19 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-11-08 04:34:19 +0000 |
commit | 19c98636e10b68ad30a4acbd83bce1df8b5597ce (patch) | |
tree | 6741880a682fa67ac6ba39ed1cc1a0e498f9d62f /sys/nfs | |
parent | 4fa084ae104c9bcb5a12e713575ec70f65739316 (diff) |
Implement simple vnodeop inheritance for specfs and fifofs.
The inheritace is implemented by setting the default vnodeop to a
bypass op that repeats the operation on the spec/fifo vnodeop vector.
The overhead of one extra indirect function call is worth the cleanup
and improved correctness.
This actually solves a few bugs where some vnode ops were missing from
some vectors (like kqfilter or revoke). (and even more on the ubc
branch).
Inspired by the same thing done in FreeBSD.
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 57 |
1 files changed, 6 insertions, 51 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index e79fd9c224c..b0875e2b024 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.51 2002/05/21 21:07:09 art Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.52 2002/11/08 04:34:17 art Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -126,7 +126,7 @@ struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = { { &vop_advlock_desc, nfs_advlock }, /* advlock */ { &vop_reallocblks_desc, nfs_reallocblks }, /* reallocblks */ { &vop_bwrite_desc, nfs_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc nfsv2_vnodeop_opv_desc = { &nfsv2_vnodeop_p, nfsv2_vnodeop_entries }; @@ -136,44 +136,21 @@ struct vnodeopv_desc nfsv2_vnodeop_opv_desc = */ int (**spec_nfsv2nodeop_p)(void *); struct vnodeopv_entry_desc spec_nfsv2nodeop_entries[] = { - { &vop_default_desc, vn_default_error }, - { &vop_lookup_desc, spec_lookup }, /* lookup */ - { &vop_create_desc, spec_create }, /* create */ - { &vop_mknod_desc, spec_mknod }, /* mknod */ - { &vop_open_desc, spec_open }, /* open */ + { &vop_default_desc, spec_vnoperate }, { &vop_close_desc, nfsspec_close }, /* close */ { &vop_access_desc, nfsspec_access }, /* access */ { &vop_getattr_desc, nfs_getattr }, /* getattr */ { &vop_setattr_desc, nfs_setattr }, /* setattr */ { &vop_read_desc, nfsspec_read }, /* read */ { &vop_write_desc, nfsspec_write }, /* write */ - { &vop_lease_desc, spec_lease_check }, /* lease */ - { &vop_ioctl_desc, spec_ioctl }, /* ioctl */ - { &vop_select_desc, spec_select }, /* select */ - { &vop_revoke_desc, spec_revoke }, /* revoke */ { &vop_fsync_desc, nfs_fsync }, /* fsync */ - { &vop_remove_desc, spec_remove }, /* remove */ - { &vop_link_desc, spec_link }, /* link */ - { &vop_rename_desc, spec_rename }, /* rename */ - { &vop_mkdir_desc, spec_mkdir }, /* mkdir */ - { &vop_rmdir_desc, spec_rmdir }, /* rmdir */ - { &vop_symlink_desc, spec_symlink }, /* symlink */ - { &vop_readdir_desc, spec_readdir }, /* readdir */ - { &vop_readlink_desc, spec_readlink }, /* readlink */ - { &vop_abortop_desc, spec_abortop }, /* abortop */ { &vop_inactive_desc, nfs_inactive }, /* inactive */ { &vop_reclaim_desc, nfs_reclaim }, /* reclaim */ { &vop_lock_desc, nfs_lock }, /* lock */ { &vop_unlock_desc, nfs_unlock }, /* unlock */ - { &vop_bmap_desc, spec_bmap }, /* bmap */ - { &vop_strategy_desc, spec_strategy }, /* strategy */ { &vop_print_desc, nfs_print }, /* print */ { &vop_islocked_desc, nfs_islocked }, /* islocked */ - { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ - { &vop_advlock_desc, spec_advlock }, /* advlock */ - { &vop_reallocblks_desc, spec_reallocblks }, /* reallocblks */ - { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc spec_nfsv2nodeop_opv_desc = { &spec_nfsv2nodeop_p, spec_nfsv2nodeop_entries }; @@ -181,44 +158,22 @@ struct vnodeopv_desc spec_nfsv2nodeop_opv_desc = #ifdef FIFO int (**fifo_nfsv2nodeop_p)(void *); struct vnodeopv_entry_desc fifo_nfsv2nodeop_entries[] = { - { &vop_default_desc, vn_default_error }, - { &vop_lookup_desc, fifo_lookup }, /* lookup */ - { &vop_create_desc, fifo_create }, /* create */ - { &vop_mknod_desc, fifo_mknod }, /* mknod */ - { &vop_open_desc, fifo_open }, /* open */ + { &vop_default_desc, fifo_vnoperate }, { &vop_close_desc, nfsfifo_close }, /* close */ { &vop_access_desc, nfsspec_access }, /* access */ { &vop_getattr_desc, nfs_getattr }, /* getattr */ { &vop_setattr_desc, nfs_setattr }, /* setattr */ { &vop_read_desc, nfsfifo_read }, /* read */ { &vop_write_desc, nfsfifo_write }, /* write */ - { &vop_lease_desc, fifo_lease_check }, /* lease */ - { &vop_ioctl_desc, fifo_ioctl }, /* ioctl */ - { &vop_select_desc, fifo_select }, /* select */ - { &vop_revoke_desc, fifo_revoke }, /* revoke */ { &vop_fsync_desc, nfs_fsync }, /* fsync */ - { &vop_remove_desc, fifo_remove }, /* remove */ - { &vop_link_desc, fifo_link }, /* link */ - { &vop_rename_desc, fifo_rename }, /* rename */ - { &vop_mkdir_desc, fifo_mkdir }, /* mkdir */ - { &vop_rmdir_desc, fifo_rmdir }, /* rmdir */ - { &vop_symlink_desc, fifo_symlink }, /* symlink */ - { &vop_readdir_desc, fifo_readdir }, /* readdir */ - { &vop_readlink_desc, fifo_readlink }, /* readlink */ - { &vop_abortop_desc, fifo_abortop }, /* abortop */ { &vop_inactive_desc, nfs_inactive }, /* inactive */ { &vop_reclaim_desc, nfs_reclaim }, /* reclaim */ { &vop_lock_desc, nfs_lock }, /* lock */ { &vop_unlock_desc, nfs_unlock }, /* unlock */ - { &vop_bmap_desc, fifo_bmap }, /* bmap */ - { &vop_strategy_desc, fifo_badop }, /* strategy */ { &vop_print_desc, nfs_print }, /* print */ { &vop_islocked_desc, nfs_islocked }, /* islocked */ - { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ - { &vop_advlock_desc, fifo_advlock }, /* advlock */ - { &vop_reallocblks_desc, fifo_reallocblks }, /* reallocblks */ { &vop_bwrite_desc, vop_generic_bwrite }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc = { &fifo_nfsv2nodeop_p, fifo_nfsv2nodeop_entries }; |