summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_vnops.c
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2010-09-06 23:44:12 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2010-09-06 23:44:12 +0000
commit87f3d58d3064a78c9b29faa668f1d98225f01e71 (patch)
treebbc6c4fb3c1748ac72b8b1b8bab76b4e91896fd0 /sys/ufs/ffs/ffs_vnops.c
parenta41bd31e53cce764c5bc6861ce6be4074cc59551 (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/ffs/ffs_vnops.c')
-rw-r--r--sys/ufs/ffs/ffs_vnops.c205
1 files changed, 119 insertions, 86 deletions
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 */
/*