Introduce WILLMAKE for vnode operations which create a new vnode.
Insert a KASSERT along the return path of such operations to check that the operation set the vnode size.
This commit is contained in:
parent
17b8c7717a
commit
f5ba107ccd
|
@ -29,7 +29,7 @@ copyright="\
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
"
|
"
|
||||||
SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.43 2006/11/30 21:06:29 pooka Exp $'
|
SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.44 2007/07/22 21:26:53 pooka Exp $'
|
||||||
|
|
||||||
# Script to produce VFS front-end sugar.
|
# Script to produce VFS front-end sugar.
|
||||||
#
|
#
|
||||||
|
@ -93,6 +93,7 @@ awk_parser='
|
||||||
/^vop_/ {
|
/^vop_/ {
|
||||||
name=$1;
|
name=$1;
|
||||||
argc=0;
|
argc=0;
|
||||||
|
willmake=-1;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
# Last line of description
|
# Last line of description
|
||||||
|
@ -127,6 +128,12 @@ awk_parser='
|
||||||
i++;
|
i++;
|
||||||
} else
|
} else
|
||||||
willrele[argc] = 0;
|
willrele[argc] = 0;
|
||||||
|
|
||||||
|
if ($2 == "WILLMAKE") {
|
||||||
|
willmake=argc;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
argtype[argc] = $i; i++;
|
argtype[argc] = $i; i++;
|
||||||
while (i < NF) {
|
while (i < NF) {
|
||||||
argtype[argc] = argtype[argc]" "$i;
|
argtype[argc] = argtype[argc]" "$i;
|
||||||
|
@ -346,6 +353,7 @@ function doit() {
|
||||||
}
|
}
|
||||||
printf(")\n");
|
printf(")\n");
|
||||||
printf("{\n\tstruct %s_args a;\n", name);
|
printf("{\n\tstruct %s_args a;\n", name);
|
||||||
|
printf("\tint rv;\n");
|
||||||
printf("#ifdef VNODE_LOCKDEBUG\n");
|
printf("#ifdef VNODE_LOCKDEBUG\n");
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
if (lockstate[i] != -1)
|
if (lockstate[i] != -1)
|
||||||
|
@ -365,13 +373,23 @@ function doit() {
|
||||||
printf("#endif\n");
|
printf("#endif\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\treturn (VCALL(%s%s, VOFFSET(%s), &a));\n}\n",
|
printf("\n\trv = VCALL(%s%s, VOFFSET(%s), &a);\n",
|
||||||
argname[0], arg0special, name);
|
argname[0], arg0special, name);
|
||||||
|
if (willmake != -1) {
|
||||||
|
printf("#ifdef DIAGNOSTIC\n");
|
||||||
|
printf("\tif (rv == 0)\n" \
|
||||||
|
"\t\tKASSERT((*%s)->v_size != VSIZENOTSET\n" \
|
||||||
|
"\t\t && (*%s)->v_writesize != VSIZENOTSET);\n",
|
||||||
|
argname[willmake], argname[willmake]);
|
||||||
|
printf("#endif /* DIAGNOSTIC */\n");
|
||||||
|
}
|
||||||
|
printf("\treturn (rv);\n}\n");
|
||||||
}
|
}
|
||||||
BEGIN {
|
BEGIN {
|
||||||
printf("\n/* Special cases: */\n");
|
printf("\n/* Special cases: */\n");
|
||||||
# start from 1 (vop_default is at 0)
|
# start from 1 (vop_default is at 0)
|
||||||
argc=1;
|
argc=1;
|
||||||
|
willmake=-1;
|
||||||
argdir[0]="IN";
|
argdir[0]="IN";
|
||||||
argtype[0]="struct buf *";
|
argtype[0]="struct buf *";
|
||||||
argname[0]="bp";
|
argname[0]="bp";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: vnode_if.src,v 1.52 2007/04/09 14:58:28 gdt Exp $
|
# $NetBSD: vnode_if.src,v 1.53 2007/07/22 21:26:53 pooka Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1992, 1993
|
# Copyright (c) 1992, 1993
|
||||||
# The Regents of the University of California. All rights reserved.
|
# The Regents of the University of California. All rights reserved.
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
#
|
#
|
||||||
vop_lookup {
|
vop_lookup {
|
||||||
IN struct vnode *dvp;
|
IN struct vnode *dvp;
|
||||||
INOUT struct vnode **vpp;
|
INOUT WILLMAKE struct vnode **vpp;
|
||||||
IN struct componentname *cnp;
|
IN struct componentname *cnp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ vop_lookup {
|
||||||
#
|
#
|
||||||
vop_create {
|
vop_create {
|
||||||
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
||||||
OUT struct vnode **vpp;
|
OUT WILLMAKE struct vnode **vpp;
|
||||||
IN struct componentname *cnp;
|
IN struct componentname *cnp;
|
||||||
IN struct vattr *vap;
|
IN struct vattr *vap;
|
||||||
};
|
};
|
||||||
|
@ -107,7 +107,7 @@ vop_create {
|
||||||
#
|
#
|
||||||
vop_mknod {
|
vop_mknod {
|
||||||
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
||||||
OUT struct vnode **vpp;
|
OUT WILLMAKE struct vnode **vpp;
|
||||||
IN struct componentname *cnp;
|
IN struct componentname *cnp;
|
||||||
IN struct vattr *vap;
|
IN struct vattr *vap;
|
||||||
};
|
};
|
||||||
|
@ -316,7 +316,7 @@ vop_rename {
|
||||||
#
|
#
|
||||||
vop_mkdir {
|
vop_mkdir {
|
||||||
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
||||||
OUT struct vnode **vpp;
|
OUT WILLMAKE struct vnode **vpp;
|
||||||
IN struct componentname *cnp;
|
IN struct componentname *cnp;
|
||||||
IN struct vattr *vap;
|
IN struct vattr *vap;
|
||||||
};
|
};
|
||||||
|
@ -341,7 +341,7 @@ vop_rmdir {
|
||||||
#
|
#
|
||||||
vop_symlink {
|
vop_symlink {
|
||||||
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
IN LOCKED=YES WILLPUT struct vnode *dvp;
|
||||||
OUT struct vnode **vpp;
|
OUT WILLMAKE struct vnode **vpp;
|
||||||
IN struct componentname *cnp;
|
IN struct componentname *cnp;
|
||||||
IN struct vattr *vap;
|
IN struct vattr *vap;
|
||||||
IN char *target;
|
IN char *target;
|
||||||
|
|
Loading…
Reference in New Issue