summaryrefslogtreecommitdiffstats
path: root/sys/fs/fifofs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-12-01 23:16:38 +0000
committerphk <phk@FreeBSD.org>2004-12-01 23:16:38 +0000
commit59f305606cbc120b44978581149ef1a3e62bf3b4 (patch)
treef548d86b8998e8d581602fc54079bbb1534e7c18 /sys/fs/fifofs
parent350be3accf1712e54ae2732ca42ad409bbf20df7 (diff)
downloadFreeBSD-src-59f305606cbc120b44978581149ef1a3e62bf3b4.zip
FreeBSD-src-59f305606cbc120b44978581149ef1a3e62bf3b4.tar.gz
Back when VOP_* was introduced, we did not have new-style struct
initializations but we did have lofty goals and big ideals. Adjust to more contemporary circumstances and gain type checking. Replace the entire vop_t frobbing thing with properly typed structures. The only casualty is that we can not add a new VOP_ method with a loadable module. History has not given us reason to belive this would ever be feasible in the the first place. Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc. Give coda correct prototypes and function definitions for all vop_()s. Generate a bit more data from the vnode_if.src file: a struct vop_vector and protype typedefs for all vop methods. Add a new vop_bypass() and make vop_default be a pointer to another struct vop_vector. Remove a lot of vfs_init since vop_vector is ready to use from the compiler. Cast various vop_mumble() to void * with uppercase name, for instance VOP_PANIC, VOP_NULL etc. Implement VCALL() by making vdesc_offset the offsetof() the relevant function pointer in vop_vector. This is disgusting but since the code is generated by a script comparatively safe. The alternative for nullfs etc. would be much worse. Fix up all vnode method vectors to remove casts so they become typesafe. (The bulk of this is generated by scripts)
Diffstat (limited to 'sys/fs/fifofs')
-rw-r--r--sys/fs/fifofs/fifo.h2
-rw-r--r--sys/fs/fifofs/fifo_vnops.c66
2 files changed, 25 insertions, 43 deletions
diff --git a/sys/fs/fifofs/fifo.h b/sys/fs/fifofs/fifo.h
index 1148c9a..339763b 100644
--- a/sys/fs/fifofs/fifo.h
+++ b/sys/fs/fifofs/fifo.h
@@ -30,8 +30,6 @@
* $FreeBSD$
*/
-extern vop_t **fifo_vnodeop_p;
-
/*
* Prototypes for fifo operations on vnodes.
*/
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index a136e0f..53d267f 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -100,52 +100,36 @@ static struct filterops fiforead_filtops =
static struct filterops fifowrite_filtops =
{ 1, NULL, filt_fifowdetach, filt_fifowrite };
-vop_t **fifo_vnodeop_p;
-static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
- { &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_access_desc, (vop_t *) vop_ebadf },
- { &vop_advlock_desc, (vop_t *) fifo_advlock },
- { &vop_close_desc, (vop_t *) fifo_close },
- { &vop_create_desc, (vop_t *) vop_panic },
- { &vop_getattr_desc, (vop_t *) vop_ebadf },
- { &vop_ioctl_desc, (vop_t *) fifo_ioctl },
- { &vop_kqfilter_desc, (vop_t *) fifo_kqfilter },
- { &vop_lease_desc, (vop_t *) vop_null },
- { &vop_link_desc, (vop_t *) vop_panic },
- { &vop_mkdir_desc, (vop_t *) vop_panic },
- { &vop_mknod_desc, (vop_t *) vop_panic },
- { &vop_open_desc, (vop_t *) fifo_open },
- { &vop_pathconf_desc, (vop_t *) fifo_pathconf },
- { &vop_print_desc, (vop_t *) fifo_print },
- { &vop_readdir_desc, (vop_t *) vop_panic },
- { &vop_readlink_desc, (vop_t *) vop_panic },
- { &vop_reallocblks_desc, (vop_t *) vop_panic },
- { &vop_reclaim_desc, (vop_t *) vop_null },
- { &vop_remove_desc, (vop_t *) vop_panic },
- { &vop_rename_desc, (vop_t *) vop_panic },
- { &vop_rmdir_desc, (vop_t *) vop_panic },
- { &vop_setattr_desc, (vop_t *) vop_ebadf },
- { &vop_symlink_desc, (vop_t *) vop_panic },
- { NULL, NULL }
+struct vop_vector fifo_specops = {
+ .vop_default = &default_vnodeops,
+ .vop_access = VOP_EBADF,
+ .vop_advlock = fifo_advlock,
+ .vop_close = fifo_close,
+ .vop_create = VOP_PANIC,
+ .vop_getattr = VOP_EBADF,
+ .vop_ioctl = fifo_ioctl,
+ .vop_kqfilter = fifo_kqfilter,
+ .vop_lease = VOP_NULL,
+ .vop_link = VOP_PANIC,
+ .vop_mkdir = VOP_PANIC,
+ .vop_mknod = VOP_PANIC,
+ .vop_open = fifo_open,
+ .vop_pathconf = fifo_pathconf,
+ .vop_print = fifo_print,
+ .vop_readdir = VOP_PANIC,
+ .vop_readlink = VOP_PANIC,
+ .vop_reallocblks = VOP_PANIC,
+ .vop_reclaim = VOP_NULL,
+ .vop_remove = VOP_PANIC,
+ .vop_rename = VOP_PANIC,
+ .vop_rmdir = VOP_PANIC,
+ .vop_setattr = VOP_EBADF,
+ .vop_symlink = VOP_PANIC,
};
-static struct vnodeopv_desc fifo_vnodeop_opv_desc =
- { &fifo_vnodeop_p, fifo_vnodeop_entries };
-
-VNODEOP_SET(fifo_vnodeop_opv_desc);
struct mtx fifo_mtx;
MTX_SYSINIT(fifo, &fifo_mtx, "fifo mutex", MTX_DEF);
-int
-fifo_vnoperate(ap)
- struct vop_generic_args /* {
- struct vnodeop_desc *a_desc;
- <other random data follows, presumably>
- } */ *ap;
-{
- return (VOCALL(fifo_vnodeop_p, ap->a_desc->vdesc_offset, ap));
-}
-
/*
* Dispose of fifo resources.
*/
OpenPOWER on IntegriCloud