1994-06-08 15:28:29 +04:00
|
|
|
#!/bin/sh -
|
1996-02-29 23:54:58 +03:00
|
|
|
copyright="\
|
1994-06-15 19:49:03 +04:00
|
|
|
/*
|
1998-03-01 05:20:01 +03:00
|
|
|
* Copyright (c) 1992, 1993, 1994, 1995
|
1994-06-15 19:49:03 +04:00
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1994-06-15 19:49:03 +04:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
1998-09-13 18:44:34 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS \`\`AS IS'' AND
|
1994-06-15 19:49:03 +04:00
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
1996-02-29 23:54:58 +03:00
|
|
|
"
|
2004-09-21 07:10:35 +04:00
|
|
|
SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.35 2004/09/21 03:10:35 thorpej Exp $'
|
1994-06-08 15:28:29 +04:00
|
|
|
|
|
|
|
# Script to produce VFS front-end sugar.
|
|
|
|
#
|
|
|
|
# usage: vnode_if.sh srcfile
|
|
|
|
# (where srcfile is currently /sys/kern/vnode_if.src)
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ $# -ne 1 ] ; then
|
|
|
|
echo 'usage: vnode_if.sh srcfile'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1996-02-29 23:54:58 +03:00
|
|
|
# Name and revision of the source file.
|
1994-06-15 19:49:03 +04:00
|
|
|
src=$1
|
1996-02-29 23:54:58 +03:00
|
|
|
SRC_ID=`head -1 $src | sed -e 's/.*\$\(.*\)\$.*/\1/'`
|
1994-06-08 15:28:29 +04:00
|
|
|
|
|
|
|
# Names of the created files.
|
1994-06-15 19:49:03 +04:00
|
|
|
out_c=vnode_if.c
|
1996-02-29 23:54:58 +03:00
|
|
|
out_h=../sys/vnode_if.h
|
1994-06-15 19:49:03 +04:00
|
|
|
|
|
|
|
# Awk program (must support nawk extensions)
|
|
|
|
# Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
|
|
|
|
awk=${AWK:-awk}
|
|
|
|
|
|
|
|
# Does this awk have a "toupper" function? (i.e. is it GNU awk)
|
|
|
|
isgawk=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null`
|
|
|
|
|
|
|
|
# If this awk does not define "toupper" then define our own.
|
|
|
|
if [ "$isgawk" = TRUE ] ; then
|
|
|
|
# GNU awk provides it.
|
|
|
|
toupper=
|
|
|
|
else
|
|
|
|
# Provide our own toupper()
|
|
|
|
toupper='
|
|
|
|
function toupper(str) {
|
|
|
|
_toupper_cmd = "echo "str" |tr a-z A-Z"
|
|
|
|
_toupper_cmd | getline _toupper_str;
|
|
|
|
close(_toupper_cmd);
|
|
|
|
return _toupper_str;
|
|
|
|
}'
|
|
|
|
fi
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
#
|
|
|
|
# This is the common part of all awk programs that read $src
|
|
|
|
# This parses the input for one function into the arrays:
|
|
|
|
# argdir, argtype, argname, willrele
|
|
|
|
# and calls "doit()" to generate output for the function.
|
|
|
|
#
|
|
|
|
# Input to this parser is pre-processed slightly by sed
|
|
|
|
# so this awk parser doesn't have to work so hard. The
|
|
|
|
# changes done by the sed pre-processing step are:
|
|
|
|
# insert a space beween * and pointer name
|
|
|
|
# replace semicolons with spaces
|
|
|
|
#
|
|
|
|
sed_prep='s:\*\([^\*/]\):\* \1:g
|
|
|
|
s/;/ /'
|
|
|
|
awk_parser='
|
|
|
|
# Comment line
|
|
|
|
/^#/ { next; }
|
|
|
|
# First line of description
|
|
|
|
/^vop_/ {
|
|
|
|
name=$1;
|
|
|
|
argc=0;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
# Last line of description
|
|
|
|
/^}/ {
|
|
|
|
doit();
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
# Middle lines of description
|
|
|
|
{
|
|
|
|
argdir[argc] = $1; i=2;
|
2004-09-21 07:10:35 +04:00
|
|
|
|
|
|
|
if ($2 == "LOCKED=YES") {
|
|
|
|
lockstate[argc] = 1;
|
|
|
|
i++;
|
|
|
|
} else if ($2 == "LOCKED=NO") {
|
|
|
|
lockstate[argc] = 0;
|
|
|
|
i++;
|
|
|
|
} else
|
|
|
|
lockstate[argc] = -1;
|
|
|
|
|
|
|
|
if ($2 == "WILLRELE" ||
|
|
|
|
$3 == "WILLRELE") {
|
1994-06-15 19:49:03 +04:00
|
|
|
willrele[argc] = 1;
|
|
|
|
i++;
|
2004-09-21 07:10:35 +04:00
|
|
|
} else if ($2 == "WILLUNLOCK" ||
|
|
|
|
$3 == "WILLUNLOCK") {
|
1999-07-08 03:32:50 +04:00
|
|
|
willrele[argc] = 2;
|
|
|
|
i++;
|
2004-09-21 07:10:35 +04:00
|
|
|
} else if ($2 == "WILLPUT" ||
|
|
|
|
$3 == "WILLPUT") {
|
1999-07-08 03:32:50 +04:00
|
|
|
willrele[argc] = 3;
|
|
|
|
i++;
|
1994-06-15 19:49:03 +04:00
|
|
|
} else
|
|
|
|
willrele[argc] = 0;
|
1994-08-25 07:04:28 +04:00
|
|
|
argtype[argc] = $i; i++;
|
1994-06-15 19:49:03 +04:00
|
|
|
while (i < NF) {
|
1994-08-25 07:04:28 +04:00
|
|
|
argtype[argc] = argtype[argc]" "$i;
|
1994-06-15 19:49:03 +04:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
argname[argc] = $i;
|
|
|
|
argc++;
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
'
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1998-01-09 09:40:43 +03:00
|
|
|
# This is put before the copyright on each generated file.
|
1996-02-29 23:54:58 +03:00
|
|
|
warning="\
|
1998-01-09 09:40:43 +03:00
|
|
|
/* @NetBSD@ */
|
|
|
|
|
1994-06-08 15:28:29 +04:00
|
|
|
/*
|
1994-06-15 19:49:03 +04:00
|
|
|
* Warning: This file is generated automatically.
|
|
|
|
* (Modifications made here may easily be lost!)
|
1994-06-08 15:28:29 +04:00
|
|
|
*
|
1996-02-29 23:54:58 +03:00
|
|
|
* Created from the file:
|
|
|
|
* ${SRC_ID}
|
|
|
|
* by the script:
|
1994-06-15 19:49:03 +04:00
|
|
|
* ${SCRIPT_ID}
|
1994-06-08 15:28:29 +04:00
|
|
|
*/
|
1996-02-29 23:54:58 +03:00
|
|
|
"
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-08-25 07:04:28 +04:00
|
|
|
# This is to satisfy McKusick (get rid of evil spaces 8^)
|
|
|
|
anal_retentive='s:\([^/]\*\) :\1:g'
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
#
|
|
|
|
# Redirect stdout to the H file.
|
|
|
|
#
|
|
|
|
echo "$0: Creating $out_h" 1>&2
|
|
|
|
exec > $out_h
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# Begin stuff
|
1998-01-09 09:40:43 +03:00
|
|
|
echo -n "$warning" | sed -e 's/\$//g;s/@/\$/g'
|
1996-02-29 23:54:58 +03:00
|
|
|
echo ""
|
|
|
|
echo -n "$copyright"
|
1997-01-22 09:51:59 +03:00
|
|
|
echo ''
|
|
|
|
echo '#ifndef _SYS_VNODE_IF_H_'
|
|
|
|
echo '#define _SYS_VNODE_IF_H_'
|
2000-09-13 20:09:27 +04:00
|
|
|
echo ''
|
|
|
|
echo '#ifdef _KERNEL'
|
2000-12-22 23:05:35 +03:00
|
|
|
echo '#if defined(_LKM) || defined(LKM)'
|
2000-09-13 20:09:27 +04:00
|
|
|
echo '/* LKMs always use non-inlined vnode ops. */'
|
|
|
|
echo '#define VNODE_OP_NOINLINE'
|
|
|
|
echo '#else'
|
|
|
|
echo '#include "opt_vnode_op_noinline.h"'
|
2004-09-21 07:10:35 +04:00
|
|
|
echo '#endif /* _LKM || LKM */'
|
|
|
|
echo '#ifdef _KERNEL_OPT'
|
|
|
|
echo '#include "opt_vnode_lockdebug.h"'
|
|
|
|
echo '#endif /* _KERNEL_OPT */'
|
2000-09-13 20:09:27 +04:00
|
|
|
echo '#endif /* _KERNEL */'
|
1994-06-15 19:49:03 +04:00
|
|
|
echo '
|
2001-01-22 12:52:21 +03:00
|
|
|
extern const struct vnodeop_desc vop_default_desc;
|
1994-06-15 19:49:03 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
# Body stuff
|
|
|
|
# This awk program needs toupper() so define it if necessary.
|
|
|
|
sed -e "$sed_prep" $src | $awk "$toupper"'
|
|
|
|
function doit() {
|
|
|
|
# Declare arg struct, descriptor.
|
|
|
|
printf("\nstruct %s_args {\n", name);
|
2001-01-22 12:52:21 +03:00
|
|
|
printf("\tconst struct vnodeop_desc * a_desc;\n");
|
1994-06-15 19:49:03 +04:00
|
|
|
for (i=0; i<argc; i++) {
|
1994-08-25 07:04:28 +04:00
|
|
|
printf("\t%s a_%s;\n", argtype[i], argname[i]);
|
1994-06-15 19:49:03 +04:00
|
|
|
}
|
|
|
|
printf("};\n");
|
2001-01-22 12:52:21 +03:00
|
|
|
printf("extern const struct vnodeop_desc %s_desc;\n", name);
|
1995-03-10 07:13:52 +03:00
|
|
|
# Prototype it.
|
2000-09-13 19:50:26 +04:00
|
|
|
printf("#ifndef VNODE_OP_NOINLINE\n");
|
|
|
|
printf("static __inline\n");
|
|
|
|
printf("#endif\n");
|
|
|
|
protoarg = sprintf("int %s(", toupper(name));
|
1995-03-10 07:13:52 +03:00
|
|
|
protolen = length(protoarg);
|
|
|
|
printf("%s", protoarg);
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
protoarg = sprintf("%s", argtype[i]);
|
|
|
|
if (i < (argc-1)) protoarg = (protoarg ", ");
|
|
|
|
arglen = length(protoarg);
|
|
|
|
if ((protolen + arglen) > 77) {
|
|
|
|
protoarg = ("\n " protoarg);
|
|
|
|
arglen += 4;
|
|
|
|
protolen = 0;
|
|
|
|
}
|
|
|
|
printf("%s", protoarg);
|
|
|
|
protolen += arglen;
|
|
|
|
}
|
2000-09-13 19:50:26 +04:00
|
|
|
printf(")\n");
|
|
|
|
printf("#ifndef VNODE_OP_NOINLINE\n");
|
|
|
|
printf("__attribute__((__unused__))\n");
|
|
|
|
printf("#endif\n");
|
|
|
|
printf(";\n");
|
1994-06-15 19:49:03 +04:00
|
|
|
# Define inline function.
|
2000-09-13 19:50:26 +04:00
|
|
|
printf("#ifndef VNODE_OP_NOINLINE\n");
|
1994-07-16 02:29:22 +04:00
|
|
|
printf("static __inline int %s(", toupper(name));
|
1994-06-15 19:49:03 +04:00
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
printf("%s", argname[i]);
|
|
|
|
if (i < (argc-1)) printf(", ");
|
|
|
|
}
|
|
|
|
printf(")\n");
|
|
|
|
for (i=0; i<argc; i++) {
|
1994-08-25 07:04:28 +04:00
|
|
|
printf("\t%s %s;\n", argtype[i], argname[i]);
|
1994-06-15 19:49:03 +04:00
|
|
|
}
|
|
|
|
printf("{\n\tstruct %s_args a;\n", name);
|
2004-09-21 07:10:35 +04:00
|
|
|
printf("#ifdef VNODE_LOCKDEBUG\n");
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
if (lockstate[i] != -1)
|
|
|
|
printf("\tint islocked_%s;\n", argname[i]);
|
|
|
|
}
|
|
|
|
printf("#endif\n");
|
1994-06-15 19:49:03 +04:00
|
|
|
printf("\ta.a_desc = VDESC(%s);\n", name);
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
printf("\ta.a_%s = %s;\n", argname[i], argname[i]);
|
2004-09-21 07:10:35 +04:00
|
|
|
if (lockstate[i] != -1) {
|
|
|
|
printf("#ifdef VNODE_LOCKDEBUG\n");
|
|
|
|
printf("\tislocked_%s = (%s->v_flag & VLOCKSWORK) ? (VOP_ISLOCKED(%s) == LK_EXCLUSIVE) : %d;\n",
|
|
|
|
argname[i], argname[i], argname[i], lockstate[i]);
|
|
|
|
printf("\tif (islocked_%s != %d)\n", argname[i],
|
|
|
|
lockstate[i]);
|
|
|
|
printf("\t\tpanic(\"%s: %s: locked %%d, expected %%d\", islocked_%s, %d);\n", name, argname[i], argname[i], lockstate[i]);
|
|
|
|
printf("#endif\n");
|
|
|
|
}
|
1994-06-15 19:49:03 +04:00
|
|
|
}
|
|
|
|
printf("\treturn (VCALL(%s%s, VOFFSET(%s), &a));\n}\n",
|
|
|
|
argname[0], arg0special, name);
|
2000-09-13 19:50:26 +04:00
|
|
|
printf("#endif\n");
|
2001-01-22 12:52:21 +03:00
|
|
|
vops++;
|
1994-06-15 19:49:03 +04:00
|
|
|
}
|
|
|
|
BEGIN {
|
|
|
|
arg0special="";
|
2001-01-22 12:52:21 +03:00
|
|
|
vops = 1; # start at 1, to count the 'default' op
|
1994-06-15 19:49:03 +04:00
|
|
|
}
|
|
|
|
END {
|
|
|
|
printf("\n/* Special cases: */\n#include <sys/buf.h>\n");
|
|
|
|
argc=1;
|
|
|
|
argtype[0]="struct buf *";
|
|
|
|
argname[0]="bp";
|
2004-09-21 07:10:35 +04:00
|
|
|
lockstate[0] = -1;
|
1994-06-15 19:49:03 +04:00
|
|
|
arg0special="->b_vp";
|
|
|
|
name="vop_bwrite";
|
|
|
|
doit();
|
2001-01-22 12:52:21 +03:00
|
|
|
|
|
|
|
printf("\n#define VNODE_OPS_COUNT\t%d\n", vops);
|
1994-06-15 19:49:03 +04:00
|
|
|
}
|
1994-08-25 07:04:28 +04:00
|
|
|
'"$awk_parser" | sed -e "$anal_retentive"
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# End stuff
|
|
|
|
echo '
|
|
|
|
/* End of special cases. */'
|
1997-01-22 09:51:59 +03:00
|
|
|
echo ''
|
|
|
|
echo '#endif /* !_SYS_VNODE_IF_H_ */'
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
#
|
|
|
|
# Redirect stdout to the C file.
|
|
|
|
#
|
|
|
|
echo "$0: Creating $out_c" 1>&2
|
|
|
|
exec > $out_c
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# Begin stuff
|
1998-01-09 09:40:43 +03:00
|
|
|
echo -n "$warning" | sed -e 's/\$//g;s/@/\$/g'
|
1996-02-29 23:54:58 +03:00
|
|
|
echo ""
|
|
|
|
echo -n "$copyright"
|
2001-11-12 17:34:24 +03:00
|
|
|
echo "
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__KERNEL_RCSID(0, \"\$NetBSD\$\");
|
|
|
|
"
|
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
echo '
|
2000-09-13 20:09:27 +04:00
|
|
|
/*
|
|
|
|
* If we have LKM support, always include the non-inline versions for
|
|
|
|
* LKMs. Otherwise, do it based on the option.
|
|
|
|
*/
|
2000-12-22 18:09:46 +03:00
|
|
|
#ifdef LKM
|
2000-09-13 20:09:27 +04:00
|
|
|
#define VNODE_OP_NOINLINE
|
2000-12-22 18:09:46 +03:00
|
|
|
#else
|
|
|
|
#include "opt_vnode_op_noinline.h"
|
2004-09-21 07:10:35 +04:00
|
|
|
#endif
|
|
|
|
#include "opt_vnode_lockdebug.h"'
|
2000-09-13 20:09:27 +04:00
|
|
|
echo '
|
1994-06-08 15:28:29 +04:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/mount.h>
|
2000-09-13 19:50:26 +04:00
|
|
|
#include <sys/buf.h>
|
1994-06-08 15:28:29 +04:00
|
|
|
#include <sys/vnode.h>
|
|
|
|
|
2001-05-07 12:46:02 +04:00
|
|
|
const struct vnodeop_desc vop_default_desc = {
|
1994-06-08 15:28:29 +04:00
|
|
|
0,
|
|
|
|
"default",
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
VDESC_NO_OFFSET,
|
|
|
|
VDESC_NO_OFFSET,
|
|
|
|
VDESC_NO_OFFSET,
|
|
|
|
VDESC_NO_OFFSET,
|
|
|
|
NULL,
|
|
|
|
};
|
1994-06-15 19:49:03 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
# Body stuff
|
|
|
|
sed -e "$sed_prep" $src | $awk '
|
|
|
|
function do_offset(typematch) {
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
if (argtype[i] == typematch) {
|
|
|
|
printf("\tVOPARG_OFFSETOF(struct %s_args, a_%s),\n",
|
|
|
|
name, argname[i]);
|
|
|
|
return i;
|
1994-06-08 15:28:29 +04:00
|
|
|
};
|
1994-06-15 19:49:03 +04:00
|
|
|
};
|
|
|
|
print "\tVDESC_NO_OFFSET,";
|
|
|
|
return -1;
|
|
|
|
}
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
function doit() {
|
|
|
|
# Define offsets array
|
2001-01-18 23:28:15 +03:00
|
|
|
printf("\nconst int %s_vp_offsets[] = {\n", name);
|
1994-06-15 19:49:03 +04:00
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
if (argtype[i] == "struct vnode *") {
|
|
|
|
printf ("\tVOPARG_OFFSETOF(struct %s_args,a_%s),\n",
|
|
|
|
name, argname[i]);
|
|
|
|
}
|
1994-06-08 15:28:29 +04:00
|
|
|
}
|
1994-06-15 19:49:03 +04:00
|
|
|
print "\tVDESC_NO_OFFSET";
|
|
|
|
print "};";
|
|
|
|
# Define F_desc
|
2001-01-22 12:52:21 +03:00
|
|
|
printf("const struct vnodeop_desc %s_desc = {\n", name);
|
1994-06-15 19:49:03 +04:00
|
|
|
# offset
|
2001-01-22 12:52:21 +03:00
|
|
|
printf ("\t%d,\n", vop_offset++);
|
1994-06-15 19:49:03 +04:00
|
|
|
# printable name
|
|
|
|
printf ("\t\"%s\",\n", name);
|
|
|
|
# flags
|
|
|
|
printf("\t0");
|
|
|
|
vpnum = 0;
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
if (willrele[i]) {
|
1999-07-08 03:32:50 +04:00
|
|
|
if (willrele[i] == 2) {
|
|
|
|
word = "UNLOCK";
|
|
|
|
} else if (willrele[i] == 3) {
|
|
|
|
word = "PUT";
|
|
|
|
} else {
|
|
|
|
word = "RELE";
|
|
|
|
}
|
1994-06-15 19:49:03 +04:00
|
|
|
if (argdir[i] ~ /OUT/) {
|
1999-07-08 03:32:50 +04:00
|
|
|
printf(" | VDESC_VPP_WILL%s", word);
|
1994-06-15 19:49:03 +04:00
|
|
|
} else {
|
1999-07-08 03:32:50 +04:00
|
|
|
printf(" | VDESC_VP%s_WILL%s", vpnum, word);
|
1994-06-08 15:28:29 +04:00
|
|
|
};
|
1994-06-15 19:49:03 +04:00
|
|
|
vpnum++;
|
|
|
|
}
|
1994-06-08 15:28:29 +04:00
|
|
|
}
|
1994-06-15 19:49:03 +04:00
|
|
|
print ",";
|
|
|
|
# vp offsets
|
|
|
|
printf ("\t%s_vp_offsets,\n", name);
|
|
|
|
# vpp (if any)
|
|
|
|
do_offset("struct vnode **");
|
|
|
|
# cred (if any)
|
|
|
|
do_offset("struct ucred *");
|
2003-06-30 02:28:00 +04:00
|
|
|
# proc (if any)
|
|
|
|
do_offset("struct proc *");
|
1994-06-15 19:49:03 +04:00
|
|
|
# componentname
|
|
|
|
do_offset("struct componentname *");
|
|
|
|
# transport layer information
|
|
|
|
printf ("\tNULL,\n};\n");
|
2000-09-13 19:50:26 +04:00
|
|
|
|
|
|
|
# Define function.
|
|
|
|
printf("#ifdef VNODE_OP_NOINLINE\n");
|
|
|
|
printf("int\n%s(", toupper(name));
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
printf("%s", argname[i]);
|
|
|
|
if (i < (argc-1)) printf(", ");
|
|
|
|
}
|
|
|
|
printf(")\n");
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
printf("\t%s %s;\n", argtype[i], argname[i]);
|
|
|
|
}
|
|
|
|
printf("{\n\tstruct %s_args a;\n", name);
|
2004-09-21 07:10:35 +04:00
|
|
|
printf("#ifdef VNODE_LOCKDEBUG\n");
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
if (lockstate[i] != -1)
|
|
|
|
printf("\tint islocked_%s;\n", argname[i]);
|
|
|
|
}
|
|
|
|
printf("#endif\n");
|
2000-09-13 19:50:26 +04:00
|
|
|
printf("\ta.a_desc = VDESC(%s);\n", name);
|
|
|
|
for (i=0; i<argc; i++) {
|
|
|
|
printf("\ta.a_%s = %s;\n", argname[i], argname[i]);
|
2004-09-21 07:10:35 +04:00
|
|
|
if (lockstate[i] != -1) {
|
|
|
|
printf("#ifdef VNODE_LOCKDEBUG\n");
|
|
|
|
printf("\tislocked_%s = (%s->v_flag & VLOCKSWORK) ? (VOP_ISLOCKED(%s) == LK_EXCLUSIVE) : %d;\n",
|
|
|
|
argname[i], argname[i], argname[i], lockstate[i]);
|
|
|
|
printf("\tif (islocked_%s != %d)\n", argname[i],
|
|
|
|
lockstate[i]);
|
|
|
|
printf("\t\tpanic(\"%s: %s: locked %%d, expected %%d\", islocked_%s, %d);\n", name, argname[i], argname[i], lockstate[i]);
|
|
|
|
printf("#endif\n");
|
|
|
|
}
|
2000-09-13 19:50:26 +04:00
|
|
|
}
|
|
|
|
printf("\treturn (VCALL(%s%s, VOFFSET(%s), &a));\n}\n",
|
|
|
|
argname[0], arg0special, name);
|
|
|
|
printf("#endif\n");
|
|
|
|
}
|
|
|
|
BEGIN {
|
1994-06-15 19:49:03 +04:00
|
|
|
printf("\n/* Special cases: */\n");
|
2001-01-22 12:52:21 +03:00
|
|
|
# start from 1 (vop_default is at 0)
|
|
|
|
vop_offset=1;
|
1994-06-15 19:49:03 +04:00
|
|
|
argc=1;
|
|
|
|
argdir[0]="IN";
|
|
|
|
argtype[0]="struct buf *";
|
|
|
|
argname[0]="bp";
|
2004-09-21 07:10:35 +04:00
|
|
|
lockstate[0] = -1;
|
2000-09-13 19:50:26 +04:00
|
|
|
arg0special="->b_vp";
|
1994-06-15 19:49:03 +04:00
|
|
|
willrele[0]=0;
|
|
|
|
name="vop_bwrite";
|
|
|
|
doit();
|
2001-01-22 12:52:21 +03:00
|
|
|
printf("\n/* End of special cases */\n");
|
|
|
|
|
|
|
|
arg0special="";
|
1994-06-08 15:28:29 +04:00
|
|
|
}
|
1994-08-25 07:04:28 +04:00
|
|
|
'"$awk_parser" | sed -e "$anal_retentive"
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# End stuff
|
|
|
|
echo '
|
|
|
|
/* End of special cases. */'
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# Add the vfs_op_descs array to the C file.
|
|
|
|
# Begin stuff
|
|
|
|
echo '
|
2001-01-22 12:52:21 +03:00
|
|
|
const struct vnodeop_desc * const vfs_op_descs[] = {
|
1994-06-15 19:49:03 +04:00
|
|
|
&vop_default_desc, /* MUST BE FIRST */
|
|
|
|
&vop_bwrite_desc, /* XXX: SPECIAL CASE */
|
|
|
|
'
|
|
|
|
|
|
|
|
# Body stuff
|
|
|
|
sed -e "$sed_prep" $src | $awk '
|
|
|
|
function doit() {
|
|
|
|
printf("\t&%s_desc,\n", name);
|
1994-06-08 15:28:29 +04:00
|
|
|
}
|
1994-06-15 19:49:03 +04:00
|
|
|
'"$awk_parser"
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# End stuff
|
|
|
|
echo ' NULL
|
1994-06-08 15:28:29 +04:00
|
|
|
};
|
1994-06-15 19:49:03 +04:00
|
|
|
'
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
exit 0
|
1994-06-08 15:28:29 +04:00
|
|
|
|
1994-06-15 19:49:03 +04:00
|
|
|
# Local Variables:
|
|
|
|
# tab-width: 4
|
|
|
|
# End:
|