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 | |
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')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vnops.c | 55 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 53 | ||||
-rw-r--r-- | sys/ufs/lfs/lfs_vnops.c | 68 |
3 files changed, 15 insertions, 161 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 }; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 1063d37d9ad..d678f56b3d4 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.27 2002/03/14 01:27:14 millert Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.28 2002/11/08 04:34:18 art Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -119,44 +119,20 @@ struct vnodeopv_desc ffs_vnodeop_opv_desc = int (**ffs_specop_p)(void *); struct vnodeopv_entry_desc ffs_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, ufs_access }, /* access */ { &vop_getattr_desc, ufs_getattr }, /* getattr */ { &vop_setattr_desc, ufs_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 }, /* select */ - { &vop_kqfilter_desc, spec_kqfilter }, /* kqfilter */ - { &vop_revoke_desc, spec_revoke }, /* revoke */ { &vop_fsync_desc, ffs_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, ufs_inactive }, /* inactive */ { &vop_reclaim_desc, ffs_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_reallocblks_desc, spec_reallocblks }, /* reallocblks */ - { &vop_bwrite_desc, vop_generic_bwrite }, #ifdef UFS_EXTATTR { &vop_getextattr_desc, ufs_vop_getextattr }, { &vop_setextattr_desc, ufs_vop_setextattr }, @@ -169,43 +145,20 @@ struct vnodeopv_desc ffs_specop_opv_desc = #ifdef FIFO int (**ffs_fifoop_p)(void *); struct vnodeopv_entry_desc ffs_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, ufs_access }, /* access */ { &vop_getattr_desc, ufs_getattr }, /* getattr */ { &vop_setattr_desc, ufs_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_revoke_desc, fifo_revoke }, /* revoke */ { &vop_fsync_desc, ffs_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, ufs_inactive }, /* inactive */ { &vop_reclaim_desc, ffs_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_reallocblks_desc, fifo_reallocblks }, /* reallocblks */ { &vop_bwrite_desc, vop_generic_bwrite }, #ifdef UFS_EXTATTR { &vop_getextattr_desc, ufs_vop_getextattr }, diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index ff649b68399..23c27e8dd35 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_vnops.c,v 1.7 2002/03/14 01:27:15 millert Exp $ */ +/* $OpenBSD: lfs_vnops.c,v 1.8 2002/11/08 04:34:18 art Exp $ */ /* $NetBSD: lfs_vnops.c,v 1.11 1996/05/11 18:27:41 mycroft Exp $ */ /* @@ -111,56 +111,28 @@ struct vnodeopv_entry_desc lfs_vnodeop_entries[] = { { &vop_truncate_desc, lfs_truncate }, /* truncate */ { &vop_update_desc, lfs_update }, /* update */ { &vop_bwrite_desc, lfs_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc lfs_vnodeop_opv_desc = { &lfs_vnodeop_p, lfs_vnodeop_entries }; int (**lfs_specop_p)(void *); struct vnodeopv_entry_desc lfs_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, ufs_access }, /* access */ { &vop_getattr_desc, lfs_getattr }, /* getattr */ { &vop_setattr_desc, ufs_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 }, /* select */ - { &vop_mmap_desc, spec_mmap }, /* mmap */ - { &vop_fsync_desc, spec_fsync }, /* fsync */ - { &vop_seek_desc, spec_seek }, /* seek */ - { &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, lfs_inactive }, /* inactive */ { &vop_reclaim_desc, lfs_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_blkatoff_desc, spec_blkatoff }, /* blkatoff */ - { &vop_valloc_desc, spec_valloc }, /* valloc */ - { &vop_vfree_desc, lfs_vfree }, /* vfree */ - { &vop_truncate_desc, spec_truncate }, /* truncate */ - { &vop_update_desc, lfs_update }, /* update */ { &vop_bwrite_desc, lfs_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc lfs_specop_opv_desc = { &lfs_specop_p, lfs_specop_entries }; @@ -168,49 +140,21 @@ struct vnodeopv_desc lfs_specop_opv_desc = #ifdef FIFO int (**lfs_fifoop_p)(void *); struct vnodeopv_entry_desc lfs_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, ufs_access }, /* access */ { &vop_getattr_desc, lfs_getattr }, /* getattr */ { &vop_setattr_desc, ufs_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_mmap_desc, fifo_mmap }, /* mmap */ - { &vop_fsync_desc, fifo_fsync }, /* fsync */ - { &vop_seek_desc, fifo_seek }, /* seek */ - { &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, lfs_inactive }, /* inactive */ { &vop_reclaim_desc, lfs_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_blkatoff_desc, fifo_blkatoff }, /* blkatoff */ - { &vop_valloc_desc, fifo_valloc }, /* valloc */ - { &vop_vfree_desc, lfs_vfree }, /* vfree */ - { &vop_truncate_desc, fifo_truncate }, /* truncate */ - { &vop_update_desc, lfs_update }, /* update */ { &vop_bwrite_desc, lfs_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc lfs_fifoop_opv_desc = { &lfs_fifoop_p, lfs_fifoop_entries }; |