]> sourceware.org Git - systemtap.git/commitdiff
Get d_path's root natively with @cast
authorJosh Stone <jistone@redhat.com>
Fri, 12 Mar 2010 19:39:52 +0000 (11:39 -0800)
committerJosh Stone <jistone@redhat.com>
Fri, 12 Mar 2010 19:39:52 +0000 (11:39 -0800)
As mjw's aborted commit 5ab0b1b6 attempted, we can use a @cast to get
the filesystem root for the current task instead of embedded-C.  I've
left it using the kernel debuginfo instead of headers for now, because
all of the neighboring @casts are doing the same.

* tapset/dentry.stp (d_path): Use @cast to get the root.
  (__dentry_get_current_root): Remove, no longer needed.
* testsuite/buildok/dentry.stp: Test that dentry's functions all build.

tapset/dentry.stp
testsuite/buildok/dentry.stp [new file with mode: 0755]

index 1d045d02bbe2f040ce4213a3f15f547f4864d47d..bae022da5e6d2d198d911ff286f0e219320696ce 100644 (file)
@@ -30,20 +30,6 @@ function __dentry_prepend:string(dentry:long,name:string)
 
 
 
-%{
-#include <linux/sched.h>
-#include <linux/fs_struct.h>
-%}
-
-
-function __dentry_get_current_root:long()
-%{
-        THIS->__retvalue = (long)&current->fs->root;
-%}
-
-
-
-
 /**
  *   sfunction d_name - get the dirent name
  *
@@ -85,7 +71,7 @@ function reverse_path_walk:string(dentry:long)
  */
 function d_path:string(nd:long)
 {
-        root = __dentry_get_current_root()
+        root = & @cast(task_current(), "task_struct")->fs->root
        dentry = (@defined(@cast(nd,"nameidata")->path->dentry)
            ? @cast(nd,"nameidata")->path->dentry
            : @cast(nd,"nameidata")->dentry)
diff --git a/testsuite/buildok/dentry.stp b/testsuite/buildok/dentry.stp
new file mode 100755 (executable)
index 0000000..ed9b7c0
--- /dev/null
@@ -0,0 +1,8 @@
+#! stap -p4
+
+probe begin
+{
+    println(d_name(0))
+    println(d_path(0))
+    println(reverse_path_walk(0))
+}
This page took 0.031271 seconds and 5 git commands to generate.