Home | History | Annotate | Line # | Download | only in kern
vnode_if.sh revision 1.48.10.1
      1        1.1   mycroft #!/bin/sh -
      2        1.9       cgd copyright="\
      3        1.2       gwr /*
      4       1.16      fvdl  * Copyright (c) 1992, 1993, 1994, 1995
      5        1.2       gwr  *	The Regents of the University of California.  All rights reserved.
      6        1.2       gwr  *
      7        1.2       gwr  * Redistribution and use in source and binary forms, with or without
      8        1.2       gwr  * modification, are permitted provided that the following conditions
      9        1.2       gwr  * are met:
     10        1.2       gwr  * 1. Redistributions of source code must retain the above copyright
     11        1.2       gwr  *    notice, this list of conditions and the following disclaimer.
     12        1.2       gwr  * 2. Redistributions in binary form must reproduce the above copyright
     13        1.2       gwr  *    notice, this list of conditions and the following disclaimer in the
     14        1.2       gwr  *    documentation and/or other materials provided with the distribution.
     15       1.33       agc  * 3. Neither the name of the University nor the names of its contributors
     16        1.2       gwr  *    may be used to endorse or promote products derived from this software
     17        1.2       gwr  *    without specific prior written permission.
     18        1.2       gwr  *
     19       1.18  christos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS \`\`AS IS'' AND
     20        1.2       gwr  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21        1.2       gwr  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22        1.2       gwr  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23        1.2       gwr  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24        1.2       gwr  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25        1.2       gwr  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26        1.2       gwr  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27        1.2       gwr  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28        1.2       gwr  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29        1.2       gwr  * SUCH DAMAGE.
     30        1.2       gwr  */
     31        1.9       cgd "
     32  1.48.10.1      yamt SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.48.10.1 2009/05/04 08:13:50 yamt Exp $'
     33        1.1   mycroft 
     34        1.1   mycroft # Script to produce VFS front-end sugar.
     35        1.1   mycroft #
     36        1.1   mycroft # usage: vnode_if.sh srcfile
     37        1.1   mycroft #	(where srcfile is currently /sys/kern/vnode_if.src)
     38        1.1   mycroft #
     39        1.1   mycroft 
     40        1.1   mycroft if [ $# -ne 1 ] ; then
     41        1.1   mycroft 	echo 'usage: vnode_if.sh srcfile'
     42        1.1   mycroft 	exit 1
     43        1.1   mycroft fi
     44        1.2       gwr 
     45        1.9       cgd # Name and revision of the source file.
     46        1.2       gwr src=$1
     47        1.9       cgd SRC_ID=`head -1 $src | sed -e 's/.*\$\(.*\)\$.*/\1/'`
     48        1.1   mycroft 
     49        1.1   mycroft # Names of the created files.
     50        1.2       gwr out_c=vnode_if.c
     51  1.48.10.1      yamt out_rumpc=../rump/librump/rumpvfs/rumpvnode_if.c
     52        1.9       cgd out_h=../sys/vnode_if.h
     53  1.48.10.1      yamt out_rumph=../rump/include/rump/rumpvnode_if.h
     54        1.2       gwr 
     55        1.2       gwr # Awk program (must support nawk extensions)
     56        1.2       gwr # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
     57        1.2       gwr awk=${AWK:-awk}
     58        1.2       gwr 
     59        1.2       gwr # Does this awk have a "toupper" function? (i.e. is it GNU awk)
     60        1.2       gwr isgawk=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null`
     61        1.2       gwr 
     62        1.2       gwr # If this awk does not define "toupper" then define our own.
     63        1.2       gwr if [ "$isgawk" = TRUE ] ; then
     64        1.2       gwr 	# GNU awk provides it.
     65        1.2       gwr 	toupper=
     66        1.2       gwr else
     67        1.2       gwr 	# Provide our own toupper()
     68        1.2       gwr 	toupper='
     69        1.2       gwr function toupper(str) {
     70        1.2       gwr 	_toupper_cmd = "echo "str" |tr a-z A-Z"
     71        1.2       gwr 	_toupper_cmd | getline _toupper_str;
     72        1.2       gwr 	close(_toupper_cmd);
     73        1.2       gwr 	return _toupper_str;
     74        1.2       gwr }'
     75        1.2       gwr fi
     76        1.1   mycroft 
     77        1.2       gwr #
     78        1.2       gwr # This is the common part of all awk programs that read $src
     79        1.2       gwr # This parses the input for one function into the arrays:
     80        1.2       gwr #	argdir, argtype, argname, willrele
     81        1.2       gwr # and calls "doit()" to generate output for the function.
     82        1.2       gwr #
     83        1.2       gwr # Input to this parser is pre-processed slightly by sed
     84        1.2       gwr # so this awk parser doesn't have to work so hard.  The
     85        1.2       gwr # changes done by the sed pre-processing step are:
     86        1.2       gwr #	insert a space beween * and pointer name
     87        1.2       gwr #	replace semicolons with spaces
     88        1.2       gwr #
     89        1.2       gwr sed_prep='s:\*\([^\*/]\):\* \1:g
     90        1.2       gwr s/;/ /'
     91        1.2       gwr awk_parser='
     92        1.2       gwr # Comment line
     93        1.2       gwr /^#/	{ next; }
     94        1.2       gwr # First line of description
     95        1.2       gwr /^vop_/	{
     96  1.48.10.1      yamt 	name=rump $1;
     97        1.2       gwr 	argc=0;
     98       1.44     pooka 	willmake=-1;
     99        1.2       gwr 	next;
    100        1.2       gwr }
    101        1.2       gwr # Last line of description
    102        1.2       gwr /^}/	{
    103        1.2       gwr 	doit();
    104        1.2       gwr 	next;
    105        1.2       gwr }
    106        1.2       gwr # Middle lines of description
    107        1.2       gwr {
    108        1.2       gwr 	argdir[argc] = $1; i=2;
    109       1.35   thorpej 
    110       1.35   thorpej 	if ($2 == "LOCKED=YES") {
    111       1.35   thorpej 		lockstate[argc] = 1;
    112       1.35   thorpej 		i++;
    113       1.35   thorpej 	} else if ($2 == "LOCKED=NO") {
    114       1.35   thorpej 		lockstate[argc] = 0;
    115       1.35   thorpej 		i++;
    116       1.35   thorpej 	} else
    117       1.35   thorpej 		lockstate[argc] = -1;
    118       1.35   thorpej 
    119       1.35   thorpej 	if ($2 == "WILLRELE" ||
    120       1.35   thorpej 	    $3 == "WILLRELE") {
    121        1.2       gwr 		willrele[argc] = 1;
    122        1.2       gwr 		i++;
    123       1.35   thorpej 	} else if ($2 == "WILLUNLOCK" ||
    124       1.35   thorpej 		   $3 == "WILLUNLOCK") {
    125       1.19  wrstuden 		willrele[argc] = 2;
    126       1.19  wrstuden 		i++;
    127       1.35   thorpej 	} else if ($2 == "WILLPUT" ||
    128       1.35   thorpej 		   $3 == "WILLPUT") {
    129       1.19  wrstuden 		willrele[argc] = 3;
    130       1.19  wrstuden 		i++;
    131        1.2       gwr 	} else
    132        1.2       gwr 		willrele[argc] = 0;
    133       1.44     pooka 
    134       1.44     pooka 	if ($2 == "WILLMAKE") {
    135       1.44     pooka 		willmake=argc;
    136       1.44     pooka 		i++;
    137       1.44     pooka 	}
    138       1.44     pooka 
    139  1.48.10.1      yamt 	# XXX: replace non-portable types for rump.  We should really
    140  1.48.10.1      yamt 	# nuke the types from the kernel, but that is a battle for
    141  1.48.10.1      yamt 	# another day.
    142  1.48.10.1      yamt 	at = $i;
    143  1.48.10.1      yamt 	if (length(rump) != 0) {
    144  1.48.10.1      yamt 		if (at == "vm_prot_t")
    145  1.48.10.1      yamt 			at = "int";
    146  1.48.10.1      yamt 		if (at == "voff_t")
    147  1.48.10.1      yamt 			at = "off_t";
    148  1.48.10.1      yamt 	}
    149  1.48.10.1      yamt 	argtype[argc] = at;
    150  1.48.10.1      yamt 	i++;
    151        1.2       gwr 	while (i < NF) {
    152        1.7       cgd 		argtype[argc] = argtype[argc]" "$i;
    153        1.2       gwr 		i++;
    154        1.2       gwr 	}
    155        1.2       gwr 	argname[argc] = $i;
    156        1.2       gwr 	argc++;
    157        1.2       gwr 	next;
    158        1.2       gwr }
    159        1.2       gwr '
    160        1.1   mycroft 
    161       1.15   thorpej # This is put before the copyright on each generated file.
    162        1.9       cgd warning="\
    163       1.15   thorpej /*	@NetBSD@	*/
    164       1.15   thorpej 
    165        1.1   mycroft /*
    166       1.37     perry  * Warning: DO NOT EDIT! This file is automatically generated!
    167        1.2       gwr  * (Modifications made here may easily be lost!)
    168        1.1   mycroft  *
    169        1.9       cgd  * Created from the file:
    170        1.9       cgd  *	${SRC_ID}
    171        1.9       cgd  * by the script:
    172        1.2       gwr  *	${SCRIPT_ID}
    173        1.1   mycroft  */
    174       1.36     perry "
    175        1.2       gwr 
    176        1.7       cgd # This is to satisfy McKusick (get rid of evil spaces 8^)
    177        1.7       cgd anal_retentive='s:\([^/]\*\) :\1:g'
    178        1.2       gwr 
    179  1.48.10.1      yamt do_hfile () {
    180        1.2       gwr #
    181        1.2       gwr # Redirect stdout to the H file.
    182        1.2       gwr #
    183  1.48.10.1      yamt echo "$0: Creating $1" 1>&2
    184  1.48.10.1      yamt exec > $1
    185  1.48.10.1      yamt rump=$2
    186        1.1   mycroft 
    187        1.2       gwr # Begin stuff
    188  1.48.10.1      yamt if [ -z "${rump}" ]; then
    189  1.48.10.1      yamt 	SYS='SYS_'
    190  1.48.10.1      yamt else
    191  1.48.10.1      yamt 	SYS='RUMP_RUMP'
    192  1.48.10.1      yamt fi
    193       1.38     perry echo -n "$warning" | sed -e 's/\$//g;s/@/\$/g;s/ $//'
    194        1.9       cgd echo ""
    195        1.9       cgd echo -n "$copyright"
    196       1.10     mikel echo ''
    197  1.48.10.1      yamt echo "#ifndef _${SYS}VNODE_IF_H_"
    198  1.48.10.1      yamt echo "#define _${SYS}VNODE_IF_H_"
    199       1.21   thorpej echo ''
    200       1.35   thorpej echo '#ifdef _KERNEL_OPT'
    201       1.35   thorpej echo '#include "opt_vnode_lockdebug.h"'
    202       1.35   thorpej echo '#endif /* _KERNEL_OPT */'
    203  1.48.10.1      yamt echo "
    204  1.48.10.1      yamt extern const struct vnodeop_desc ${rump}vop_default_desc;
    205  1.48.10.1      yamt "
    206        1.1   mycroft 
    207        1.2       gwr # Body stuff
    208        1.2       gwr # This awk program needs toupper() so define it if necessary.
    209  1.48.10.1      yamt sed -e "$sed_prep" $src | $awk -v rump=${rump} "$toupper"'
    210        1.2       gwr function doit() {
    211        1.2       gwr 	# Declare arg struct, descriptor.
    212       1.43     pooka 	printf("\n#define %s_DESCOFFSET %d\n", toupper(name), vop_offset++);
    213       1.43     pooka 	printf("struct %s_args {\n", name);
    214       1.28  jdolecek 	printf("\tconst struct vnodeop_desc * a_desc;\n");
    215        1.2       gwr 	for (i=0; i<argc; i++) {
    216        1.7       cgd 		printf("\t%s a_%s;\n", argtype[i], argname[i]);
    217        1.1   mycroft 	}
    218        1.2       gwr 	printf("};\n");
    219       1.28  jdolecek 	printf("extern const struct vnodeop_desc %s_desc;\n", name);
    220        1.8    chopps 	# Prototype it.
    221       1.20   thorpej 	protoarg = sprintf("int %s(", toupper(name));
    222        1.8    chopps 	protolen = length(protoarg);
    223        1.8    chopps 	printf("%s", protoarg);
    224        1.8    chopps 	for (i=0; i<argc; i++) {
    225        1.8    chopps 		protoarg = sprintf("%s", argtype[i]);
    226        1.8    chopps 		if (i < (argc-1)) protoarg = (protoarg ", ");
    227        1.8    chopps 		arglen = length(protoarg);
    228        1.8    chopps 		if ((protolen + arglen) > 77) {
    229        1.8    chopps 			protoarg = ("\n    " protoarg);
    230        1.8    chopps 			arglen += 4;
    231        1.8    chopps 			protolen = 0;
    232        1.8    chopps 		}
    233        1.8    chopps 		printf("%s", protoarg);
    234        1.8    chopps 		protolen += arglen;
    235        1.8    chopps 	}
    236       1.39   thorpej 	printf(");\n");
    237        1.2       gwr }
    238        1.2       gwr BEGIN	{
    239        1.2       gwr 	arg0special="";
    240       1.43     pooka 	vop_offset = 1; # start at 1, to count the 'default' op
    241       1.43     pooka 
    242  1.48.10.1      yamt 	printf("\n/* Special cases: */\nstruct buf;\n");
    243       1.48        ad 	printf("#ifndef _KERNEL\n#include <stdbool.h>\n#endif\n\n");
    244       1.48        ad 
    245        1.2       gwr 	argc=1;
    246        1.2       gwr 	argtype[0]="struct buf *";
    247        1.2       gwr 	argname[0]="bp";
    248       1.35   thorpej 	lockstate[0] = -1;
    249        1.2       gwr 	arg0special="->b_vp";
    250  1.48.10.1      yamt 	name=rump "vop_bwrite";
    251        1.2       gwr 	doit();
    252       1.43     pooka 	printf("/* End of special cases */\n");
    253       1.43     pooka }
    254       1.43     pooka END	{
    255       1.43     pooka 	printf("\n#define VNODE_OPS_COUNT\t%d\n", vop_offset);
    256        1.2       gwr }
    257        1.7       cgd '"$awk_parser" | sed -e "$anal_retentive"
    258        1.1   mycroft 
    259        1.2       gwr # End stuff
    260        1.2       gwr echo '
    261        1.2       gwr /* End of special cases. */'
    262       1.10     mikel echo ''
    263  1.48.10.1      yamt echo "#endif /* !_${SYS}VNODE_IF_H_ */"
    264  1.48.10.1      yamt }
    265  1.48.10.1      yamt do_hfile $out_h ''
    266  1.48.10.1      yamt do_hfile $out_rumph 'rump_'
    267        1.1   mycroft 
    268  1.48.10.1      yamt do_cfile () {
    269        1.2       gwr #
    270        1.2       gwr # Redirect stdout to the C file.
    271        1.2       gwr #
    272  1.48.10.1      yamt echo "$0: Creating $1" 1>&2
    273  1.48.10.1      yamt exec > $1
    274  1.48.10.1      yamt rump=$2
    275        1.1   mycroft 
    276        1.2       gwr # Begin stuff
    277       1.38     perry echo -n "$warning" | sed -e 's/\$//g;s/@/\$/g;s/ $//'
    278        1.9       cgd echo ""
    279        1.9       cgd echo -n "$copyright"
    280       1.30     lukem echo "
    281       1.30     lukem #include <sys/cdefs.h>
    282       1.30     lukem __KERNEL_RCSID(0, \"\$NetBSD\$\");
    283       1.30     lukem "
    284       1.30     lukem 
    285       1.21   thorpej echo '
    286  1.48.10.1      yamt #include "opt_vnode_lockdebug.h"'
    287        1.2       gwr echo '
    288        1.1   mycroft #include <sys/param.h>
    289        1.1   mycroft #include <sys/mount.h>
    290       1.20   thorpej #include <sys/buf.h>
    291        1.1   mycroft #include <sys/vnode.h>
    292  1.48.10.1      yamt #include <sys/lock.h>'
    293  1.48.10.1      yamt [ ! -z "${rump}" ] && echo '#include <rump/rumpvnode_if.h>'
    294        1.1   mycroft 
    295  1.48.10.1      yamt echo "
    296  1.48.10.1      yamt const struct vnodeop_desc ${rump}vop_default_desc = {"
    297  1.48.10.1      yamt echo '	0,
    298        1.1   mycroft 	"default",
    299        1.1   mycroft 	0,
    300        1.1   mycroft 	NULL,
    301        1.1   mycroft 	VDESC_NO_OFFSET,
    302        1.1   mycroft 	VDESC_NO_OFFSET,
    303        1.1   mycroft 	VDESC_NO_OFFSET,
    304        1.1   mycroft 	NULL,
    305        1.1   mycroft };
    306        1.2       gwr '
    307        1.1   mycroft 
    308        1.2       gwr # Body stuff
    309  1.48.10.1      yamt sed -e "$sed_prep" $src | $awk -v rump=${rump} '
    310        1.2       gwr function do_offset(typematch) {
    311        1.2       gwr 	for (i=0; i<argc; i++) {
    312        1.2       gwr 		if (argtype[i] == typematch) {
    313        1.2       gwr 			printf("\tVOPARG_OFFSETOF(struct %s_args, a_%s),\n",
    314        1.2       gwr 				name, argname[i]);
    315        1.2       gwr 			return i;
    316        1.2       gwr 		};
    317        1.2       gwr 	};
    318        1.2       gwr 	print "\tVDESC_NO_OFFSET,";
    319        1.2       gwr 	return -1;
    320        1.2       gwr }
    321        1.1   mycroft 
    322        1.2       gwr function doit() {
    323        1.2       gwr 	# Define offsets array
    324       1.26  jdolecek 	printf("\nconst int %s_vp_offsets[] = {\n", name);
    325        1.2       gwr 	for (i=0; i<argc; i++) {
    326        1.2       gwr 		if (argtype[i] == "struct vnode *") {
    327        1.2       gwr 			printf ("\tVOPARG_OFFSETOF(struct %s_args,a_%s),\n",
    328        1.2       gwr 				name, argname[i]);
    329        1.2       gwr 		}
    330        1.1   mycroft 	}
    331        1.2       gwr 	print "\tVDESC_NO_OFFSET";
    332        1.2       gwr 	print "};";
    333        1.2       gwr 	# Define F_desc
    334       1.28  jdolecek 	printf("const struct vnodeop_desc %s_desc = {\n", name);
    335        1.2       gwr 	# offset
    336       1.43     pooka 	printf ("\t%s_DESCOFFSET,\n", toupper(name));
    337        1.2       gwr 	# printable name
    338        1.2       gwr 	printf ("\t\"%s\",\n", name);
    339        1.2       gwr 	# flags
    340        1.2       gwr 	printf("\t0");
    341        1.2       gwr 	vpnum = 0;
    342        1.2       gwr 	for (i=0; i<argc; i++) {
    343        1.2       gwr 		if (willrele[i]) {
    344       1.19  wrstuden 			if (willrele[i] == 2) {
    345       1.19  wrstuden 				word = "UNLOCK";
    346       1.19  wrstuden 			} else if (willrele[i] == 3) {
    347       1.19  wrstuden 				word = "PUT";
    348       1.19  wrstuden 			} else {
    349       1.19  wrstuden 				word = "RELE";
    350       1.19  wrstuden 			}
    351        1.2       gwr 			if (argdir[i] ~ /OUT/) {
    352       1.19  wrstuden 				printf(" | VDESC_VPP_WILL%s", word);
    353        1.1   mycroft 			} else {
    354       1.19  wrstuden 				printf(" | VDESC_VP%s_WILL%s", vpnum, word);
    355        1.1   mycroft 			};
    356        1.2       gwr 			vpnum++;
    357        1.2       gwr 		}
    358        1.1   mycroft 	}
    359        1.2       gwr 	print ",";
    360        1.2       gwr 	# vp offsets
    361        1.2       gwr 	printf ("\t%s_vp_offsets,\n", name);
    362        1.2       gwr 	# vpp (if any)
    363        1.2       gwr 	do_offset("struct vnode **");
    364        1.2       gwr 	# cred (if any)
    365       1.42      elad 	do_offset("kauth_cred_t");
    366        1.2       gwr 	# componentname
    367        1.2       gwr 	do_offset("struct componentname *");
    368        1.2       gwr 	# transport layer information
    369        1.2       gwr 	printf ("\tNULL,\n};\n");
    370       1.20   thorpej 
    371       1.20   thorpej 	# Define function.
    372       1.20   thorpej 	printf("int\n%s(", toupper(name));
    373       1.20   thorpej 	for (i=0; i<argc; i++) {
    374       1.40   thorpej 		printf("%s %s", argtype[i], argname[i]);
    375       1.40   thorpej 		if (i < (argc-1)) printf(",\n    ");
    376       1.20   thorpej 	}
    377       1.20   thorpej 	printf(")\n");
    378       1.46        ad 	printf("{\n\tint error;\n\tbool mpsafe;\n\tstruct %s_args a;\n", name);
    379       1.35   thorpej 	printf("#ifdef VNODE_LOCKDEBUG\n");
    380       1.35   thorpej 	for (i=0; i<argc; i++) {
    381       1.35   thorpej 		if (lockstate[i] != -1)
    382       1.35   thorpej 			printf("\tint islocked_%s;\n", argname[i]);
    383       1.35   thorpej 	}
    384       1.35   thorpej 	printf("#endif\n");
    385       1.20   thorpej 	printf("\ta.a_desc = VDESC(%s);\n", name);
    386       1.20   thorpej 	for (i=0; i<argc; i++) {
    387       1.20   thorpej 		printf("\ta.a_%s = %s;\n", argname[i], argname[i]);
    388       1.35   thorpej 		if (lockstate[i] != -1) {
    389       1.35   thorpej 			printf("#ifdef VNODE_LOCKDEBUG\n");
    390       1.45        ad 			printf("\tislocked_%s = (%s->v_vflag & VV_LOCKSWORK) ? (VOP_ISLOCKED(%s) == LK_EXCLUSIVE) : %d;\n",
    391       1.35   thorpej 			    argname[i], argname[i], argname[i], lockstate[i]);
    392       1.35   thorpej 			printf("\tif (islocked_%s != %d)\n", argname[i],
    393       1.35   thorpej 			    lockstate[i]);
    394       1.35   thorpej 			printf("\t\tpanic(\"%s: %s: locked %%d, expected %%d\", islocked_%s, %d);\n", name, argname[i], argname[i], lockstate[i]);
    395       1.35   thorpej 			printf("#endif\n");
    396       1.35   thorpej 		}
    397       1.20   thorpej 	}
    398       1.46        ad 	printf("\tmpsafe = (%s%s->v_vflag & VV_MPSAFE);\n", argname[0], arg0special);
    399       1.46        ad 	printf("\tif (!mpsafe) { KERNEL_LOCK(1, curlwp); }\n");
    400       1.46        ad 	printf("\terror = (VCALL(%s%s, VOFFSET(%s), &a));\n",
    401       1.20   thorpej 		argname[0], arg0special, name);
    402       1.46        ad 	printf("\tif (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }\n");
    403       1.44     pooka 	if (willmake != -1) {
    404       1.44     pooka 		printf("#ifdef DIAGNOSTIC\n");
    405       1.46        ad 		printf("\tif (error == 0)\n"				\
    406       1.44     pooka 		    "\t\tKASSERT((*%s)->v_size != VSIZENOTSET\n"	\
    407       1.44     pooka 		    "\t\t    && (*%s)->v_writesize != VSIZENOTSET);\n",
    408       1.44     pooka 		    argname[willmake], argname[willmake]);
    409       1.44     pooka 		printf("#endif /* DIAGNOSTIC */\n");
    410       1.44     pooka 	}
    411       1.46        ad 	printf("\treturn error;\n}\n");
    412       1.20   thorpej }
    413       1.20   thorpej BEGIN	{
    414        1.2       gwr 	printf("\n/* Special cases: */\n");
    415       1.28  jdolecek 	# start from 1 (vop_default is at 0)
    416        1.2       gwr 	argc=1;
    417       1.44     pooka 	willmake=-1;
    418        1.2       gwr 	argdir[0]="IN";
    419        1.2       gwr 	argtype[0]="struct buf *";
    420        1.2       gwr 	argname[0]="bp";
    421       1.35   thorpej 	lockstate[0] = -1;
    422       1.20   thorpej 	arg0special="->b_vp";
    423        1.2       gwr 	willrele[0]=0;
    424  1.48.10.1      yamt 	name=rump "vop_bwrite";
    425        1.2       gwr 	doit();
    426       1.28  jdolecek 	printf("\n/* End of special cases */\n");
    427       1.28  jdolecek 
    428       1.28  jdolecek 	arg0special="";
    429        1.1   mycroft }
    430        1.7       cgd '"$awk_parser" | sed -e "$anal_retentive"
    431        1.1   mycroft 
    432        1.2       gwr # End stuff
    433        1.2       gwr echo '
    434        1.2       gwr /* End of special cases. */'
    435        1.1   mycroft 
    436        1.2       gwr # Add the vfs_op_descs array to the C file.
    437        1.2       gwr # Begin stuff
    438  1.48.10.1      yamt echo "
    439  1.48.10.1      yamt const struct vnodeop_desc * const ${rump}vfs_op_descs[] = {
    440  1.48.10.1      yamt 	&${rump}vop_default_desc,	/* MUST BE FIRST */
    441  1.48.10.1      yamt 	&${rump}vop_bwrite_desc,	/* XXX: SPECIAL CASE */
    442  1.48.10.1      yamt "
    443        1.2       gwr 
    444        1.2       gwr # Body stuff
    445  1.48.10.1      yamt sed -e "$sed_prep" $src | $awk -v rump=${rump} '
    446        1.2       gwr function doit() {
    447        1.2       gwr 	printf("\t&%s_desc,\n", name);
    448        1.1   mycroft }
    449        1.2       gwr '"$awk_parser"
    450        1.1   mycroft 
    451        1.2       gwr # End stuff
    452        1.2       gwr echo '	NULL
    453        1.1   mycroft };
    454        1.2       gwr '
    455  1.48.10.1      yamt }
    456  1.48.10.1      yamt do_cfile $out_c ''
    457  1.48.10.1      yamt do_cfile $out_rumpc 'rump_'
    458        1.1   mycroft 
    459        1.2       gwr exit 0
    460        1.1   mycroft 
    461        1.2       gwr # Local Variables:
    462        1.2       gwr # tab-width: 4
    463        1.2       gwr # End:
    464