diff options
author | phk <phk@FreeBSD.org> | 2004-12-01 23:16:38 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-12-01 23:16:38 +0000 |
commit | 59f305606cbc120b44978581149ef1a3e62bf3b4 (patch) | |
tree | f548d86b8998e8d581602fc54079bbb1534e7c18 /sys/fs/udf | |
parent | 350be3accf1712e54ae2732ca42ad409bbf20df7 (diff) | |
download | FreeBSD-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/udf')
-rw-r--r-- | sys/fs/udf/udf_vnops.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index c92bf5c..33dde60 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -68,26 +68,21 @@ static vop_reclaim_t udf_reclaim; static int udf_readatoffset(struct udf_node *, int *, int, struct buf **, uint8_t **); static int udf_bmap_internal(struct udf_node *, uint32_t, daddr_t *, uint32_t *); -vop_t **udf_vnodeop_p; -static struct vnodeopv_entry_desc udf_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) udf_access }, - { &vop_bmap_desc, (vop_t *) udf_bmap }, - { &vop_cachedlookup_desc, (vop_t *) udf_lookup }, - { &vop_getattr_desc, (vop_t *) udf_getattr }, - { &vop_ioctl_desc, (vop_t *) udf_ioctl }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_pathconf_desc, (vop_t *) udf_pathconf }, - { &vop_read_desc, (vop_t *) udf_read }, - { &vop_readdir_desc, (vop_t *) udf_readdir }, - { &vop_readlink_desc, (vop_t *) udf_readlink }, - { &vop_reclaim_desc, (vop_t *) udf_reclaim }, - { &vop_strategy_desc, (vop_t *) udf_strategy }, - { NULL, NULL } +static struct vop_vector udf_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = udf_access, + .vop_bmap = udf_bmap, + .vop_cachedlookup = udf_lookup, + .vop_getattr = udf_getattr, + .vop_ioctl = udf_ioctl, + .vop_lookup = vfs_cache_lookup, + .vop_pathconf = udf_pathconf, + .vop_read = udf_read, + .vop_readdir = udf_readdir, + .vop_readlink = udf_readlink, + .vop_reclaim = udf_reclaim, + .vop_strategy = udf_strategy, }; -static struct vnodeopv_desc udf_vnodeop_opv_desc = - { &udf_vnodeop_p, udf_vnodeop_entries }; -VNODEOP_SET(udf_vnodeop_opv_desc); MALLOC_DEFINE(M_UDFFID, "UDF FID", "UDF FileId structure"); MALLOC_DEFINE(M_UDFDS, "UDF DS", "UDF Dirstream structure"); @@ -171,7 +166,7 @@ udf_allocv(struct mount *mp, struct vnode **vpp, struct thread *td) int error; struct vnode *vp; - error = getnewvnode("udf", mp, udf_vnodeop_p, &vp); + error = getnewvnode("udf", mp, &udf_vnodeops, &vp); if (error) { printf("udf_allocv: failed to allocate new vnode\n"); return (error); |