summaryrefslogtreecommitdiffstats
path: root/sys/fs/portalfs
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/portalfs
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/portalfs')
-rw-r--r--sys/fs/portalfs/portal.h2
-rw-r--r--sys/fs/portalfs/portal_vfsops.c2
-rw-r--r--sys/fs/portalfs/portal_vnops.c28
3 files changed, 13 insertions, 19 deletions
diff --git a/sys/fs/portalfs/portal.h b/sys/fs/portalfs/portal.h
index 02e42c7..5891b0f 100644
--- a/sys/fs/portalfs/portal.h
+++ b/sys/fs/portalfs/portal.h
@@ -63,5 +63,5 @@ struct portalnode {
#define PORTAL_ROOTFILEID 2
-extern vop_t **portal_vnodeop_p;
+extern struct vop_vector portal_vnodeops;
#endif /* _KERNEL */
diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c
index 5ff1138..1326836 100644
--- a/sys/fs/portalfs/portal_vfsops.c
+++ b/sys/fs/portalfs/portal_vfsops.c
@@ -110,7 +110,7 @@ portal_omount(mp, path, data, td)
MALLOC(fmp, struct portalmount *, sizeof(struct portalmount),
M_PORTALFSMNT, M_WAITOK); /* XXX */
- error = getnewvnode("portal", mp, portal_vnodeop_p, &rvp); /* XXX */
+ error = getnewvnode("portal", mp, &portal_vnodeops, &rvp); /* XXX */
if (error) {
FREE(fmp, M_PORTALFSMNT);
FREE(pn, M_TEMP);
diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c
index fcc5b55..5c40839 100644
--- a/sys/fs/portalfs/portal_vnops.c
+++ b/sys/fs/portalfs/portal_vnops.c
@@ -131,7 +131,7 @@ portal_lookup(ap)
MALLOC(pt, struct portalnode *, sizeof(struct portalnode),
M_TEMP, M_WAITOK);
- error = getnewvnode("portal", dvp->v_mount, portal_vnodeop_p, &fvp);
+ error = getnewvnode("portal", dvp->v_mount, &portal_vnodeops, &fvp);
if (error) {
FREE(pt, M_TEMP);
goto bad;
@@ -556,20 +556,14 @@ portal_reclaim(ap)
return (0);
}
-vop_t **portal_vnodeop_p;
-static struct vnodeopv_entry_desc portal_vnodeop_entries[] = {
- { &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_access_desc, (vop_t *) vop_null },
- { &vop_getattr_desc, (vop_t *) portal_getattr },
- { &vop_lookup_desc, (vop_t *) portal_lookup },
- { &vop_open_desc, (vop_t *) portal_open },
- { &vop_pathconf_desc, (vop_t *) vop_stdpathconf },
- { &vop_readdir_desc, (vop_t *) portal_readdir },
- { &vop_reclaim_desc, (vop_t *) portal_reclaim },
- { &vop_setattr_desc, (vop_t *) portal_setattr },
- { NULL, NULL }
+struct vop_vector portal_vnodeops = {
+ .vop_default = &default_vnodeops,
+ .vop_access = VOP_NULL,
+ .vop_getattr = portal_getattr,
+ .vop_lookup = portal_lookup,
+ .vop_open = portal_open,
+ .vop_pathconf = vop_stdpathconf,
+ .vop_readdir = portal_readdir,
+ .vop_reclaim = portal_reclaim,
+ .vop_setattr = portal_setattr,
};
-static struct vnodeopv_desc portal_vnodeop_opv_desc =
- { &portal_vnodeop_p, portal_vnodeop_entries };
-
-VNODEOP_SET(portal_vnodeop_opv_desc);
OpenPOWER on IntegriCloud