This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] Factor out d_path printing for any dentry.


---
 tapset/dentry.stp |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/tapset/dentry.stp b/tapset/dentry.stp
index bae022d..0ed50ef 100644
--- a/tapset/dentry.stp
+++ b/tapset/dentry.stp
@@ -63,21 +63,18 @@ function reverse_path_walk:string(dentry:long)
 
 
 /**
- *   sfunction d_path - get the full nameidata path
+ *   sfunction task_dentry_path - get the full dentry path
  *
  *   Returns the full dirent name (full path to the root), like
  *   the kernel d_path function.
- *   @nd: Pointer to nameidata.
+ *   @task: task_struct pointer.
+ *   @dentry: direntry pointer.
+ *   @vfsmnt: vfsmnt pointer.
  */
-function d_path:string(nd:long)
+function task_dentry_path:string(task:long,dentry:long,vfsmnt:long)
 {
-        root = & @cast(task_current(), "task_struct")->fs->root
-	dentry = (@defined(@cast(nd,"nameidata")->path->dentry)
-	    ? @cast(nd,"nameidata")->path->dentry
-	    : @cast(nd,"nameidata")->dentry)
-	vfsmnt = (@defined(@cast(nd,"nameidata")->path->mnt)
-	    ? @cast(nd,"nameidata")->path->mnt
-	    : @cast(nd,"nameidata")->mnt)
+        root = & @cast(task, "task_struct")->fs->root
+
         while (1) {
                 if (dentry == @cast(root, "path")->dentry &&
                     vfsmnt == @cast(root, "path")->mnt)
@@ -99,3 +96,24 @@ function d_path:string(nd:long)
 
         return sprintf("/%s", name);
 }
+
+
+
+/**
+ *   sfunction d_path - get the full nameidata path
+ *
+ *   Returns the full dirent name (full path to the root), like
+ *   the kernel d_path function.
+ *   @nd: Pointer to nameidata.
+ */
+function d_path:string(nd:long)
+{
+	dentry = (@defined(@cast(nd,"nameidata")->path->dentry)
+	    ? @cast(nd,"nameidata")->path->dentry
+	    : @cast(nd,"nameidata")->dentry)
+	vfsmnt = (@defined(@cast(nd,"nameidata")->path->mnt)
+	    ? @cast(nd,"nameidata")->path->mnt
+	    : @cast(nd,"nameidata")->mnt)
+
+	return task_dentry_path(task_current(), dentry, vfsmnt)
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]