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/nfsclient/nfs_vnops.c | |
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/nfsclient/nfs_vnops.c')
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 100 |
1 files changed, 45 insertions, 55 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 0d06df9..50756d3 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -131,60 +131,50 @@ static vop_advlock_t nfs_advlock; /* * Global vfs data structures for nfs */ -vop_t **nfs_vnodeop_p; -static struct vnodeopv_entry_desc nfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) nfs_access }, - { &vop_advlock_desc, (vop_t *) nfs_advlock }, - { &vop_close_desc, (vop_t *) nfs_close }, - { &vop_create_desc, (vop_t *) nfs_create }, - { &vop_fsync_desc, (vop_t *) nfs_fsync }, - { &vop_getattr_desc, (vop_t *) nfs_getattr }, - { &vop_getpages_desc, (vop_t *) nfs_getpages }, - { &vop_putpages_desc, (vop_t *) nfs_putpages }, - { &vop_inactive_desc, (vop_t *) nfs_inactive }, - { &vop_lease_desc, (vop_t *) vop_null }, - { &vop_link_desc, (vop_t *) nfs_link }, - { &vop_lookup_desc, (vop_t *) nfs_lookup }, - { &vop_mkdir_desc, (vop_t *) nfs_mkdir }, - { &vop_mknod_desc, (vop_t *) nfs_mknod }, - { &vop_open_desc, (vop_t *) nfs_open }, - { &vop_print_desc, (vop_t *) nfs_print }, - { &vop_read_desc, (vop_t *) nfs_read }, - { &vop_readdir_desc, (vop_t *) nfs_readdir }, - { &vop_readlink_desc, (vop_t *) nfs_readlink }, - { &vop_reclaim_desc, (vop_t *) nfs_reclaim }, - { &vop_remove_desc, (vop_t *) nfs_remove }, - { &vop_rename_desc, (vop_t *) nfs_rename }, - { &vop_rmdir_desc, (vop_t *) nfs_rmdir }, - { &vop_setattr_desc, (vop_t *) nfs_setattr }, - { &vop_strategy_desc, (vop_t *) nfs_strategy }, - { &vop_symlink_desc, (vop_t *) nfs_symlink }, - { &vop_write_desc, (vop_t *) nfs_write }, - { NULL, NULL } +struct vop_vector nfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = nfs_access, + .vop_advlock = nfs_advlock, + .vop_close = nfs_close, + .vop_create = nfs_create, + .vop_fsync = nfs_fsync, + .vop_getattr = nfs_getattr, + .vop_getpages = nfs_getpages, + .vop_putpages = nfs_putpages, + .vop_inactive = nfs_inactive, + .vop_lease = VOP_NULL, + .vop_link = nfs_link, + .vop_lookup = nfs_lookup, + .vop_mkdir = nfs_mkdir, + .vop_mknod = nfs_mknod, + .vop_open = nfs_open, + .vop_print = nfs_print, + .vop_read = nfs_read, + .vop_readdir = nfs_readdir, + .vop_readlink = nfs_readlink, + .vop_reclaim = nfs_reclaim, + .vop_remove = nfs_remove, + .vop_rename = nfs_rename, + .vop_rmdir = nfs_rmdir, + .vop_setattr = nfs_setattr, + .vop_strategy = nfs_strategy, + .vop_symlink = nfs_symlink, + .vop_write = nfs_write, }; -static struct vnodeopv_desc nfs_vnodeop_opv_desc = - { &nfs_vnodeop_p, nfs_vnodeop_entries }; -VNODEOP_SET(nfs_vnodeop_opv_desc); - -vop_t **fifo_nfsnodeop_p; -static struct vnodeopv_entry_desc nfs_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) nfsspec_access }, - { &vop_close_desc, (vop_t *) nfsfifo_close }, - { &vop_fsync_desc, (vop_t *) nfs_fsync }, - { &vop_getattr_desc, (vop_t *) nfs_getattr }, - { &vop_inactive_desc, (vop_t *) nfs_inactive }, - { &vop_print_desc, (vop_t *) nfs_print }, - { &vop_read_desc, (vop_t *) nfsfifo_read }, - { &vop_reclaim_desc, (vop_t *) nfs_reclaim }, - { &vop_setattr_desc, (vop_t *) nfs_setattr }, - { &vop_write_desc, (vop_t *) nfsfifo_write }, - { NULL, NULL } + +struct vop_vector nfs_fifoops = { + .vop_default = &fifo_specops, + .vop_access = nfsspec_access, + .vop_close = nfsfifo_close, + .vop_fsync = nfs_fsync, + .vop_getattr = nfs_getattr, + .vop_inactive = nfs_inactive, + .vop_print = nfs_print, + .vop_read = nfsfifo_read, + .vop_reclaim = nfs_reclaim, + .vop_setattr = nfs_setattr, + .vop_write = nfsfifo_write, }; -static struct vnodeopv_desc fifo_nfsnodeop_opv_desc = - { &fifo_nfsnodeop_p, nfs_fifoop_entries }; -VNODEOP_SET(fifo_nfsnodeop_opv_desc); static int nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap); @@ -3046,7 +3036,7 @@ nfsfifo_read(struct vop_read_args *ap) */ np->n_flag |= NACC; getnanotime(&np->n_atim); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap)); + return (fifo_specops.vop_read(ap)); } /* @@ -3062,7 +3052,7 @@ nfsfifo_write(struct vop_write_args *ap) */ np->n_flag |= NUPD; getnanotime(&np->n_mtim); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap)); + return (fifo_specops.vop_write(ap)); } /* @@ -3097,7 +3087,7 @@ nfsfifo_close(struct vop_close_args *ap) VOP_UNLOCK(vp, 0, ap->a_td); } } - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_specops.vop_close(ap)); } /* |