summaryrefslogtreecommitdiffstats
path: root/tapset/nfsd.stp
diff options
context:
space:
mode:
authorjistone <jistone>2007-02-07 02:54:30 +0000
committerjistone <jistone>2007-02-07 02:54:30 +0000
commitb8772cce090adb3d27cdd8b49d236662b526424e (patch)
treef216b71b2bea50d0bd95c9d22956a07e0b6fa49c /tapset/nfsd.stp
parent3b4136ca14c78881c50e8c36fa35fa574edaabb4 (diff)
downloadsystemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.tar.gz
systemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.tar.xz
systemtap-steved-b8772cce090adb3d27cdd8b49d236662b526424e.zip
2007-02-06 Josh Stone <joshua.i.stone@intel.com>
* aux_syscalls.stp, inet_sock.stp, ioblock.stp, ioscheduler.stp, nfs.stp, nfs_proc.stp, nfsd.stp, rpc.stp, scsi.stp, signal.stp, socket.stp, task.stp, tcp.stp, vfs.stp: Protect pointer dereferences with kread wherever possible. Some places still have hazards, as marked with FIXMEs. * errno.stp (returnstr): Don't use return in tapset C functions. * aux_syscalls.stp (__uget_timex_m): Ditto. * nfsd.stp (__get_fh): Ditto. * nfs.stp, vfs.stp (<many functions>): Ditto. * string.stp (substr): Ditto. Also make sure start index is valid. * syscalls.stp (syscall.execve): Change __string to kernel_string. LKET/ * nfs.stp, nfs_proc.stp, nfsd.stp, process.stp, tskdispatch.stp: Protect pointer dereferences with kread wherever possible. Some places still have hazards, as marked with FIXMEs. * aio.stp (log_io_getevents): Don't use return in tapset C functions. * timestamp.stp (set_timing_method): Ditto. * utils.stp (filter_by_pid): Ditto.
Diffstat (limited to 'tapset/nfsd.stp')
-rw-r--r--tapset/nfsd.stp57
1 files changed, 17 insertions, 40 deletions
diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp
index 8d8a09a0..49f04f51 100644
--- a/tapset/nfsd.stp
+++ b/tapset/nfsd.stp
@@ -6,26 +6,6 @@
#include <linux/nfsd/xdr3.h>
%}
-%{
-/*Get file handle from struct svc_fh */
-char * fh_fmt(struct svc_fh * fhp)
-{
- struct knfsd_fh *fh = &fhp->fh_handle;
-
- static char buf[80];
- sprintf(buf, "%d: %08x %08x %08x %08x %08x %08x",
- fh->fh_size,
- fh->fh_base.fh_pad[0],
- fh->fh_base.fh_pad[1],
- fh->fh_base.fh_pad[2],
- fh->fh_base.fh_pad[3],
- fh->fh_base.fh_pad[4],
- fh->fh_base.fh_pad[5]);
- return buf;
-}
-
-%}
-
/*
*1 : nfsd.proc2.lookup
*2 : nfsd.proc3.lookup
@@ -61,7 +41,6 @@ function __get_fh:long(argp:long,index:long) %{ /* pure */
struct nfsd_renameargs *argpren = NULL;
struct nfsd3_renameargs *argpren3 = NULL;
struct svc_fh * fhp = NULL;
- char * buf;
switch(index)
{
@@ -112,32 +91,30 @@ function __get_fh:long(argp:long,index:long) %{ /* pure */
break;
}
- if(fhp == NULL)
- {
- _stp_printf("the fhp is NULL");
- return;
- }
- else
- {
- /* buf = fh_fmt(fhp);
- strlcpy (THIS->__retvalue,buf,80);*/
- THIS->__retvalue = (long)fhp;
- }
+ THIS->__retvalue = (long)fhp;
%}
-/*Get file handler from struct svc_fh , it will call
-fh_fmt function*/
+/*Get file handler from struct svc_fh */
function __svc_fh:string(fh :long) %{ /* pure */
- struct svc_fh * fhp = (struct svc_fh *) (THIS->fh);
- char * buf ;
-
- buf = fh_fmt(fhp);
- strlcpy (THIS->__retvalue,buf,80);
+ struct svc_fh * fhp = (struct svc_fh *) (long)(THIS->fh);
+ struct knfsd_fh *fh = &fhp->fh_handle;
+
+ snprintf(THIS->__retvalue, MAXSTRINGLEN,
+ "%d: %08x %08x %08x %08x %08x %08x",
+ kread(&(fh->fh_size)),
+ kread(&(fh->fh_base.fh_pad[0])),
+ kread(&(fh->fh_base.fh_pad[1])),
+ kread(&(fh->fh_base.fh_pad[2])),
+ kread(&(fh->fh_base.fh_pad[3])),
+ kread(&(fh->fh_base.fh_pad[4])),
+ kread(&(fh->fh_base.fh_pad[5])))
+ CATCH_DEREF_FAULT();
%}
function p_long:long(cnt:long) %{ /* pure */
unsigned long * count = (unsigned long *)((long)THIS->cnt);
- THIS->__retvalue = *count;
+ THIS->__retvalue = kread(count);
+ CATCH_DEREF_FAULT();
%}
/*
*probe nfsd.dispatch