Home | History | Annotate | Line # | Download | only in kern
vnode_if.sh revision 1.1
      1  1.1  mycroft #!/bin/sh -
      2  1.1  mycroft #
      3  1.1  mycroft # Copyright (c) 1992, 1993
      4  1.1  mycroft #	The Regents of the University of California.  All rights reserved.
      5  1.1  mycroft #
      6  1.1  mycroft # Redistribution and use in source and binary forms, with or without
      7  1.1  mycroft # modification, are permitted provided that the following conditions
      8  1.1  mycroft # are met:
      9  1.1  mycroft # 1. Redistributions of source code must retain the above copyright
     10  1.1  mycroft #    notice, this list of conditions and the following disclaimer.
     11  1.1  mycroft # 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  mycroft #    notice, this list of conditions and the following disclaimer in the
     13  1.1  mycroft #    documentation and/or other materials provided with the distribution.
     14  1.1  mycroft # 3. All advertising materials mentioning features or use of this software
     15  1.1  mycroft #    must display the following acknowledgement:
     16  1.1  mycroft #	This product includes software developed by the University of
     17  1.1  mycroft #	California, Berkeley and its contributors.
     18  1.1  mycroft # 4. Neither the name of the University nor the names of its contributors
     19  1.1  mycroft #    may be used to endorse or promote products derived from this software
     20  1.1  mycroft #    without specific prior written permission.
     21  1.1  mycroft #
     22  1.1  mycroft # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  mycroft # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  mycroft # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  mycroft # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  mycroft # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  mycroft # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  mycroft # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  mycroft # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  mycroft # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  mycroft # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  mycroft # SUCH DAMAGE.
     33  1.1  mycroft #
     34  1.1  mycroft #	from: @(#)vnode_if.sh	8.1 (Berkeley) 6/10/93
     35  1.1  mycroft #	$Id: vnode_if.sh,v 1.1 1994/06/08 11:29:01 mycroft Exp $
     36  1.1  mycroft #
     37  1.1  mycroft 
     38  1.1  mycroft # Script to produce VFS front-end sugar.
     39  1.1  mycroft #
     40  1.1  mycroft # usage: vnode_if.sh srcfile
     41  1.1  mycroft #	(where srcfile is currently /sys/kern/vnode_if.src)
     42  1.1  mycroft #
     43  1.1  mycroft # These awk scripts are not particularly well written, specifically they
     44  1.1  mycroft # don't use arrays well and figure out the same information repeatedly.
     45  1.1  mycroft # Please rewrite them if you actually understand how to use awk.  Note,
     46  1.1  mycroft # they use nawk extensions and gawk's toupper.
     47  1.1  mycroft 
     48  1.1  mycroft if [ $# -ne 1 ] ; then
     49  1.1  mycroft 	echo 'usage: vnode_if.sh srcfile'
     50  1.1  mycroft 	exit 1
     51  1.1  mycroft fi
     52  1.1  mycroft 
     53  1.1  mycroft # Name of the source file.
     54  1.1  mycroft SRC=$1
     55  1.1  mycroft 
     56  1.1  mycroft # Names of the created files.
     57  1.1  mycroft CFILE=vnode_if.c
     58  1.1  mycroft HEADER=vnode_if.h
     59  1.1  mycroft 
     60  1.1  mycroft # Awk program (must support nawk extensions and gawk's "toupper")
     61  1.1  mycroft # Use "awk" at Berkeley, "gawk" elsewhere.
     62  1.1  mycroft AWK=awk
     63  1.1  mycroft 
     64  1.1  mycroft # Print out header information for vnode_if.h.
     65  1.1  mycroft cat << END_OF_LEADING_COMMENT > $HEADER
     66  1.1  mycroft /*
     67  1.1  mycroft  * This file is produced automatically.
     68  1.1  mycroft  * Do not modify anything in here by hand.
     69  1.1  mycroft  *
     70  1.1  mycroft  * Created from @(#)vnode_if.sh	8.1 (Berkeley) 6/10/93
     71  1.1  mycroft  */
     72  1.1  mycroft 
     73  1.1  mycroft extern struct vnodeop_desc vop_default_desc;
     74  1.1  mycroft END_OF_LEADING_COMMENT
     75  1.1  mycroft 
     76  1.1  mycroft # Awk script to take vnode_if.src and turn it into vnode_if.h.
     77  1.1  mycroft $AWK '
     78  1.1  mycroft 	NF == 0 || $0 ~ "^#" {
     79  1.1  mycroft 		next;
     80  1.1  mycroft 	}
     81  1.1  mycroft 	{
     82  1.1  mycroft 		# Get the function name.
     83  1.1  mycroft 		name = $1;
     84  1.1  mycroft 		uname = toupper(name);
     85  1.1  mycroft 
     86  1.1  mycroft 		# Get the function arguments.
     87  1.1  mycroft 		for (c1 = 0;; ++c1) {
     88  1.1  mycroft 			if (getline <= 0)
     89  1.1  mycroft 				exit
     90  1.1  mycroft 			if ($0 ~ "^};")
     91  1.1  mycroft 				break;
     92  1.1  mycroft 			a[c1] = $0;
     93  1.1  mycroft 		}
     94  1.1  mycroft 
     95  1.1  mycroft 		# Print out the vop_F_args structure.
     96  1.1  mycroft 		printf("struct %s_args {\n\tstruct vnodeop_desc *a_desc;\n",
     97  1.1  mycroft 		    name);
     98  1.1  mycroft 		for (c2 = 0; c2 < c1; ++c2) {
     99  1.1  mycroft 			c3 = split(a[c2], t);
    100  1.1  mycroft 			printf("\t");
    101  1.1  mycroft 			if (t[2] ~ "WILLRELE")
    102  1.1  mycroft 				c4 = 3;
    103  1.1  mycroft 			else 
    104  1.1  mycroft 				c4 = 2;
    105  1.1  mycroft 			for (; c4 < c3; ++c4)
    106  1.1  mycroft 				printf("%s ", t[c4]);
    107  1.1  mycroft 			beg = match(t[c3], "[^*]");
    108  1.1  mycroft 			printf("%sa_%s\n",
    109  1.1  mycroft 			    substr(t[c4], 0, beg - 1), substr(t[c4], beg));
    110  1.1  mycroft 		}
    111  1.1  mycroft 		printf("};\n");
    112  1.1  mycroft 
    113  1.1  mycroft 		# Print out extern declaration.
    114  1.1  mycroft 		printf("extern struct vnodeop_desc %s_desc;\n", name);
    115  1.1  mycroft 
    116  1.1  mycroft 		# Print out inline struct.
    117  1.1  mycroft 		printf("static inline int %s(", uname);
    118  1.1  mycroft 		sep = ", ";
    119  1.1  mycroft 		for (c2 = 0; c2 < c1; ++c2) {
    120  1.1  mycroft 			if (c2 == c1 - 1)
    121  1.1  mycroft 				sep = ")\n";
    122  1.1  mycroft 			c3 = split(a[c2], t);
    123  1.1  mycroft 			beg = match(t[c3], "[^*]");
    124  1.1  mycroft 			end = match(t[c3], ";");
    125  1.1  mycroft 			printf("%s%s", substr(t[c3], beg, end - beg), sep);
    126  1.1  mycroft 		}
    127  1.1  mycroft 		for (c2 = 0; c2 < c1; ++c2) {
    128  1.1  mycroft 			c3 = split(a[c2], t);
    129  1.1  mycroft 			printf("\t");
    130  1.1  mycroft 			if (t[2] ~ "WILLRELE")
    131  1.1  mycroft 				c4 = 3;
    132  1.1  mycroft 			else
    133  1.1  mycroft 				c4 = 2;
    134  1.1  mycroft 			for (; c4 < c3; ++c4)
    135  1.1  mycroft 				printf("%s ", t[c4]);
    136  1.1  mycroft 			beg = match(t[c3], "[^*]");
    137  1.1  mycroft 			printf("%s%s\n",
    138  1.1  mycroft 			    substr(t[c4], 0, beg - 1), substr(t[c4], beg));
    139  1.1  mycroft 		}
    140  1.1  mycroft 		printf("{\n\tstruct %s_args a;\n\n", name);
    141  1.1  mycroft 		printf("\ta.a_desc = VDESC(%s);\n", name);
    142  1.1  mycroft 		for (c2 = 0; c2 < c1; ++c2) {
    143  1.1  mycroft 			c3 = split(a[c2], t);
    144  1.1  mycroft 			printf("\t");
    145  1.1  mycroft 			beg = match(t[c3], "[^*]");
    146  1.1  mycroft 			end = match(t[c3], ";");
    147  1.1  mycroft 			printf("a.a_%s = %s\n",
    148  1.1  mycroft 			    substr(t[c3], beg, end - beg), substr(t[c3], beg));
    149  1.1  mycroft 		}
    150  1.1  mycroft 		c1 = split(a[0], t);
    151  1.1  mycroft 		beg = match(t[c1], "[^*]");
    152  1.1  mycroft 		end = match(t[c1], ";");
    153  1.1  mycroft 		printf("\treturn (VCALL(%s, VOFFSET(%s), &a));\n}\n",
    154  1.1  mycroft 		    substr(t[c1], beg, end - beg), name);
    155  1.1  mycroft 	}' < $SRC >> $HEADER
    156  1.1  mycroft 
    157  1.1  mycroft # Print out header information for vnode_if.c.
    158  1.1  mycroft cat << END_OF_LEADING_COMMENT > $CFILE
    159  1.1  mycroft /*
    160  1.1  mycroft  * This file is produced automatically.
    161  1.1  mycroft  * Do not modify anything in here by hand.
    162  1.1  mycroft  *
    163  1.1  mycroft  * Created from @(#)vnode_if.sh	8.1 (Berkeley) 6/10/93
    164  1.1  mycroft  */
    165  1.1  mycroft 
    166  1.1  mycroft #include <sys/param.h>
    167  1.1  mycroft #include <sys/mount.h>
    168  1.1  mycroft #include <sys/vnode.h>
    169  1.1  mycroft 
    170  1.1  mycroft struct vnodeop_desc vop_default_desc = {
    171  1.1  mycroft 	0,
    172  1.1  mycroft 	"default",
    173  1.1  mycroft 	0,
    174  1.1  mycroft 	NULL,
    175  1.1  mycroft 	VDESC_NO_OFFSET,
    176  1.1  mycroft 	VDESC_NO_OFFSET,
    177  1.1  mycroft 	VDESC_NO_OFFSET,
    178  1.1  mycroft 	VDESC_NO_OFFSET,
    179  1.1  mycroft 	NULL,
    180  1.1  mycroft };
    181  1.1  mycroft 
    182  1.1  mycroft END_OF_LEADING_COMMENT
    183  1.1  mycroft 
    184  1.1  mycroft # Awk script to take vnode_if.src and turn it into vnode_if.c.
    185  1.1  mycroft $AWK 'function kill_surrounding_ws (s) {
    186  1.1  mycroft 		sub (/^[ \t]*/, "", s);
    187  1.1  mycroft 		sub (/[ \t]*$/, "", s);
    188  1.1  mycroft 		return s;
    189  1.1  mycroft 	}
    190  1.1  mycroft 
    191  1.1  mycroft 	function read_args() {
    192  1.1  mycroft 		numargs = 0;
    193  1.1  mycroft 		while (getline ln) {
    194  1.1  mycroft 			if (ln ~ /}/) {
    195  1.1  mycroft 				break;
    196  1.1  mycroft 			};
    197  1.1  mycroft 	
    198  1.1  mycroft 			# Delete comments, if any.
    199  1.1  mycroft 			gsub (/\/\*.*\*\//, "", ln);
    200  1.1  mycroft 			
    201  1.1  mycroft 			# Delete leading/trailing space.
    202  1.1  mycroft 			ln = kill_surrounding_ws(ln);
    203  1.1  mycroft 	
    204  1.1  mycroft 			# Pick off direction.
    205  1.1  mycroft 			if (1 == sub(/^INOUT[ \t]+/, "", ln))
    206  1.1  mycroft 				dir = "INOUT";
    207  1.1  mycroft 			else if (1 == sub(/^IN[ \t]+/, "", ln))
    208  1.1  mycroft 				dir = "IN";
    209  1.1  mycroft 			else if (1 == sub(/^OUT[ \t]+/, "", ln))
    210  1.1  mycroft 				dir = "OUT";
    211  1.1  mycroft 			else
    212  1.1  mycroft 				bail("No IN/OUT direction for \"" ln "\".");
    213  1.1  mycroft 
    214  1.1  mycroft 			# check for "WILLRELE"
    215  1.1  mycroft 			if (1 == sub(/^WILLRELE[ \t]+/, "", ln)) {
    216  1.1  mycroft 				rele = "WILLRELE";
    217  1.1  mycroft 			} else {
    218  1.1  mycroft 				rele = "WONTRELE";
    219  1.1  mycroft 			};
    220  1.1  mycroft 	
    221  1.1  mycroft 			# kill trailing ;
    222  1.1  mycroft 			if (1 != sub (/;$/, "", ln)) {
    223  1.1  mycroft 				bail("Missing end-of-line ; in \"" ln "\".");
    224  1.1  mycroft 			};
    225  1.1  mycroft 	
    226  1.1  mycroft 			# pick off variable name
    227  1.1  mycroft 			if (!(i = match(ln, /[A-Za-z0-9_]+$/))) {
    228  1.1  mycroft 				bail("Missing var name \"a_foo\" in \"" ln "\".");
    229  1.1  mycroft 			};
    230  1.1  mycroft 			arg = substr (ln, i);
    231  1.1  mycroft 			# Want to <<substr(ln, i) = "";>>, but nawk cannot.
    232  1.1  mycroft 			# Hack around this.
    233  1.1  mycroft 			ln = substr(ln, 1, i-1);
    234  1.1  mycroft 	
    235  1.1  mycroft 			# what is left must be type
    236  1.1  mycroft 			# (put clean it up some)
    237  1.1  mycroft 			type = ln;
    238  1.1  mycroft 			gsub (/[ \t]+/, " ", type);   # condense whitespace
    239  1.1  mycroft 			type = kill_surrounding_ws(type);
    240  1.1  mycroft 	
    241  1.1  mycroft 			# (boy this was easier in Perl)
    242  1.1  mycroft 	
    243  1.1  mycroft 			numargs++;
    244  1.1  mycroft 			dirs[numargs] = dir;
    245  1.1  mycroft 			reles[numargs] = rele;
    246  1.1  mycroft 			types[numargs] = type;
    247  1.1  mycroft 			args[numargs] = arg;
    248  1.1  mycroft 		};
    249  1.1  mycroft 	}
    250  1.1  mycroft 
    251  1.1  mycroft 	function generate_operation_vp_offsets() {
    252  1.1  mycroft 		printf ("int %s_vp_offsets[] = {\n", name);
    253  1.1  mycroft 		# as a side effect, figure out the releflags
    254  1.1  mycroft 		releflags = "";
    255  1.1  mycroft 		vpnum = 0;
    256  1.1  mycroft 		for (i=1; i<=numargs; i++) {
    257  1.1  mycroft 			if (types[i] == "struct vnode *") {
    258  1.1  mycroft 				printf ("\tVOPARG_OFFSETOF(struct %s_args,a_%s),\n",
    259  1.1  mycroft 					name, args[i]);
    260  1.1  mycroft 				if (reles[i] == "WILLRELE") {
    261  1.1  mycroft 					releflags = releflags "|VDESC_VP" vpnum "_WILLRELE";
    262  1.1  mycroft 				};
    263  1.1  mycroft 				vpnum++;
    264  1.1  mycroft 			};
    265  1.1  mycroft 		};
    266  1.1  mycroft 		sub (/^\|/, "", releflags);
    267  1.1  mycroft 		print "\tVDESC_NO_OFFSET";
    268  1.1  mycroft 		print "};";
    269  1.1  mycroft 	}
    270  1.1  mycroft 	
    271  1.1  mycroft 	function find_arg_with_type (type) {
    272  1.1  mycroft 		for (i=1; i<=numargs; i++) {
    273  1.1  mycroft 			if (types[i] == type) {
    274  1.1  mycroft 				return "VOPARG_OFFSETOF(struct " name "_args,a_" args[i] ")";
    275  1.1  mycroft 			};
    276  1.1  mycroft 		};
    277  1.1  mycroft 		return "VDESC_NO_OFFSET";
    278  1.1  mycroft 	}
    279  1.1  mycroft 	
    280  1.1  mycroft 	function generate_operation_desc() {
    281  1.1  mycroft 		printf ("struct vnodeop_desc %s_desc = {\n", name);
    282  1.1  mycroft 		# offset
    283  1.1  mycroft 		printf ("\t0,\n");
    284  1.1  mycroft 		# printable name
    285  1.1  mycroft 		printf ("\t\"%s\",\n", name);
    286  1.1  mycroft 		# flags
    287  1.1  mycroft 		vppwillrele = "";
    288  1.1  mycroft 		for (i=1; i<=numargs; i++) {
    289  1.1  mycroft 			if (types[i] == "struct vnode **" &&
    290  1.1  mycroft 				(reles[i] == "WILLRELE")) {
    291  1.1  mycroft 				vppwillrele = "|VDESC_VPP_WILLRELE";
    292  1.1  mycroft 			};
    293  1.1  mycroft 		};
    294  1.1  mycroft 		if (releflags == "") {
    295  1.1  mycroft 			printf ("\t0%s,\n", vppwillrele);
    296  1.1  mycroft 		} else {
    297  1.1  mycroft 			printf ("\t%s%s,\n", releflags, vppwillrele);
    298  1.1  mycroft 		};
    299  1.1  mycroft 		# vp offsets
    300  1.1  mycroft 		printf ("\t%s_vp_offsets,\n", name);
    301  1.1  mycroft 		# vpp (if any)
    302  1.1  mycroft 		printf ("\t%s,\n", find_arg_with_type("struct vnode **"));
    303  1.1  mycroft 		# cred (if any)
    304  1.1  mycroft 		printf ("\t%s,\n", find_arg_with_type("struct ucred *"));
    305  1.1  mycroft 		# proc (if any)
    306  1.1  mycroft 		printf ("\t%s,\n", find_arg_with_type("struct proc *"));
    307  1.1  mycroft 		# componentname
    308  1.1  mycroft 		printf ("\t%s,\n", find_arg_with_type("struct componentname *"));
    309  1.1  mycroft 		# transport layer information
    310  1.1  mycroft 		printf ("\tNULL,\n};\n");
    311  1.1  mycroft 	}
    312  1.1  mycroft 
    313  1.1  mycroft 	NF == 0 || $0 ~ "^#" {
    314  1.1  mycroft 		next;
    315  1.1  mycroft 	}
    316  1.1  mycroft 	{
    317  1.1  mycroft 		# get the function name
    318  1.1  mycroft 		name = $1;
    319  1.1  mycroft 
    320  1.1  mycroft 		# get the function arguments
    321  1.1  mycroft 		read_args();
    322  1.1  mycroft 
    323  1.1  mycroft 		# Print out the vop_F_vp_offsets structure.  This all depends
    324  1.1  mycroft 		# on naming conventions and nothing else.
    325  1.1  mycroft 		generate_operation_vp_offsets();
    326  1.1  mycroft 
    327  1.1  mycroft 		# Print out the vnodeop_desc structure.
    328  1.1  mycroft 		generate_operation_desc();
    329  1.1  mycroft 
    330  1.1  mycroft 		printf "\n";
    331  1.1  mycroft 
    332  1.1  mycroft 	}' < $SRC >> $CFILE
    333  1.1  mycroft # THINGS THAT DON'T WORK RIGHT YET.
    334  1.1  mycroft # 
    335  1.1  mycroft # Two existing BSD vnodeops (bwrite and strategy) don't take any vnodes as
    336  1.1  mycroft # arguments.  This means that these operations can't function successfully
    337  1.1  mycroft # through a bypass routine.
    338  1.1  mycroft #
    339  1.1  mycroft # Bwrite and strategy will be replaced when the VM page/buffer cache
    340  1.1  mycroft # integration happens.
    341  1.1  mycroft #
    342  1.1  mycroft # To get around this problem for now we handle these ops as special cases.
    343  1.1  mycroft 
    344  1.1  mycroft cat << END_OF_SPECIAL_CASES >> $HEADER
    345  1.1  mycroft #include <sys/buf.h>
    346  1.1  mycroft struct vop_strategy_args {
    347  1.1  mycroft 	struct vnodeop_desc *a_desc;
    348  1.1  mycroft 	struct buf *a_bp;
    349  1.1  mycroft };
    350  1.1  mycroft extern struct vnodeop_desc vop_strategy_desc;
    351  1.1  mycroft static inline int VOP_STRATEGY(bp)
    352  1.1  mycroft 	struct buf *bp;
    353  1.1  mycroft {
    354  1.1  mycroft 	struct vop_strategy_args a;
    355  1.1  mycroft 
    356  1.1  mycroft 	a.a_desc = VDESC(vop_strategy);
    357  1.1  mycroft 	a.a_bp = bp;
    358  1.1  mycroft 	return (VCALL((bp)->b_vp, VOFFSET(vop_strategy), &a));
    359  1.1  mycroft }
    360  1.1  mycroft 
    361  1.1  mycroft struct vop_bwrite_args {
    362  1.1  mycroft 	struct vnodeop_desc *a_desc;
    363  1.1  mycroft 	struct buf *a_bp;
    364  1.1  mycroft };
    365  1.1  mycroft extern struct vnodeop_desc vop_bwrite_desc;
    366  1.1  mycroft static inline int VOP_BWRITE(bp)
    367  1.1  mycroft 	struct buf *bp;
    368  1.1  mycroft {
    369  1.1  mycroft 	struct vop_bwrite_args a;
    370  1.1  mycroft 
    371  1.1  mycroft 	a.a_desc = VDESC(vop_bwrite);
    372  1.1  mycroft 	a.a_bp = bp;
    373  1.1  mycroft 	return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a));
    374  1.1  mycroft }
    375  1.1  mycroft END_OF_SPECIAL_CASES
    376  1.1  mycroft 
    377  1.1  mycroft cat << END_OF_SPECIAL_CASES >> $CFILE
    378  1.1  mycroft int vop_strategy_vp_offsets[] = {
    379  1.1  mycroft 	VDESC_NO_OFFSET
    380  1.1  mycroft };
    381  1.1  mycroft struct vnodeop_desc vop_strategy_desc = {
    382  1.1  mycroft 	0,
    383  1.1  mycroft 	"vop_strategy",
    384  1.1  mycroft 	0,
    385  1.1  mycroft 	vop_strategy_vp_offsets,
    386  1.1  mycroft 	VDESC_NO_OFFSET,
    387  1.1  mycroft 	VDESC_NO_OFFSET,
    388  1.1  mycroft 	VDESC_NO_OFFSET,
    389  1.1  mycroft 	VDESC_NO_OFFSET,
    390  1.1  mycroft 	NULL,
    391  1.1  mycroft };
    392  1.1  mycroft int vop_bwrite_vp_offsets[] = {
    393  1.1  mycroft 	VDESC_NO_OFFSET
    394  1.1  mycroft };
    395  1.1  mycroft struct vnodeop_desc vop_bwrite_desc = {
    396  1.1  mycroft 	0,
    397  1.1  mycroft 	"vop_bwrite",
    398  1.1  mycroft 	0,
    399  1.1  mycroft 	vop_bwrite_vp_offsets,
    400  1.1  mycroft 	VDESC_NO_OFFSET,
    401  1.1  mycroft 	VDESC_NO_OFFSET,
    402  1.1  mycroft 	VDESC_NO_OFFSET,
    403  1.1  mycroft 	VDESC_NO_OFFSET,
    404  1.1  mycroft 	NULL,
    405  1.1  mycroft };
    406  1.1  mycroft END_OF_SPECIAL_CASES
    407  1.1  mycroft 
    408  1.1  mycroft # Add the vfs_op_descs array to the C file.
    409  1.1  mycroft $AWK '
    410  1.1  mycroft 	BEGIN {
    411  1.1  mycroft 		printf("\nstruct vnodeop_desc *vfs_op_descs[] = {\n");
    412  1.1  mycroft 		printf("\t&vop_default_desc,	/* MUST BE FIRST */\n");
    413  1.1  mycroft 		printf("\t&vop_strategy_desc,	/* XXX: SPECIAL CASE */\n");
    414  1.1  mycroft 		printf("\t&vop_bwrite_desc,	/* XXX: SPECIAL CASE */\n");
    415  1.1  mycroft 	}
    416  1.1  mycroft 	END {
    417  1.1  mycroft 		printf("\tNULL\n};\n");
    418  1.1  mycroft 	}
    419  1.1  mycroft 	NF == 0 || $0 ~ "^#" {
    420  1.1  mycroft 		next;
    421  1.1  mycroft 	}
    422  1.1  mycroft 	{
    423  1.1  mycroft 		# Get the function name.
    424  1.1  mycroft 		printf("\t&%s_desc,\n", $1);
    425  1.1  mycroft 
    426  1.1  mycroft 		# Skip the function arguments.
    427  1.1  mycroft 		for (;;) {
    428  1.1  mycroft 			if (getline <= 0)
    429  1.1  mycroft 				exit
    430  1.1  mycroft 			if ($0 ~ "^};")
    431  1.1  mycroft 				break;
    432  1.1  mycroft 		}
    433  1.1  mycroft 	}' < $SRC >> $CFILE
    434  1.1  mycroft 
    435