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/ufs/ext2fs/ext2fs_vnops.c | |
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/ufs/ext2fs/ext2fs_vnops.c')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vnops.c | 55 |
1 files changed, 6 insertions, 49 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index 09b96dd1d17..03def12f92e 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.24 2002/03/14 03:16:13 millert Exp $ */ +/* $OpenBSD: ext2fs_vnops.c,v 1.25 2002/11/08 04:34:18 art Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */ /* @@ -1468,50 +1468,28 @@ struct vnodeopv_entry_desc ext2fs_vnodeop_entries[] = { { &vop_pathconf_desc, ufs_pathconf }, /* pathconf */ { &vop_advlock_desc, ext2fs_advlock }, /* advlock */ { &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; 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, 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, ufsspec_close }, /* close */ { &vop_access_desc, ext2fs_access }, /* access */ { &vop_getattr_desc, ext2fs_getattr }, /* getattr */ { &vop_setattr_desc, ext2fs_setattr }, /* setattr */ { &vop_read_desc, ufsspec_read }, /* read */ { &vop_write_desc, ufsspec_write }, /* write */ - { &vop_lease_desc, spec_lease_check }, /* lease */ - { &vop_ioctl_desc, spec_ioctl }, /* ioctl */ - { &vop_select_desc, spec_select }, /* poll */ - { &vop_kqfilter_desc, spec_kqfilter }, /* kqfilter */ { &vop_fsync_desc, ext2fs_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, ext2fs_inactive },/* inactive */ { &vop_reclaim_desc, ext2fs_reclaim }, /* reclaim */ { &vop_lock_desc, ufs_lock }, /* lock */ { &vop_unlock_desc, ufs_unlock }, /* unlock */ - { &vop_bmap_desc, spec_bmap }, /* bmap */ - { &vop_strategy_desc, spec_strategy }, /* strategy */ { &vop_print_desc, ufs_print }, /* print */ { &vop_islocked_desc, ufs_islocked }, /* islocked */ - { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ - { &vop_advlock_desc, spec_advlock }, /* advlock */ - { &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc ext2fs_specop_opv_desc = { &ext2fs_specop_p, ext2fs_specop_entries }; @@ -1519,43 +1497,22 @@ struct vnodeopv_desc ext2fs_specop_opv_desc = #ifdef FIFO int (**ext2fs_fifoop_p)(void *); struct vnodeopv_entry_desc ext2fs_fifoop_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, ufsfifo_close }, /* close */ { &vop_access_desc, ext2fs_access }, /* access */ { &vop_getattr_desc, ext2fs_getattr }, /* getattr */ { &vop_setattr_desc, ext2fs_setattr }, /* setattr */ { &vop_read_desc, ufsfifo_read }, /* read */ { &vop_write_desc, ufsfifo_write }, /* write */ - { &vop_lease_desc, fifo_lease_check }, /* lease */ - { &vop_ioctl_desc, fifo_ioctl }, /* ioctl */ - { &vop_select_desc, fifo_select }, /* select */ - { &vop_kqfilter_desc, fifo_kqfilter }, /* kqfilter */ { &vop_fsync_desc, ext2fs_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, ext2fs_inactive },/* inactive */ { &vop_reclaim_desc, ext2fs_reclaim }, /* reclaim */ { &vop_lock_desc, ufs_lock }, /* lock */ { &vop_unlock_desc, ufs_unlock }, /* unlock */ - { &vop_bmap_desc, fifo_bmap }, /* bmap */ - { &vop_strategy_desc, fifo_strategy }, /* strategy */ { &vop_print_desc, ufs_print }, /* print */ { &vop_islocked_desc, ufs_islocked }, /* islocked */ - { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ - { &vop_advlock_desc, fifo_advlock }, /* advlock */ { &vop_bwrite_desc, vop_generic_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc ext2fs_fifoop_opv_desc = { &ext2fs_fifoop_p, ext2fs_fifoop_entries }; |