Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Support for vnode operation versioning. Allow a ne...



details:   https://anonhg.NetBSD.org/src/rev/9146fe48a325
branches:  trunk
changeset: 792690:9146fe48a325
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Jan 13 12:07:55 2014 +0000

description:
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.

diffstat:

 sys/kern/vnode_if.sh |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (69 lines):

diff -r 84cc663b2e9c -r 9146fe48a325 sys/kern/vnode_if.sh
--- a/sys/kern/vnode_if.sh      Mon Jan 13 11:08:14 2014 +0000
+++ b/sys/kern/vnode_if.sh      Mon Jan 13 12:07:55 2014 +0000
@@ -29,7 +29,7 @@
  * 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 @@
 # First line of description
 /^vop_/        {
        name=$1;
+       args_name=$1;
        argc=0;
        willmake=-1;
        next;
@@ -108,6 +109,11 @@
 }
 # 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 @@
        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 @@
        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 @@
        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 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++) {



Home | Main Index | Thread Index | Old Index