From fcde1e9ca0d577e58f0d608f1da06173c2636d93 Mon Sep 17 00:00:00 2001 From: pooka Date: Wed, 14 Apr 2010 13:58:51 +0000 Subject: [PATCH] Make rump vnode interface lightweight: the only things we really need are: 0) provide VOP_OP in the alternate RUMP_VOP_OP namespace and for each op: 1) schedule rump cpu 2) call VOP_OP 3) unschedule rump cpu While here, take the opportunity to get rid of _t lossage in the rump-exported interfaces. --- sys/kern/vnode_if.sh | 109 +++++++++++++++++++++++++++++++------------ 1 file changed, 78 insertions(+), 31 deletions(-) diff --git a/sys/kern/vnode_if.sh b/sys/kern/vnode_if.sh index d67334978911..14ead7a027f2 100644 --- a/sys/kern/vnode_if.sh +++ b/sys/kern/vnode_if.sh @@ -29,7 +29,7 @@ copyright="\ * SUCH DAMAGE. */ " -SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.55 2010/04/14 12:19:50 pooka Exp $' +SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.56 2010/04/14 13:58:51 pooka Exp $' # Script to produce VFS front-end sugar. # @@ -96,7 +96,7 @@ awk_parser=' /^#/ { next; } # First line of description /^vop_/ { - name=rump $1; + name=$1; argc=0; willmake=-1; next; @@ -143,11 +143,13 @@ awk_parser=' # nuke the types from the kernel, but that is a battle for # another day. at = $i; - if (length(rump) != 0) { + if (rump) { if (at == "vm_prot_t") at = "int"; if (at == "voff_t") at = "off_t"; + if (at == "kauth_cred_t") + at = "struct kauth_cred *" } argtype[argc] = at; i++; @@ -205,23 +207,27 @@ if [ ${lockdebug} -ne 0 ] ; then echo '#include "opt_vnode_lockdebug.h"' echo '#endif /* _KERNEL_OPT */' fi -echo " -extern const struct vnodeop_desc ${rump}vop_default_desc; -" +[ -z "${rump}" ] && echo " +extern const struct vnodeop_desc ${rump}vop_default_desc;" +echo # Body stuff # This awk program needs toupper() so define it if necessary. sed -e "$sed_prep" $src | $awk -v rump=${rump} "$toupper"' function doit() { + name = rump name # Declare arg struct, descriptor. - printf("\n#define %s_DESCOFFSET %d\n", toupper(name), vop_offset++); - printf("struct %s_args {\n", name); - printf("\tconst struct vnodeop_desc * a_desc;\n"); - for (i=0; i\n#endif\n"); + printf("struct buf;\n"); + if (rump) { + printf("struct flock;\n"); + printf("struct knote;\n"); + printf("struct vm_page;\n"); + } + printf("\n#ifndef _KERNEL\n#include \n#endif\n"); + printf("\n/* Special cases: */\n"); argc=1; argtype[0]="struct buf *"; argname[0]="bp"; lockstate[0] = -1; arg0special="->b_vp"; - name=rump "vop_bwrite"; + name="vop_bwrite"; doit(); printf("\n/* End of special cases */\n"); + if (rump) + printf("\n"); } END { - printf("\n#define VNODE_OPS_COUNT\t%d\n", vop_offset); + if (!rump) { + printf("\n#define VNODE_OPS_COUNT\t%d\n", vop_offset); + } } '"$awk_parser" | sed -e "$anal_retentive" @@ -295,8 +311,9 @@ echo ' [ ! -z "${rump}" ] && echo '#include ' \ && echo '#include "rump_private.h"' -echo " -const struct vnodeop_desc ${rump}vop_default_desc = {" +if [ -z "${rump}" ] ; then + echo " +const struct vnodeop_desc vop_default_desc = {" echo ' 0, "default", 0, @@ -306,6 +323,7 @@ echo ' 0, VDESC_NO_OFFSET, }; ' +fi # Body stuff sed -e "$sed_prep" $src | $awk -v rump=${rump} -v lockdebug=${lockdebug} ' @@ -321,9 +339,9 @@ function do_offset(typematch) { return -1; } -function doit() { +function offsets() { # Define offsets array - printf("\nconst int %s_vp_offsets[] = {\n", name); + printf("const int %s_vp_offsets[] = {\n", name); for (i=0; iv_vflag & VV_MPSAFE);\n", argname[0], arg0special); - if (rump) - printf("\trump_schedule();\n"); printf("\tif (!mpsafe) { KERNEL_LOCK(1, curlwp); }\n"); printf("\terror = (VCALL(%s%s, VOFFSET(%s), &a));\n", argname[0], arg0special, name); printf("\tif (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }\n"); - if (rump) - printf("\trump_unschedule();\n"); if (willmake != -1) { printf("#ifdef DIAGNOSTIC\n"); printf("\tif (error == 0)\n" \ @@ -417,6 +439,30 @@ function doit() { } printf("\treturn error;\n}\n"); } + +function doit() { + printf("\n"); + if (!rump) + offsets(); + + if (rump) + extname = "RUMP_" toupper(name); + else + extname = toupper(name); + + # Define function. + printf("int\n%s(", extname); + for (i=0; i