summaryrefslogtreecommitdiffstats
path: root/tapset/fs.stp
diff options
context:
space:
mode:
Diffstat (limited to 'tapset/fs.stp')
-rw-r--r--tapset/fs.stp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tapset/fs.stp b/tapset/fs.stp
new file mode 100644
index 0000000..246fb79
--- /dev/null
+++ b/tapset/fs.stp
@@ -0,0 +1,31 @@
+
+probe fs.read.return = kernel.function("vfs_read").return {
+ bytes = ($return > 0 ? $return : 0)
+}
+
+probe fs.write.return = kernel.function("vfs_write").return {
+ bytes = ($return > 0 ? $return : 0)
+}
+
+function file2name:string(filep:long)
+%{
+ char *start = NULL, buf[MAXSTRINGLEN];
+ struct dentry *dentry = NULL;
+ struct vfsmount *mnt = NULL;
+ struct file *file = (struct file *)(long) kread(&(THIS->filep));
+
+ if (file) {
+/*
+ mnt = (struct vfsmount *) kread(&(file->f_path.mnt));
+ dentry = (struct dentry *) kread(&(file->f_path.dentry));
+*/
+ mnt = (struct vfsmount *) kread(&(file->f_vfsmnt));
+ dentry = (struct dentry *) kread(&(file->f_dentry));
+ }
+ if (mnt && dentry)
+ start = d_path(dentry, mnt, buf, MAXSTRINGLEN);
+ if (start > 0)
+ strlcpy(THIS->__retvalue, start, MAXSTRINGLEN);
+
+ CATCH_DEREF_FAULT();
+%}