diff options
author | 2002-11-08 04:34:17 +0000 | |
---|---|---|
committer | 2002-11-08 04:34:17 +0000 | |
commit | c20cb638e5619c72497e203896a65829053e2348 (patch) | |
tree | bc1c3ae9aeab3ed062030d52e919f43aadcaf966 /sys/miscfs/specfs | |
parent | Don't uvm_useracc and then vslock. vslock is better at finding illegal mappings. (diff) | |
download | wireguard-openbsd-c20cb638e5619c72497e203896a65829053e2348.tar.xz wireguard-openbsd-c20cb638e5619c72497e203896a65829053e2348.zip |
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/miscfs/specfs')
-rw-r--r-- | sys/miscfs/specfs/spec_vnops.c | 12 | ||||
-rw-r--r-- | sys/miscfs/specfs/specdev.h | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 744a61f6388..067be255e05 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.23 2002/03/14 01:27:08 millert Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.24 2002/11/08 04:34:17 art Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -104,11 +104,19 @@ struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_pathconf_desc, spec_pathconf }, /* pathconf */ { &vop_advlock_desc, spec_advlock }, /* advlock */ { &vop_bwrite_desc, spec_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; struct vnodeopv_desc spec_vnodeop_opv_desc = { &spec_vnodeop_p, spec_vnodeop_entries }; +int +spec_vnoperate(void *v) +{ + struct vop_generic_args *ap = v; + + return (VOCALL(spec_vnodeop_p, ap->a_desc->vdesc_offset, ap)); +} + /* * Trivial lookup routine that always fails. */ diff --git a/sys/miscfs/specfs/specdev.h b/sys/miscfs/specfs/specdev.h index fc7366f6485..31e53f79f3a 100644 --- a/sys/miscfs/specfs/specdev.h +++ b/sys/miscfs/specfs/specdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specdev.h,v 1.13 2002/03/14 01:27:08 millert Exp $ */ +/* $OpenBSD: specdev.h,v 1.14 2002/11/08 04:34:17 art Exp $ */ /* $NetBSD: specdev.h,v 1.12 1996/02/13 13:13:01 mycroft Exp $ */ /* @@ -121,3 +121,5 @@ int spec_advlock(void *); #define spec_reallocblks spec_badop #define spec_bwrite vop_generic_bwrite #define spec_revoke vop_generic_revoke + +int spec_vnoperate(void *); |