summaryrefslogtreecommitdiff
path: root/sys/miscfs/fifofs/fifo_vnops.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-11-08 04:34:19 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-11-08 04:34:19 +0000
commit19c98636e10b68ad30a4acbd83bce1df8b5597ce (patch)
tree6741880a682fa67ac6ba39ed1cc1a0e498f9d62f /sys/miscfs/fifofs/fifo_vnops.c
parent4fa084ae104c9bcb5a12e713575ec70f65739316 (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/miscfs/fifofs/fifo_vnops.c')
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c18
1 files changed, 13 insertions, 5 deletions
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.
*/