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]

Updating pfiles


Hi,

I wanted to update pfiles.sh as found on
http://sourceware.org/systemtap/wiki/WSPfiles to support 2.6.25 kernels.
This seems simple with the attached patch. But I cannot get the kread()
statement right with the new struct path. What would be the correct
kread() magic to wrap this in a secure way?

Thanks,

Mark
--- pfiles.sh.orig	2008-05-22 13:31:09.000000000 +0200
+++ pfiles.sh	2008-05-22 13:31:46.000000000 +0200
@@ -20,7 +20,7 @@
 # - report pathname information
 # - report socket information (thanks Luis Henriques)
 #
-# Last updated: Sat Jan 19 22:40:15 SGT 2008
+# Last updated: Thu May 22 13:30:14 CEST 2008
 #
 # $ pfiles.sh $$ | head -5
 # 30527: bash
@@ -287,15 +287,25 @@
 	struct files_struct *files = kread(&p->files);
 	char *page = (char *)__get_free_page(GFP_KERNEL);
 	struct file *filp;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
 	struct dentry *dentry;
 	struct vfsmount *vfsmnt;
+#else
+	struct path path;
+#endif
 
 	spin_lock(&files->file_lock);
 	filp = fcheck_files(files, THIS->fd);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
 	dentry = kread(&filp->f_dentry);
 	vfsmnt = kread(&filp->f_vfsmnt);
 	snprintf(THIS->__retvalue, MAXSTRINGLEN, "      %s",
 			d_path(dentry, vfsmnt, page, PAGE_SIZE));
+#else
+	path = filp->f_path;
+	snprintf(THIS->__retvalue, MAXSTRINGLEN, "      %s",
+			d_path(&path, page, PAGE_SIZE));
+#endif
 	free_page((unsigned long)page);
 	spin_unlock(&files->file_lock);
 	CATCH_DEREF_FAULT();

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