diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-12-01 23:16:38 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2004-12-01 23:16:38 +0000 |
commit | aec0fb7b40e4cf877bea663f2d86dd07c3524fe8 (patch) | |
tree | f548d86b8998e8d581602fc54079bbb1534e7c18 /sys/fs/cd9660 | |
parent | 3a36dacc929d26949dd9d5d1f241e3e58913f52c (diff) | |
download | src-aec0fb7b40e4cf877bea663f2d86dd07c3524fe8.tar.gz src-aec0fb7b40e4cf877bea663f2d86dd07c3524fe8.zip |
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)
Notes
Notes:
svn path=/head/; revision=138290
Diffstat (limited to 'sys/fs/cd9660')
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 4 | ||||
-rw-r--r-- | sys/fs/cd9660/cd9660_vnops.c | 57 | ||||
-rw-r--r-- | sys/fs/cd9660/iso.h | 5 |
3 files changed, 27 insertions, 39 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 9500695a572c..685158d6a934 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -729,7 +729,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("isofs", mp, &cd9660_vnodeops, &vp)) != 0) { *vpp = NULLVP; return (error); } @@ -870,7 +870,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) */ switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) { case VFIFO: - vp->v_op = cd9660_fifoop_p; + vp->v_op = &cd9660_fifoops; break; default: break; diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 9761c2f09cf8..4a9e47356aa6 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -780,44 +780,33 @@ cd9660_pathconf(ap) /* * Global vfs data structures for cd9660 */ -vop_t **cd9660_vnodeop_p; -static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_bmap_desc, (vop_t *) cd9660_bmap }, - { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup }, - { &vop_getattr_desc, (vop_t *) cd9660_getattr }, - { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_ioctl_desc, (vop_t *) cd9660_ioctl }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_pathconf_desc, (vop_t *) cd9660_pathconf }, - { &vop_read_desc, (vop_t *) cd9660_read }, - { &vop_readdir_desc, (vop_t *) cd9660_readdir }, - { &vop_readlink_desc, (vop_t *) cd9660_readlink }, - { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { &vop_strategy_desc, (vop_t *) cd9660_strategy }, - { NULL, NULL } +struct vop_vector cd9660_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = cd9660_access, + .vop_bmap = cd9660_bmap, + .vop_cachedlookup = cd9660_lookup, + .vop_getattr = cd9660_getattr, + .vop_inactive = cd9660_inactive, + .vop_ioctl = cd9660_ioctl, + .vop_lookup = vfs_cache_lookup, + .vop_pathconf = cd9660_pathconf, + .vop_read = cd9660_read, + .vop_readdir = cd9660_readdir, + .vop_readlink = cd9660_readlink, + .vop_reclaim = cd9660_reclaim, + .vop_setattr = cd9660_setattr, + .vop_strategy = cd9660_strategy, }; -static struct vnodeopv_desc cd9660_vnodeop_opv_desc = - { &cd9660_vnodeop_p, cd9660_vnodeop_entries }; -VNODEOP_SET(cd9660_vnodeop_opv_desc); /* * Special device vnode ops */ -vop_t **cd9660_fifoop_p; -static struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_getattr_desc, (vop_t *) cd9660_getattr }, - { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { NULL, NULL } +struct vop_vector cd9660_fifoops = { + .vop_default = &fifo_specops, + .vop_access = cd9660_access, + .vop_getattr = cd9660_getattr, + .vop_inactive = cd9660_inactive, + .vop_reclaim = cd9660_reclaim, + .vop_setattr = cd9660_setattr, }; -static struct vnodeopv_desc cd9660_fifoop_opv_desc = - { &cd9660_fifoop_p, cd9660_fifoop_entries }; - -VNODEOP_SET(cd9660_fifoop_opv_desc); diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h index d74806307203..f0b52216bc03 100644 --- a/sys/fs/cd9660/iso.h +++ b/sys/fs/cd9660/iso.h @@ -263,9 +263,8 @@ int cd9660_uninit(struct vfsconf *); #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \ size_t, struct proc *))eopnotsupp) -extern vop_t **cd9660_vnodeop_p; -extern vop_t **cd9660_specop_p; -extern vop_t **cd9660_fifoop_p; +extern struct vop_vector cd9660_vnodeops; +extern struct vop_vector cd9660_fifoops; int isochar(u_char *, u_char *, int, u_short *, int *, int, void *); int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *); |