diff options
author | jeff <jeff@FreeBSD.org> | 2002-07-06 03:46:36 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-07-06 03:46:36 +0000 |
commit | e46b098b802ad19a3c592eac2df955c06780f6a6 (patch) | |
tree | 6d58ba75508707a1973476379daddafa73f8dbca /sys/tools | |
parent | 91ba571baa7e4bd1bba3d3e6b78e07e058538a9e (diff) | |
download | FreeBSD-src-e46b098b802ad19a3c592eac2df955c06780f6a6.zip FreeBSD-src-e46b098b802ad19a3c592eac2df955c06780f6a6.tar.gz |
Add a new configuration directive that inserts calls to debugging functions
in the VOP inlines. This is intended to replace the simple locking
specifications for calls that have more complicated behavior such as rename and
lookup.
The syntax of the new entries is:
#! name pre/post function
If the function is marked 'pre' it is executed prior to calling the VOP and
takes a pointer to a struct vop_{name}_args as it's only parameter.
If the function is marked 'post' it is executed after the VOP call and takes
a pointer to a struct vop_{name}_args as it's first parameter and the integer
return value from the vop as the second paramter.
Diffstat (limited to 'sys/tools')
-rw-r--r-- | sys/tools/vnode_if.awk | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk index 46f53fb..16475e4 100644 --- a/sys/tools/vnode_if.awk +++ b/sys/tools/vnode_if.awk @@ -77,6 +77,20 @@ function add_debug_code(name, arg) } } +function add_debug_pre(name) +{ + if (debug_all_vfs_locks && lockdata[name, "pre"]) { + printh("\t"lockdata[name, "pre"]"(&a);"); + } +} + +function add_debug_post(name) +{ + if (debug_all_vfs_locks && lockdata[name, "post"]) { + printh("\t"lockdata[name, "post"]"(&a, rc);"); + } +} + function find_arg_with_type (type) { for (jj = 0; jj < numargs; jj++) { @@ -147,7 +161,7 @@ if (cfile) { while ((getline < srcfile) > 0) { if (NF == 0) continue; - if ($1 ~ /^#/) { + if ($1 ~ /^#%/) { if (NF != 6 || $1 != "#%" || \ $2 !~ /^[a-z]+$/ || $3 !~ /^[a-z]+$/ || \ $4 !~ /^.$/ || $5 !~ /^.$/ || $6 !~ /^.$/) @@ -158,6 +172,17 @@ while ((getline < srcfile) > 0) { continue; } + if ($1 ~ /^#!/) { + if (NF != 4 || $1 != "#!") + continue; + if ($3 != "pre" && $3 != "post") + continue; + lockdata["vop_" $2, $3] = $4; + continue; + } + if ($1 ~ /^#/) + continue; + # Get the function name. name = $1; uname = toupper(name); @@ -228,7 +253,9 @@ while ((getline < srcfile) > 0) { printh("\ta.a_" args[i] " = " args[i] ";"); for (i = 0; i < numargs; ++i) add_debug_code(name, args[i]); + add_debug_pre(name); printh("\trc = VCALL(" args[0] ", VOFFSET(" name "), &a);"); + add_debug_post(name); printh("\treturn (rc);\n}"); } |