xref: /xnu-8020.140.41/bsd/vfs/vnode_if.sh (revision 27b03b360a988dfd3dfdf34262bb0042026747cc)
1*27b03b36SApple OSS Distributions#!/bin/sh -
2*27b03b36SApple OSS Distributionscopyright='
3*27b03b36SApple OSS Distributions/*
4*27b03b36SApple OSS Distributions * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
5*27b03b36SApple OSS Distributions *
6*27b03b36SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
7*27b03b36SApple OSS Distributions *
8*27b03b36SApple OSS Distributions * The contents of this file constitute Original Code as defined in and
9*27b03b36SApple OSS Distributions * are subject to the Apple Public Source License Version 1.1 (the
10*27b03b36SApple OSS Distributions * "License").  You may not use this file except in compliance with the
11*27b03b36SApple OSS Distributions * License.  Please obtain a copy of the License at
12*27b03b36SApple OSS Distributions * http://www.apple.com/publicsource and read it before using this file.
13*27b03b36SApple OSS Distributions *
14*27b03b36SApple OSS Distributions * This Original Code and all software distributed under the License are
15*27b03b36SApple OSS Distributions * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16*27b03b36SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17*27b03b36SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18*27b03b36SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
19*27b03b36SApple OSS Distributions * License for the specific language governing rights and limitations
20*27b03b36SApple OSS Distributions * under the License.
21*27b03b36SApple OSS Distributions *
22*27b03b36SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
23*27b03b36SApple OSS Distributions */
24*27b03b36SApple OSS Distributions/*
25*27b03b36SApple OSS Distributions * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
26*27b03b36SApple OSS Distributions * Copyright (c) 1992, 1993, 1994, 1995
27*27b03b36SApple OSS Distributions *	The Regents of the University of California.  All rights reserved.
28*27b03b36SApple OSS Distributions *
29*27b03b36SApple OSS Distributions * Redistribution and use in source and binary forms, with or without
30*27b03b36SApple OSS Distributions * modification, are permitted provided that the following conditions
31*27b03b36SApple OSS Distributions * are met:
32*27b03b36SApple OSS Distributions * 1. Redistributions of source code must retain the above copyright
33*27b03b36SApple OSS Distributions *    notice, this list of conditions and the following disclaimer.
34*27b03b36SApple OSS Distributions * 2. Redistributions in binary form must reproduce the above copyright
35*27b03b36SApple OSS Distributions *    notice, this list of conditions and the following disclaimer in the
36*27b03b36SApple OSS Distributions *    documentation and/or other materials provided with the distribution.
37*27b03b36SApple OSS Distributions * 3. All advertising materials mentioning features or use of this software
38*27b03b36SApple OSS Distributions *    must display the following acknowledgement:
39*27b03b36SApple OSS Distributions *      This product includes software developed by the University of
40*27b03b36SApple OSS Distributions *      California, Berkeley and its contributors.
41*27b03b36SApple OSS Distributions * 4. Neither the name of the University nor the names of its contributors
42*27b03b36SApple OSS Distributions *    may be used to endorse or promote products derived from this software
43*27b03b36SApple OSS Distributions *    without specific prior written permission.
44*27b03b36SApple OSS Distributions *
45*27b03b36SApple OSS Distributions * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46*27b03b36SApple OSS Distributions * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47*27b03b36SApple OSS Distributions * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48*27b03b36SApple OSS Distributions * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49*27b03b36SApple OSS Distributions * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50*27b03b36SApple OSS Distributions * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51*27b03b36SApple OSS Distributions * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52*27b03b36SApple OSS Distributions * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53*27b03b36SApple OSS Distributions * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54*27b03b36SApple OSS Distributions * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55*27b03b36SApple OSS Distributions * SUCH DAMAGE.
56*27b03b36SApple OSS Distributions */
57*27b03b36SApple OSS Distributions'
58*27b03b36SApple OSS DistributionsSCRIPT_ID='@(#)vnode_if.sh	8.7 (Berkeley) 5/11/95'
59*27b03b36SApple OSS Distributions
60*27b03b36SApple OSS Distributions# Script to produce VFS front-end sugar.
61*27b03b36SApple OSS Distributions#
62*27b03b36SApple OSS Distributions# usage: vnode_if.sh srcfile
63*27b03b36SApple OSS Distributions#	(where srcfile is currently bsd/vfs/vnode_if.src)
64*27b03b36SApple OSS Distributions#
65*27b03b36SApple OSS Distributions
66*27b03b36SApple OSS Distributionsif [ $# -ne 1 ] ; then
67*27b03b36SApple OSS Distributions	echo 'usage: vnode_if.sh srcfile'
68*27b03b36SApple OSS Distributions	exit 1
69*27b03b36SApple OSS Distributionsfi
70*27b03b36SApple OSS Distributions
71*27b03b36SApple OSS Distributions# Name of the source file.
72*27b03b36SApple OSS Distributionssrc=$1
73*27b03b36SApple OSS Distributions
74*27b03b36SApple OSS Distributions# Names of the created files.
75*27b03b36SApple OSS Distributionsout_c=vnode_if.c
76*27b03b36SApple OSS Distributionsout_h=vnode_if.h
77*27b03b36SApple OSS Distributions
78*27b03b36SApple OSS Distributions# Awk program (must support nawk extensions)
79*27b03b36SApple OSS Distributions# Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
80*27b03b36SApple OSS Distributionsawk=${AWK:-awk}
81*27b03b36SApple OSS Distributions#awk=${AWK:-gawk}
82*27b03b36SApple OSS Distributions
83*27b03b36SApple OSS Distributions# Does this awk have a "toupper" function? (i.e. is it GNU awk)
84*27b03b36SApple OSS Distributionsisgawk=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null`
85*27b03b36SApple OSS Distributions
86*27b03b36SApple OSS Distributions# If this awk does not define "toupper" then define our own.
87*27b03b36SApple OSS Distributionsif [ "$isgawk" = TRUE ] ; then
88*27b03b36SApple OSS Distributions	# GNU awk provides it.
89*27b03b36SApple OSS Distributions	toupper=
90*27b03b36SApple OSS Distributionselse
91*27b03b36SApple OSS Distributions	# Provide our own toupper()
92*27b03b36SApple OSS Distributions	toupper='
93*27b03b36SApple OSS Distributionsfunction toupper(str) {
94*27b03b36SApple OSS Distributions	_toupper_cmd = "echo "str" |tr a-z A-Z"
95*27b03b36SApple OSS Distributions	_toupper_cmd | getline _toupper_str;
96*27b03b36SApple OSS Distributions	close(_toupper_cmd);
97*27b03b36SApple OSS Distributions	return _toupper_str;
98*27b03b36SApple OSS Distributions}'
99*27b03b36SApple OSS Distributionsfi
100*27b03b36SApple OSS Distributions
101*27b03b36SApple OSS Distributions#
102*27b03b36SApple OSS Distributions# This is the common part of all awk programs that read $src
103*27b03b36SApple OSS Distributions# This parses the input for one function into the arrays:
104*27b03b36SApple OSS Distributions#	argdir, argtype, argname, willrele
105*27b03b36SApple OSS Distributions# and calls "doit()" to generate output for the function.
106*27b03b36SApple OSS Distributions#
107*27b03b36SApple OSS Distributions# Input to this parser is pre-processed slightly by sed
108*27b03b36SApple OSS Distributions# so this awk parser doesn't have to work so hard.  The
109*27b03b36SApple OSS Distributions# changes done by the sed pre-processing step are:
110*27b03b36SApple OSS Distributions#	insert a space beween * and pointer name
111*27b03b36SApple OSS Distributions#	replace semicolons with spaces
112*27b03b36SApple OSS Distributions#
113*27b03b36SApple OSS Distributionssed_prep='s:\*\([^\*/]\):\* \1:g
114*27b03b36SApple OSS Distributionss/;/ /'
115*27b03b36SApple OSS Distributionsawk_parser='
116*27b03b36SApple OSS Distributions# Comment line
117*27b03b36SApple OSS Distributions/^#/	{ next; }
118*27b03b36SApple OSS Distributions# First line of description
119*27b03b36SApple OSS Distributions/^vop_/	{
120*27b03b36SApple OSS Distributions	name=$1;
121*27b03b36SApple OSS Distributions	argc=0;
122*27b03b36SApple OSS Distributions	ubc=$3;
123*27b03b36SApple OSS Distributions	next;
124*27b03b36SApple OSS Distributions}
125*27b03b36SApple OSS Distributions# Last line of description
126*27b03b36SApple OSS Distributions/^}/	{
127*27b03b36SApple OSS Distributions	doit();
128*27b03b36SApple OSS Distributions	next;
129*27b03b36SApple OSS Distributions}
130*27b03b36SApple OSS Distributions# Middle lines of description
131*27b03b36SApple OSS Distributions{
132*27b03b36SApple OSS Distributions	argdir[argc] = $1; i=2;
133*27b03b36SApple OSS Distributions	if ($2 == "WILLRELE") {
134*27b03b36SApple OSS Distributions		willrele[argc] = 1;
135*27b03b36SApple OSS Distributions		i++;
136*27b03b36SApple OSS Distributions	} else
137*27b03b36SApple OSS Distributions		willrele[argc] = 0;
138*27b03b36SApple OSS Distributions	argtype[argc] = $i; i++;
139*27b03b36SApple OSS Distributions	while (i < NF) {
140*27b03b36SApple OSS Distributions		argtype[argc] = argtype[argc]" "$i;
141*27b03b36SApple OSS Distributions		i++;
142*27b03b36SApple OSS Distributions	}
143*27b03b36SApple OSS Distributions	argname[argc] = $i;
144*27b03b36SApple OSS Distributions	argc++;
145*27b03b36SApple OSS Distributions	next;
146*27b03b36SApple OSS Distributions}
147*27b03b36SApple OSS Distributions'
148*27b03b36SApple OSS Distributions
149*27b03b36SApple OSS Distributions# This is put after the copyright on each generated file.
150*27b03b36SApple OSS Distributionswarning="
151*27b03b36SApple OSS Distributions/*
152*27b03b36SApple OSS Distributions * Warning: This file is generated automatically.
153*27b03b36SApple OSS Distributions * (Modifications made here may easily be lost!)
154*27b03b36SApple OSS Distributions *
155*27b03b36SApple OSS Distributions * Created by the script:
156*27b03b36SApple OSS Distributions *	${SCRIPT_ID}
157*27b03b36SApple OSS Distributions */
158*27b03b36SApple OSS Distributions"
159*27b03b36SApple OSS Distributions
160*27b03b36SApple OSS Distributions# Get rid of ugly spaces
161*27b03b36SApple OSS Distributionsspace_elim='s:\([^/]\*\) :\1:g'
162*27b03b36SApple OSS Distributions
163*27b03b36SApple OSS Distributions#
164*27b03b36SApple OSS Distributions# Redirect stdout to the H file.
165*27b03b36SApple OSS Distributions#
166*27b03b36SApple OSS Distributionsecho "$0: Creating $out_h" 1>&2
167*27b03b36SApple OSS Distributionsexec > $out_h
168*27b03b36SApple OSS Distributions
169*27b03b36SApple OSS Distributions# Begin stuff
170*27b03b36SApple OSS Distributionsecho "$copyright"
171*27b03b36SApple OSS Distributionsecho "$warning"
172*27b03b36SApple OSS Distributionsecho '
173*27b03b36SApple OSS Distributions#ifndef _SYS_VNODE_IF_H_
174*27b03b36SApple OSS Distributions#define _SYS_VNODE_IF_H_
175*27b03b36SApple OSS Distributions
176*27b03b36SApple OSS Distributions#include <sys/appleapiopts.h>
177*27b03b36SApple OSS Distributions#include <sys/ubc.h>
178*27b03b36SApple OSS Distributions
179*27b03b36SApple OSS Distributions#ifdef __APPLE_API_UNSTABLE
180*27b03b36SApple OSS Distributionsextern struct vnodeop_desc vop_default_desc;
181*27b03b36SApple OSS Distributions'
182*27b03b36SApple OSS Distributions
183*27b03b36SApple OSS Distributions# Body stuff
184*27b03b36SApple OSS Distributions# This awk program needs toupper() so define it if necessary.
185*27b03b36SApple OSS Distributionssed -e "$sed_prep" $src | $awk "$toupper"'
186*27b03b36SApple OSS Distributionsfunction doit() {
187*27b03b36SApple OSS Distributions	# Declare arg struct, descriptor.
188*27b03b36SApple OSS Distributions	printf("\nstruct %s_args {\n", name);
189*27b03b36SApple OSS Distributions	printf("\tstruct vnodeop_desc * a_desc;\n");
190*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
191*27b03b36SApple OSS Distributions		printf("\t%s a_%s;\n", argtype[i], argname[i]);
192*27b03b36SApple OSS Distributions	}
193*27b03b36SApple OSS Distributions	printf("};\n");
194*27b03b36SApple OSS Distributions	printf("extern struct vnodeop_desc %s_desc;\n", name);
195*27b03b36SApple OSS Distributions	# Define inline function.
196*27b03b36SApple OSS Distributions	printf("#define %s(", toupper(name));
197*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
198*27b03b36SApple OSS Distributions		printf("%s", argname[i]);
199*27b03b36SApple OSS Distributions		if (i < (argc-1)) printf(", ");
200*27b03b36SApple OSS Distributions	}
201*27b03b36SApple OSS Distributions	printf(") _%s(", toupper(name));
202*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
203*27b03b36SApple OSS Distributions		printf("%s", argname[i]);
204*27b03b36SApple OSS Distributions		if (i < (argc-1)) printf(", ");
205*27b03b36SApple OSS Distributions	}
206*27b03b36SApple OSS Distributions	printf(")\n");
207*27b03b36SApple OSS Distributions	printf("static __inline int _%s(", toupper(name));
208*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
209*27b03b36SApple OSS Distributions		# generate ANSI protoypes now, hurrah!
210*27b03b36SApple OSS Distributions		printf("%s _%s", argtype[i], argname[i]);
211*27b03b36SApple OSS Distributions		if (i < (argc-1)) printf(", ");
212*27b03b36SApple OSS Distributions	}
213*27b03b36SApple OSS Distributions	printf(")\n");
214*27b03b36SApple OSS Distributions	printf("{\n\tstruct %s_args a;\n", name);
215*27b03b36SApple OSS Distributions	printf("\ta.a_desc = VDESC(%s);\n", name);
216*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
217*27b03b36SApple OSS Distributions		printf("\ta.a_%s = _%s;\n", argname[i], argname[i]);
218*27b03b36SApple OSS Distributions	}
219*27b03b36SApple OSS Distributions	if (toupper(ubc) == "UBC") {
220*27b03b36SApple OSS Distributions		printf("\t{\n\t\t" \
221*27b03b36SApple OSS Distributions			"int _err;\n\t\t"   \
222*27b03b36SApple OSS Distributions			"_err = VCALL(_%s%s, VOFFSET(%s), &a);\n\t\t"    \
223*27b03b36SApple OSS Distributions			"return (_err);\n\t}\n}\n",
224*27b03b36SApple OSS Distributions			argname[0], argname[0], arg0special, name, argname[0]);
225*27b03b36SApple OSS Distributions	} else {
226*27b03b36SApple OSS Distributions		printf("\treturn (VCALL(_%s%s, VOFFSET(%s), &a));\n}\n",
227*27b03b36SApple OSS Distributions			argname[0], arg0special, name);
228*27b03b36SApple OSS Distributions	}
229*27b03b36SApple OSS Distributions}
230*27b03b36SApple OSS DistributionsBEGIN	{
231*27b03b36SApple OSS Distributions	arg0special="";
232*27b03b36SApple OSS Distributions}
233*27b03b36SApple OSS DistributionsEND	{
234*27b03b36SApple OSS Distributions	printf("\n/* Special cases: */\n#include <sys/buf.h>\n#include <sys/vm.h>\n");
235*27b03b36SApple OSS Distributions	argc=1;
236*27b03b36SApple OSS Distributions	argtype[0]="struct buf *";
237*27b03b36SApple OSS Distributions	argname[0]="bp";
238*27b03b36SApple OSS Distributions	arg0special="->b_vp";
239*27b03b36SApple OSS Distributions	name="vop_strategy";
240*27b03b36SApple OSS Distributions	doit();
241*27b03b36SApple OSS Distributions	name="VNOP_BWRITE";
242*27b03b36SApple OSS Distributions	doit();
243*27b03b36SApple OSS Distributions}
244*27b03b36SApple OSS Distributions'"$awk_parser" | sed -e "$space_elim"
245*27b03b36SApple OSS Distributions
246*27b03b36SApple OSS Distributions# End stuff
247*27b03b36SApple OSS Distributionsecho '
248*27b03b36SApple OSS Distributions/* End of special cases. */
249*27b03b36SApple OSS Distributions
250*27b03b36SApple OSS Distributions#endif /* __APPLE_API_UNSTABLE */
251*27b03b36SApple OSS Distributions#endif /* !_SYS_VNODE_IF_H_ */'
252*27b03b36SApple OSS Distributions
253*27b03b36SApple OSS Distributions#
254*27b03b36SApple OSS Distributions# Redirect stdout to the C file.
255*27b03b36SApple OSS Distributions#
256*27b03b36SApple OSS Distributionsecho "$0: Creating $out_c" 1>&2
257*27b03b36SApple OSS Distributionsexec > $out_c
258*27b03b36SApple OSS Distributions
259*27b03b36SApple OSS Distributions# Begin stuff
260*27b03b36SApple OSS Distributionsecho "$copyright"
261*27b03b36SApple OSS Distributionsecho "$warning"
262*27b03b36SApple OSS Distributionsecho '
263*27b03b36SApple OSS Distributions#include <sys/param.h>
264*27b03b36SApple OSS Distributions#include <sys/mount.h>
265*27b03b36SApple OSS Distributions#include <sys/vm.h>
266*27b03b36SApple OSS Distributions#include <sys/vnode.h>
267*27b03b36SApple OSS Distributions
268*27b03b36SApple OSS Distributionsstruct vnodeop_desc vop_default_desc = {
269*27b03b36SApple OSS Distributions	.vdesc_offset = 0,
270*27b03b36SApple OSS Distributions	.vdesc_name = "default",
271*27b03b36SApple OSS Distributions	.vdesc_flags = 0,
272*27b03b36SApple OSS Distributions	.vdesc_vp_offsets = NULL,
273*27b03b36SApple OSS Distributions	.vdesc_vpp_offset = VDESC_NO_OFFSET,
274*27b03b36SApple OSS Distributions	.vdesc_cred_offset = VDESC_NO_OFFSET,
275*27b03b36SApple OSS Distributions	.vdesc_proc_offset = VDESC_NO_OFFSET,
276*27b03b36SApple OSS Distributions	.vdesc_componentname_offset = VDESC_NO_OFFSET,
277*27b03b36SApple OSS Distributions	.vdesc_context_offset = VDESC_NO_OFFSET,
278*27b03b36SApple OSS Distributions	.vdesc_transports = NULL,
279*27b03b36SApple OSS Distributions};
280*27b03b36SApple OSS Distributions'
281*27b03b36SApple OSS Distributions
282*27b03b36SApple OSS Distributions# Body stuff
283*27b03b36SApple OSS Distributionssed -e "$sed_prep" $src | $awk '
284*27b03b36SApple OSS Distributionsfunction do_offset(typematch) {
285*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
286*27b03b36SApple OSS Distributions		if (argtype[i] == typematch) {
287*27b03b36SApple OSS Distributions			printf("\tVOPARG_OFFSETOF(struct %s_args, a_%s),\n",
288*27b03b36SApple OSS Distributions				name, argname[i]);
289*27b03b36SApple OSS Distributions			return i;
290*27b03b36SApple OSS Distributions		};
291*27b03b36SApple OSS Distributions	};
292*27b03b36SApple OSS Distributions	print "\tVDESC_NO_OFFSET,";
293*27b03b36SApple OSS Distributions	return -1;
294*27b03b36SApple OSS Distributions}
295*27b03b36SApple OSS Distributions
296*27b03b36SApple OSS Distributionsfunction doit() {
297*27b03b36SApple OSS Distributions	# Define offsets array
298*27b03b36SApple OSS Distributions	printf("\nint %s_vp_offsets[] = {\n", name);
299*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
300*27b03b36SApple OSS Distributions		if (argtype[i] == "struct vnode *") {
301*27b03b36SApple OSS Distributions			printf ("\tVOPARG_OFFSETOF(struct %s_args,a_%s),\n",
302*27b03b36SApple OSS Distributions				name, argname[i]);
303*27b03b36SApple OSS Distributions		}
304*27b03b36SApple OSS Distributions	}
305*27b03b36SApple OSS Distributions	print "\tVDESC_NO_OFFSET";
306*27b03b36SApple OSS Distributions	print "};";
307*27b03b36SApple OSS Distributions	# Define F_desc
308*27b03b36SApple OSS Distributions	printf("struct vnodeop_desc %s_desc = {\n", name);
309*27b03b36SApple OSS Distributions	# offset
310*27b03b36SApple OSS Distributions	printf ("\t0,\n");
311*27b03b36SApple OSS Distributions	# printable name
312*27b03b36SApple OSS Distributions	printf ("\t\"%s\",\n", name);
313*27b03b36SApple OSS Distributions	# flags
314*27b03b36SApple OSS Distributions	printf("\t0");
315*27b03b36SApple OSS Distributions	vpnum = 0;
316*27b03b36SApple OSS Distributions	for (i=0; i<argc; i++) {
317*27b03b36SApple OSS Distributions		if (match(argtype[i], "struct vnode *") == 1) {
318*27b03b36SApple OSS Distributions			if (willrele[i]) {
319*27b03b36SApple OSS Distributions				if (argdir[i] ~ /OUT/) {
320*27b03b36SApple OSS Distributions					printf(" | VDESC_VPP_WILLRELE");
321*27b03b36SApple OSS Distributions				} else {
322*27b03b36SApple OSS Distributions					printf(" | VDESC_VP%s_WILLRELE", vpnum);
323*27b03b36SApple OSS Distributions				};
324*27b03b36SApple OSS Distributions			}
325*27b03b36SApple OSS Distributions		vpnum++;
326*27b03b36SApple OSS Distributions		}
327*27b03b36SApple OSS Distributions	}
328*27b03b36SApple OSS Distributions	print ",";
329*27b03b36SApple OSS Distributions	# vp offsets
330*27b03b36SApple OSS Distributions	printf ("\t%s_vp_offsets,\n", name);
331*27b03b36SApple OSS Distributions	# vpp (if any)
332*27b03b36SApple OSS Distributions	do_offset("struct vnode **");
333*27b03b36SApple OSS Distributions	# cred (if any)
334*27b03b36SApple OSS Distributions	do_offset("kauth_credential_t");
335*27b03b36SApple OSS Distributions	# proc (if any)
336*27b03b36SApple OSS Distributions	do_offset("struct proc *");
337*27b03b36SApple OSS Distributions	# componentname
338*27b03b36SApple OSS Distributions	do_offset("struct componentname *");
339*27b03b36SApple OSS Distributions	# transport layer information
340*27b03b36SApple OSS Distributions	printf ("\tNULL,\n};\n");
341*27b03b36SApple OSS Distributions}
342*27b03b36SApple OSS DistributionsEND	{
343*27b03b36SApple OSS Distributions	printf("\n/* Special cases: */\n");
344*27b03b36SApple OSS Distributions	argc=1;
345*27b03b36SApple OSS Distributions	argdir[0]="IN";
346*27b03b36SApple OSS Distributions	argtype[0]="struct buf *";
347*27b03b36SApple OSS Distributions	argname[0]="bp";
348*27b03b36SApple OSS Distributions	willrele[0]=0;
349*27b03b36SApple OSS Distributions	name="vop_strategy";
350*27b03b36SApple OSS Distributions	doit();
351*27b03b36SApple OSS Distributions	name="VNOP_BWRITE";
352*27b03b36SApple OSS Distributions	doit();
353*27b03b36SApple OSS Distributions}
354*27b03b36SApple OSS Distributions'"$awk_parser" | sed -e "$space_elim"
355*27b03b36SApple OSS Distributions
356*27b03b36SApple OSS Distributions# End stuff
357*27b03b36SApple OSS Distributionsecho '
358*27b03b36SApple OSS Distributions/* End of special cases. */'
359*27b03b36SApple OSS Distributions
360*27b03b36SApple OSS Distributions# Add the vfs_op_descs array to the C file.
361*27b03b36SApple OSS Distributions# Begin stuff
362*27b03b36SApple OSS Distributionsecho '
363*27b03b36SApple OSS Distributionsstruct vnodeop_desc *vfs_op_descs[] = {
364*27b03b36SApple OSS Distributions	&vop_default_desc,	/* MUST BE FIRST */
365*27b03b36SApple OSS Distributions	&vop_strategy_desc,	/* XXX: SPECIAL CASE */
366*27b03b36SApple OSS Distributions	&VNOP_BWRITE_desc,	/* XXX: SPECIAL CASE */
367*27b03b36SApple OSS Distributions'
368*27b03b36SApple OSS Distributions
369*27b03b36SApple OSS Distributions# Body stuff
370*27b03b36SApple OSS Distributionssed -e "$sed_prep" $src | $awk '
371*27b03b36SApple OSS Distributionsfunction doit() {
372*27b03b36SApple OSS Distributions	printf("\t&%s_desc,\n", name);
373*27b03b36SApple OSS Distributions}
374*27b03b36SApple OSS Distributions'"$awk_parser"
375*27b03b36SApple OSS Distributions
376*27b03b36SApple OSS Distributions# End stuff
377*27b03b36SApple OSS Distributionsecho '	NULL
378*27b03b36SApple OSS Distributions};
379*27b03b36SApple OSS Distributions'
380*27b03b36SApple OSS Distributions
381*27b03b36SApple OSS Distributionsexit 0
382*27b03b36SApple OSS Distributions
383*27b03b36SApple OSS Distributions# Local Variables:
384*27b03b36SApple OSS Distributions# tab-width: 4
385*27b03b36SApple OSS Distributions# End:
386