Module Name:    src
Committed By:   hannken
Date:           Mon Jan 13 12:07:55 UTC 2014

Modified Files:
        src/sys/kern: vnode_if.sh

Log Message:
Support for vnode operation versioning.  Allow a new keyword "VERSION"
in the description so "VERSION 2" will change the name of the argument
from vop_XXX_args to vop_XXX_v2_args.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/kern/vnode_if.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vnode_if.sh
diff -u src/sys/kern/vnode_if.sh:1.59 src/sys/kern/vnode_if.sh:1.60
--- src/sys/kern/vnode_if.sh:1.59	Wed Jul 17 21:20:53 2013
+++ src/sys/kern/vnode_if.sh	Mon Jan 13 12:07:55 2014
@@ -29,7 +29,7 @@ copyright="\
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.59 2013/07/17 21:20:53 pooka Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.60 2014/01/13 12:07:55 hannken Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -97,6 +97,7 @@ awk_parser='
 # First line of description
 /^vop_/	{
 	name=$1;
+	args_name=$1;
 	argc=0;
 	willmake=-1;
 	next;
@@ -108,6 +109,11 @@ awk_parser='
 }
 # Middle lines of description
 {
+	if ($1 == "VERSION") {
+		args_name=args_name "_v" $2;
+		next;
+	}
+
 	argdir[argc] = $1; i=2;
 
 	if ($2 == "LOCKED=YES") {
@@ -222,7 +228,7 @@ function doit() {
 	if (!rump) {
 		printf("\n#define %s_DESCOFFSET %d\n",
 		    toupper(name), vop_offset++);
-		printf("struct %s_args {\n", name);
+		printf("struct %s_args {\n", args_name);
 		printf("\tconst struct vnodeop_desc * a_desc;\n");
 		for (i=0; i<argc; i++) {
 			printf("\t%s a_%s;\n", argtype[i], argname[i]);
@@ -322,7 +328,7 @@ 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]);
+				args_name, argname[i]);
 			return i;
 		};
 	};
@@ -336,7 +342,7 @@ function offsets() {
 	for (i=0; i<argc; i++) {
 		if (argtype[i] == "struct vnode *") {
 			printf ("\tVOPARG_OFFSETOF(struct %s_args,a_%s),\n",
-				name, argname[i]);
+				args_name, argname[i]);
 		}
 	}
 	print "\tVDESC_NO_OFFSET";
@@ -389,7 +395,8 @@ function bodyrump() {
 }
 
 function bodynorm() {
-	printf("{\n\tint error;\n\tbool mpsafe;\n\tstruct %s_args a;\n", name);
+	printf("{\n\tint error;\n\tbool mpsafe;\n\tstruct %s_args a;\n",
+		args_name);
 	if (lockdebug) {
 		printf("#ifdef VNODE_LOCKDEBUG\n");
 		for (i=0; i<argc; i++) {

Reply via email to