This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
tapset corrections
- From: Pierre Peiffer <pierre dot peiffer at bull dot net>
- To: systemtap at sourceware dot org
- Cc: Jean-Pierre Dion <jean-pierre dot dion at bull dot net>
- Date: Tue, 13 Feb 2007 12:58:39 +0100
- Subject: tapset corrections
Hi,
I'm currently discovering systemtap. When running the testsuite, I've found that
some tapset need some updates in order to run correctly with recent kernels
(2.6.19 or 2.6.20)
I've done some minor corrections, but I don't know exactly where I should post
them, so I attach a patch here, to this mail. It should apply on recent cvs tree.
Let me know if I need to proceed in another way.
There are two small things corrected:
1. redefinition of f_dentry in "struct file"
2. change of structure "struct rpc_xprt"
Thanks,
--
Pierre P.
Signed-off-by: Pierre Peiffer <Pierre.Peiffer@bull.net>
---
tapset/LKET/nfs.stp | 4 !!!!
tapset/nfs.stp | 22 !!!!!!!!!!!!!!!!!!!!!!
tapset/rpc.stp | 8 ++++++++
tapset/vfs.stp | 28 !!!!!!!!!!!!!!!!!!!!!!!!!!!!
4 files changed, 8 insertions(+), 54 modifications(!)
Index: src/tapset/LKET/nfs.stp
===================================================================
*** src.orig/tapset/LKET/nfs.stp 2007-02-09 08:31:48.000000000 +0100
--- src/tapset/LKET/nfs.stp 2007-02-09 17:09:21.000000000 +0100
***************
*** 1,8 ****
/* Helper functions */
function __file_fsname:string (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! struct inode *d_inode = f_dentry? kread(&(f_dentry->d_inode)) : NULL;
if (d_inode == NULL)
strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN);
else {
--- 1,8 ----
/* Helper functions */
function __file_fsname:string (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! struct inode *d_inode = dentry? kread(&(dentry->d_inode)) : NULL;
if (d_inode == NULL)
strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN);
else {
Index: src/tapset/nfs.stp
===================================================================
*** src.orig/tapset/nfs.stp 2007-02-09 08:31:49.000000000 +0100
--- src/tapset/nfs.stp 2007-02-09 16:58:19.000000000 +0100
*************** function __d_loff_t :long (ppos :long) %
*** 197,217 ****
function __file_inode:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL)
THIS->__retvalue = 0;
else
! THIS->__retvalue = (long)kread(&(f_dentry->d_inode));
CATCH_DEREF_FAULT();
%}
function __file_id:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL)
THIS->__retvalue = 0;
else {
! struct inode *d_inode = kread(&(f_dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = (long)&(i_sb->s_id);
}
--- 197,217 ----
function __file_inode:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL)
THIS->__retvalue = 0;
else
! THIS->__retvalue = (long)kread(&(dentry->d_inode));
CATCH_DEREF_FAULT();
%}
function __file_id:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL)
THIS->__retvalue = 0;
else {
! struct inode *d_inode = kread(&(dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = (long)&(i_sb->s_id);
}
*************** function __file_id:long (file:long) %{ /
*** 220,230 ****
function __file_mode:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL)
THIS->__retvalue = 0;
else {
! struct inode *d_inode = kread(&(f_dentry->d_inode));
THIS->__retvalue = kread(&(d_inode->i_mode));
}
CATCH_DEREF_FAULT();
--- 220,230 ----
function __file_mode:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL)
THIS->__retvalue = 0;
else {
! struct inode *d_inode = kread(&(dentry->d_inode));
THIS->__retvalue = kread(&(d_inode->i_mode));
}
CATCH_DEREF_FAULT();
*************** function __file_mode:long (file:long) %{
*** 232,239 ****
function __file_parentname:string (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! struct dentry *d_parent = f_dentry? kread(&(f_dentry->d_parent)) : NULL;
if (d_parent == NULL)
strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN);
else {
--- 232,239 ----
function __file_parentname:string (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! struct dentry *d_parent = dentry? kread(&(dentry->d_parent)) : NULL;
if (d_parent == NULL)
strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN);
else {
Index: src/tapset/rpc.stp
===================================================================
*** src.orig/tapset/rpc.stp 2007-02-09 08:31:49.000000000 +0100
--- src/tapset/rpc.stp 2007-02-12 13:11:51.000000000 +0100
*************** function port_from_clnt:long(clnt:long)
*** 879,887 ****
--- 879,895 ----
%{
struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt;
struct rpc_xprt *cl_xprt = clnt? kread(&(clnt->cl_xprt)) : NULL;
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
+ if (cl_xprt && kread(&(cl_xprt->addr.ss_family)) == AF_INET) {
+ /* Now consider ipv4 only */
+ struct sockaddr_in *sap = (struct sockaddr_in *) &cl_xprt->addr;
+
+ THIS->__retvalue = ntohs(kread(&(sap->sin_port)));
+ #else
if (cl_xprt && kread(&(cl_xprt->addr.sin_family)) == AF_INET) {
/* Now consider ipv4 only */
THIS->__retvalue = ntohs(kread(&(cl_xprt->addr.sin_port)));
+ #endif
} else
THIS->__retvalue = 0;
CATCH_DEREF_FAULT();
Index: src/tapset/vfs.stp
===================================================================
*** src.orig/tapset/vfs.stp 2007-02-09 08:31:50.000000000 +0100
--- src/tapset/vfs.stp 2007-02-09 16:52:34.000000000 +0100
*************** function __page_bdev:long (page:long) %{
*** 81,91 ****
function __file_dev:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(f_dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = kread(&(i_sb->s_dev));
}
--- 81,91 ----
function __file_dev:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = kread(&(i_sb->s_dev));
}
*************** function __file_dev:long (file:long) %{
*** 94,104 ****
function __file_bdev:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(f_dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = (long)kread(&(i_sb->s_bdev));
}
--- 94,104 ----
function __file_bdev:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = (long)kread(&(i_sb->s_bdev));
}
*************** function __file_bdev:long (file:long) %{
*** 107,117 ****
function __file_ino:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(f_dentry->d_inode));
THIS->__retvalue = kread(&(d_inode->i_ino));
}
CATCH_DEREF_FAULT();
--- 107,117 ----
function __file_ino:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(dentry->d_inode));
THIS->__retvalue = kread(&(d_inode->i_ino));
}
CATCH_DEREF_FAULT();
*************** function __file_ino:long (file:long) %{
*** 119,129 ****
function __file_maxbytes:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! if (f_dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(f_dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = kread(&(i_sb->s_maxbytes));
}
--- 119,129 ----
function __file_maxbytes:long (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! if (dentry == NULL) {
THIS->__retvalue = 0;
} else {
! struct inode *d_inode = kread(&(dentry->d_inode));
struct super_block *i_sb = kread(&(d_inode->i_sb));
THIS->__retvalue = kread(&(i_sb->s_maxbytes));
}
*************** function __file_maxbytes:long (file:long
*** 132,139 ****
function __file_filename:string (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *f_dentry = file? kread(&(file->f_dentry)) : NULL;
! const unsigned char *name = f_dentry? kread(&(f_dentry->d_name.name)) : NULL;
if (name == NULL) {
strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN);
} else {
--- 132,139 ----
function __file_filename:string (file:long) %{ /* pure */
struct file *file = (struct file *)(long)THIS->file;
! struct dentry *dentry = file? kread(&(file->f_dentry)) : NULL;
! const unsigned char *name = dentry? kread(&(dentry->d_name.name)) : NULL;
if (name == NULL) {
strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN);
} else {