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 | |
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')
-rw-r--r-- | sys/miscfs/fifofs/fifo.h | 4 | ||||
-rw-r--r-- | sys/miscfs/fifofs/fifo_vnops.c | 18 | ||||
-rw-r--r-- | sys/miscfs/specfs/spec_vnops.c | 12 | ||||
-rw-r--r-- | sys/miscfs/specfs/specdev.h | 4 |
4 files changed, 29 insertions, 9 deletions
diff --git a/sys/miscfs/fifofs/fifo.h b/sys/miscfs/fifofs/fifo.h index cce2369bb1f..5b9d090c015 100644 --- a/sys/miscfs/fifofs/fifo.h +++ b/sys/miscfs/fifofs/fifo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo.h,v 1.11 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: fifo.h,v 1.12 2002/11/08 04:34:17 art Exp $ */ /* $NetBSD: fifo.h,v 1.10 1996/02/09 22:40:15 christos Exp $ */ /* @@ -83,6 +83,8 @@ int fifo_advlock(void *); void fifo_printinfo(struct vnode *); +int fifo_vnoperate(void *); + extern int (**fifo_vnodeop_p)(void *); #endif /* FIFO */ diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index 941fb4051a5..e6a693dc96b 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.13 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.14 2002/11/08 04:34:17 art Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -103,9 +103,20 @@ struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_pathconf_desc, fifo_pathconf }, /* pathconf */ { &vop_advlock_desc, fifo_advlock }, /* advlock */ { &vop_bwrite_desc, fifo_bwrite }, /* bwrite */ - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } + { NULL, NULL } }; +struct vnodeopv_desc fifo_vnodeop_opv_desc = + { &fifo_vnodeop_p, fifo_vnodeop_entries }; + +int +fifo_vnoperate(void *v) +{ + struct vop_generic_args *ap = v; + + return (VOCALL(fifo_vnodeop_p, ap->a_desc->vdesc_offset, ap)); +} + void filt_fifordetach(struct knote *kn); int filt_fiforead(struct knote *kn, long hint); void filt_fifowdetach(struct knote *kn); @@ -116,9 +127,6 @@ struct filterops fiforead_filtops = struct filterops fifowrite_filtops = { 1, NULL, filt_fifowdetach, filt_fifowrite }; -struct vnodeopv_desc fifo_vnodeop_opv_desc = - { &fifo_vnodeop_p, fifo_vnodeop_entries }; - /* * Trivial lookup routine that always fails. */ 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 *); |