aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2005-01-13 07:53:01 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2005-01-13 07:53:01 +0000
commit63f89abf4a49d64f983e3fed54e99633f0c70d57 (patch)
treee7e985f51392cbb38e54bd0ff0579b79648afa2c /sys/fs
parentd1426d7fc5538c2aa8b9f3abce557b27469a56c3 (diff)
downloadsrc-63f89abf4a49d64f983e3fed54e99633f0c70d57.tar.gz
src-63f89abf4a49d64f983e3fed54e99633f0c70d57.zip
Change the generated VOP_ macro implementations to improve type checking
and KASSERT coverage. After this check there is only one "nasty" cast in this code but there is a KASSERT to protect against the wrong argument structure behind that cast. Un-inlining the meat of VOP_FOO() saves 35kB of text segment on a typical kernel with no change in performance. We also now run the checking and tracing on VOP's which have been layered by nullfs, umapfs, deadfs or unionfs. Add new (non-inline) VOP_FOO_AP() functions which take a "struct foo_args" argument and does everything the VOP_FOO() macros used to do with checks and debugging code. Add KASSERT to VOP_FOO_AP() check for argument type being correct. Slim down VOP_FOO() inline functions to just stuff arguments into the struct foo_args and call VOP_FOO_AP(). Put function pointer to VOP_FOO_AP() into vop_foo_desc structure and make VCALL() use it instead of the current offsetoff() hack. Retire vcall() which implemented the offsetoff() Make deadfs and unionfs use VOP_FOO_AP() calls instead of VCALL(), we know which specific call we want already. Remove unneeded arguments to VCALL() in nullfs and umapfs bypass functions. Remove unused vdesc_offset and VOFFSET(). Generally improve style/readability of the generated code.
Notes
Notes: svn path=/head/; revision=140165
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/deadfs/dead_vnops.c4
-rw-r--r--sys/fs/nullfs/null_vnops.c2
-rw-r--r--sys/fs/umapfs/umap_vnops.c2
-rw-r--r--sys/fs/unionfs/union_vnops.c42
4 files changed, 25 insertions, 25 deletions
diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c
index 787e51055cdc..00f4015a640e 100644
--- a/sys/fs/deadfs/dead_vnops.c
+++ b/sys/fs/deadfs/dead_vnops.c
@@ -176,7 +176,7 @@ dead_ioctl(ap)
if (!chkvnlock(ap->a_vp))
return (ENOTTY);
/* XXX: Doesn't this just recurse back here ? */
- return (VCALL(ap->a_vp, VOFFSET(vop_ioctl), ap));
+ return (VOP_IOCTL_AP(ap));
}
@@ -203,7 +203,7 @@ dead_lock(ap)
}
if (!chkvnlock(vp))
return (0);
- return (VCALL(vp, VOFFSET(vop_lock), ap));
+ return (VOP_LOCK_AP(ap));
}
/*
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 349d00b4a821..7d32bc5c373a 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -296,7 +296,7 @@ null_bypass(ap)
* with the modified argument structure.
*/
if (vps_p[0] && *vps_p[0])
- error = VCALL(*(vps_p[0]), descp->vdesc_offset, ap);
+ error = VCALL(ap);
else {
printf("null_bypass: no map for %s\n", descp->vdesc_name);
error = EINVAL;
diff --git a/sys/fs/umapfs/umap_vnops.c b/sys/fs/umapfs/umap_vnops.c
index 010e291e65c5..c7803f0d98c7 100644
--- a/sys/fs/umapfs/umap_vnops.c
+++ b/sys/fs/umapfs/umap_vnops.c
@@ -197,7 +197,7 @@ umap_bypass(ap)
* Call the operation on the lower layer
* with the modified argument structure.
*/
- error = VCALL(*(vps_p[0]), descp->vdesc_offset, ap);
+ error = VCALL(ap);
/*
* Maintain the illusion of call-by-value
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 596adc942595..2dcfd2d8832c 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -829,7 +829,7 @@ union_close(ap)
vp = un->un_lowervp;
}
ap->a_vp = vp;
- return (VCALL(vp, VOFFSET(vop_close), ap));
+ return (VOP_CLOSE_AP(ap));
}
/*
@@ -872,7 +872,7 @@ union_access(ap)
if ((vp = union_lock_upper(un, td)) != NULLVP) {
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_access), ap);
+ error = VOP_ACCESS_AP(ap);
union_unlock_upper(vp, td);
return(error);
}
@@ -888,7 +888,7 @@ union_access(ap)
if ((un->un_vnode->v_mount->mnt_flag & MNT_RDONLY) == 0)
ap->a_mode &= ~VWRITE;
- error = VCALL(vp, VOFFSET(vop_access), ap);
+ error = VOP_ACCESS_AP(ap);
if (error == 0) {
struct union_mount *um;
@@ -896,7 +896,7 @@ union_access(ap)
if (um->um_op == UNMNT_BELOW) {
ap->a_cred = um->um_cred;
- error = VCALL(vp, VOFFSET(vop_access), ap);
+ error = VOP_ACCESS_AP(ap);
}
}
VOP_UNLOCK(vp, 0, td);
@@ -1119,7 +1119,7 @@ union_lease(ap)
struct vnode *ovp = OTHERVP(ap->a_vp);
ap->a_vp = ovp;
- return (VCALL(ovp, VOFFSET(vop_lease), ap));
+ return (VOP_LEASE_AP(ap));
}
static int
@@ -1136,7 +1136,7 @@ union_ioctl(ap)
struct vnode *ovp = OTHERVP(ap->a_vp);
ap->a_vp = ovp;
- return (VCALL(ovp, VOFFSET(vop_ioctl), ap));
+ return (VOP_IOCTL_AP(ap));
}
static int
@@ -1151,7 +1151,7 @@ union_poll(ap)
struct vnode *ovp = OTHERVP(ap->a_vp);
ap->a_vp = ovp;
- return (VCALL(ovp, VOFFSET(vop_poll), ap));
+ return (VOP_POLL_AP(ap));
}
static int
@@ -1594,7 +1594,7 @@ union_readdir(ap)
if ((uvp = union_lock_upper(un, td)) != NULLVP) {
ap->a_vp = uvp;
- error = VCALL(uvp, VOFFSET(vop_readdir), ap);
+ error = VOP_READDIR_AP(ap);
union_unlock_upper(uvp, td);
}
return(error);
@@ -1618,7 +1618,7 @@ union_readlink(ap)
KASSERT(vp != NULL, ("union_readlink: backing vnode missing!"));
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_readlink), ap);
+ error = VOP_READLINK_AP(ap);
union_unlock_other(vp, td);
return (error);
@@ -1785,7 +1785,7 @@ union_pathconf(ap)
KASSERT(vp != NULL, ("union_pathconf: backing vnode missing!"));
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_pathconf), ap);
+ error = VOP_PATHCONF_AP(ap);
union_unlock_other(vp, td);
return (error);
@@ -1804,7 +1804,7 @@ union_advlock(ap)
register struct vnode *ovp = OTHERVP(ap->a_vp);
ap->a_vp = ovp;
- return (VCALL(ovp, VOFFSET(vop_advlock), ap));
+ return (VOP_ADVLOCK_AP(ap));
}
@@ -1851,7 +1851,7 @@ union_getacl(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_getacl), ap);
+ error = VOP_GETACL_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -1873,7 +1873,7 @@ union_setacl(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_setacl), ap);
+ error = VOP_SETACL_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -1892,7 +1892,7 @@ union_aclcheck(ap)
struct vnode *ovp = OTHERVP(ap->a_vp);
ap->a_vp = ovp;
- return (VCALL(ovp, VOFFSET(vop_aclcheck), ap));
+ return (VOP_ACLCHECK_AP(ap));
}
static int
@@ -1910,7 +1910,7 @@ union_closeextattr(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_closeextattr), ap);
+ error = VOP_CLOSEEXTATTR_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -1934,7 +1934,7 @@ union_getextattr(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_getextattr), ap);
+ error = VOP_GETEXTATTR_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -1957,7 +1957,7 @@ union_listextattr(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_listextattr), ap);
+ error = VOP_LISTEXTATTR_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -1977,7 +1977,7 @@ union_openextattr(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_openextattr), ap);
+ error = VOP_OPENEXTATTR_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -1999,7 +1999,7 @@ union_deleteextattr(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_deleteextattr), ap);
+ error = VOP_DELETEEXTATTR_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -2022,7 +2022,7 @@ union_setextattr(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_setextattr), ap);
+ error = VOP_SETEXTATTR_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);
@@ -2043,7 +2043,7 @@ union_setlabel(ap)
vp = union_lock_other(un, ap->a_td);
ap->a_vp = vp;
- error = VCALL(vp, VOFFSET(vop_setlabel), ap);
+ error = VOP_SETLABEL_AP(ap);
union_unlock_other(vp, ap->a_td);
return (error);