diff options
author | Steve Dickson <steved@redhat.com> | 2008-01-29 15:02:30 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2008-01-29 15:02:30 -0500 |
commit | a0630d519e87f5c5d851d3127085a50592bb20b4 (patch) | |
tree | 589aff766c2131f715b595de40ed19b57719b0cb /tapset | |
download | systemtap-a0630d519e87f5c5d851d3127085a50592bb20b4.tar.gz systemtap-a0630d519e87f5c5d851d3127085a50592bb20b4.tar.xz systemtap-a0630d519e87f5c5d851d3127085a50592bb20b4.zip |
Initial Commit
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/cache_detail.stp | 17 | ||||
-rw-r--r-- | tapset/cachiodata.stp | 175 | ||||
-rw-r--r-- | tapset/fs.stp | 31 | ||||
-rw-r--r-- | tapset/nfs4_callback.stp | 35 | ||||
-rw-r--r-- | tapset/nfs4errno.stp | 77 | ||||
-rw-r--r-- | tapset/nfs4ops.stp | 83 | ||||
-rw-r--r-- | tapset/nfsd4_secinfo.stp | 32 | ||||
-rw-r--r-- | tapset/nfsd_fh.stp | 69 | ||||
-rw-r--r-- | tapset/nfsderrno.stp | 105 | ||||
-rw-r--r-- | tapset/nfsderrno.stp.orig | 70 | ||||
-rw-r--r-- | tapset/nfsmntflags.stp | 41 | ||||
-rw-r--r-- | tapset/nfsunlinkdata.stp | 25 | ||||
-rw-r--r-- | tapset/sock.stp | 87 | ||||
-rw-r--r-- | tapset/svc_error.stp | 32 | ||||
-rw-r--r-- | tapset/svc_export.stp | 61 |
15 files changed, 940 insertions, 0 deletions
diff --git a/tapset/cache_detail.stp b/tapset/cache_detail.stp new file mode 100644 index 0000000..2a34c46 --- /dev/null +++ b/tapset/cache_detail.stp @@ -0,0 +1,17 @@ +function cache_head_dump:string(_detail:long, _h:long) +%{ + struct cache_detail *detail = (struct cache_detail *)(long) kread(&(THIS->_detail)); + struct cache_head *h = (struct cache_head *)(long) kread(&(THIS->_h)); + char buf[MAXSTRINGLEN]; + int cc=0; + + sprintf(buf+cc, "h %p valid %d neg %d pending %d flushing %d ", + h, test_bit(0, &h->flags), test_bit(1, &h->flags), + test_bit(2, &h->flags), (detail->flush_time > h->last_refresh)); + cc = strlen(buf); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} + diff --git a/tapset/cachiodata.stp b/tapset/cachiodata.stp new file mode 100644 index 0000000..441e9fa --- /dev/null +++ b/tapset/cachiodata.stp @@ -0,0 +1,175 @@ + +function svc_export_data:string(msg:string) +%{ + char *tmp, *ptr, *str; + char buf[1024], cc; + + str = ptr = THIS->msg; + tmp = buf; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp,"clnt:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp+cc,"path:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"expire: %s ", str); + cc = strlen(tmp); + } + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"flags: %s ", str); + cc = strlen(tmp); + } + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"uid: %s ", str); + cc = strlen(tmp); + } + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"gid: %s ", str); + cc = strlen(tmp); + } + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"fsid: %s ", str); + cc = strlen(tmp); + } + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + if (strcmp(str, "uuid") == 0) + str = ptr; + sprintf(tmp+cc,"uuid: %s ", str); + cc = strlen(tmp); + } + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); +%} + +function ip_map_data:string(msg:string) +%{ + char *tmp, *ptr, *str; + char buf[1024], cc; + + str = ptr = THIS->msg; + tmp = buf; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp,"class:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp+cc,"addr:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"domain: %s ", str); + cc = strlen(tmp); + } + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); +%} +function expkey_data:string(msg:string) +%{ + char *tmp, *ptr, *str; + char buf[1024], cc; + + str = ptr = THIS->msg; + tmp = buf; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp,"client:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp+cc,"fsidtype:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"fsid: %s ", str); + cc = strlen(tmp); + } + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"path:'%s' ", str); + cc = strlen(tmp); + } + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); +%} +function idtoname_data:string(msg:string) +%{ + char *tmp, *ptr, *str; + char buf[1024], cc; + + str = ptr = THIS->msg; + tmp = buf; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp,"authname:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + *ptr++ = '\0'; + sprintf(tmp+cc,"type:'%s' ", str); + cc = strlen(tmp); + + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"id: %s ", str); + cc = strlen(tmp); + } + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"expiry:'%s' ", str); + cc = strlen(tmp); + } + str = ptr; + while (ptr != NULL && *ptr != ' ') ptr++; + if (ptr != NULL ) { + *ptr++ = '\0'; + sprintf(tmp+cc,"name:'%s' ", str); + cc = strlen(tmp); + } + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); +%} 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(); +%} diff --git a/tapset/nfs4_callback.stp b/tapset/nfs4_callback.stp new file mode 100644 index 0000000..351f0f2 --- /dev/null +++ b/tapset/nfs4_callback.stp @@ -0,0 +1,35 @@ +%{ +#include <linux/socket.h> +#include <net/sock.h> +#include <net/inet_sock.h> + +#include <linux/sunrpc/svc.h> + +#include <linux/nfs4.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/nfsd/state.h> +%} + +function nfs4_callback:string(_stp:long) +%{ + struct nfs4_stateid *stp = (struct nfs4_stateid *) + (long) kread(&(THIS->_stp)); + struct nfs4_stateowner *sop = (struct nfs4_stateowner *) + (long) kread(&stp->st_stateowner); + struct nfs4_client *so_client = (struct nfs4_client *) + (long)kread(&sop->so_client); + struct nfs4_callback *cb = (struct nfs4_callback *) + &so_client->cl_callback; + + char buf[MAXSTRINGLEN]; + int cc=0; + + snprintf(buf+cc, MAXSTRINGLEN, "cb: cb_set %d so_confirmed %d", + cb->cb_set.counter, sop->so_confirmed); + + cc = strlen(buf); + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); + +%} diff --git a/tapset/nfs4errno.stp b/tapset/nfs4errno.stp new file mode 100644 index 0000000..eb5aee7 --- /dev/null +++ b/tapset/nfs4errno.stp @@ -0,0 +1,77 @@ + +%{ +#include <linux/kernel.h> +#include <linux/linkage.h> +#include <linux/time.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/stat.h> +#include <linux/fcntl.h> +#include <linux/net.h> +#include <linux/in.h> +#include <linux/namei.h> +#include <linux/unistd.h> +#include <linux/slab.h> +#include <linux/nfs.h> +#include <linux/nfs4.h> +%} + +function nfs4error:string(err:long) +%{ + static struct { + int nfserr; + char *string; + } nfs_errtbl[] = { + { NFS4_OK, "Success" }, + { NFS4ERR_PERM, "NFS4ERR_PERM" }, + { NFS4ERR_NOENT, "NFS4ERR_NOENT" }, + { NFS4ERR_IO, "NFS4ERR_IO" }, + { NFS4ERR_NXIO, "NFS4ERR_NXIO" }, + { NFS4ERR_ACCESS, "NFS4ERR_ACCESS" }, + { NFS4ERR_EXIST, "NFS4ERR_EXIST" }, + { NFS4ERR_XDEV, "NFS4ERR_XDEV" }, + { NFS4ERR_NOTDIR, "NFS4ERR_NOTDIR" }, + { NFS4ERR_ISDIR, "NFS4ERR_ISDIR" }, + { NFS4ERR_INVAL, "NFS4ERR_INVAL" }, + { NFS4ERR_FBIG, "NFS4ERR_FBIG" }, + { NFS4ERR_NOSPC, "NFS4ERR_NOSPC" }, + { NFS4ERR_ROFS, "NFS4ERR_ROFS" }, + { NFS4ERR_MLINK, "NFS4ERR_MLINK" }, + { NFS4ERR_NAMETOOLONG, "NFS4ERR_NAMETOOLONG" }, + { NFS4ERR_NOTEMPTY, "NFS4ERR_NOTEMPTY" }, + { NFS4ERR_DQUOT, "NFS4ERR_DQUOT" }, + { NFS4ERR_STALE, "NFS4ERR_STALE" }, + { NFS4ERR_BADHANDLE, "NFS4ERR_BADHANDLE" }, + { NFS4ERR_BADOWNER, "NFS4ERR_BADOWNER" }, + { NFS4ERR_BADNAME, "NFS4ERR_BADNAME" }, + { NFS4ERR_BAD_COOKIE, "NFS4ERR_BAD_COOKIE" }, + { NFS4ERR_NOTSUPP, "NFS4ERR_NOTSUPP" }, + { NFS4ERR_TOOSMALL, "NFS4ERR_TOOSMALL" }, + { NFS4ERR_SERVERFAULT, "NFS4ERR_SERVERFAULT" }, + { NFS4ERR_BADTYPE, "NFS4ERR_BADTYPE" }, + { NFS4ERR_LOCKED, "NFS4ERR_LOCKED" }, + { NFS4ERR_RESOURCE, "NFS4ERR_RESOURCE" }, + { NFS4ERR_SYMLINK, "NFS4ERR_SYMLINK" }, + { NFS4ERR_OP_ILLEGAL, "NFS4ERR_OP_ILLEGAL" }, + { NFS4ERR_DEADLOCK, "NFS4ERR_DEADLOCK" }, + { NFS4ERR_WRONGSEC, "NFS4ERR_WRONGSEC" }, /* FIXME: this needs + * to be handled by a + * middle-layer. + */ + { -1, "Bad Error Code" } + }; + int i; + int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (nfs_errtbl[i].nfserr == THIS->err) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "nfs4err %d", ntohl(THIS->err)); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, + "nfs4err %d(%s)", nfs_errtbl[i].nfserr, nfs_errtbl[i].string); + +%} diff --git a/tapset/nfs4ops.stp b/tapset/nfs4ops.stp new file mode 100644 index 0000000..07fc53a --- /dev/null +++ b/tapset/nfs4ops.stp @@ -0,0 +1,83 @@ +%{ +#include <linux/fs.h> +#include <linux/socket.h> +#include <net/sock.h> +#include <net/inet_sock.h> + +#include <linux/sunrpc/svc.h> + +#include <linux/nfs4.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/nfsd/export.h> +#include <linux/nfsd/state.h> +#include <linux/nfsd/nfsd.h> +#include <linux/nfsd/xdr4.h> +%} + +function nfs4ops:string(_compars:long) +%{ + + struct nfsd4_compoundargs *args = (struct nfsd4_compoundargs *) + (long)kread(&(THIS->_compars)); + /* + struct nfsd4_op *op = (struct nfsd4_op *) (long)kread(&(args->ops)); + */ + struct nfsd4_op *op = args->iops; + char buf[MAXSTRINGLEN]; + int cc=0, i; + static struct { + int optnum; + char *optstr; + } nfs4_opttab[] = { + {0, "NULL"}, + {1, "COMPOUND"}, + {2, "SLOT2"}, + {OP_ACCESS, "ACCESS"}, + {OP_CLOSE, "CLOSE"}, + {OP_COMMIT, "COMMIT"}, + {OP_CREATE, "CREATE"}, + {OP_DELEGPURGE, "DELEGPURGE"}, + {OP_DELEGRETURN, "DELEGRETURN"}, + {OP_GETATTR, "GETATTR"}, + {OP_GETFH, "GETFH"}, + {OP_LINK, "LINK"}, + {OP_LOCK, "LOCK"}, + {OP_LOCKT, "LOCKT"}, + {OP_LOCKU, "LOCKU"}, + {OP_LOOKUP, "LOOKUP"}, + {OP_LOOKUPP, "LOOKUPP"}, + {OP_NVERIFY, "NVERIFY"}, + {OP_OPEN, "OPEN"}, + {OP_OPENATTR, "OPENATTR"}, + {OP_OPEN_CONFIRM, "OPEN_CONFIRM"}, + {OP_OPEN_DOWNGRADE, "OPEN_DOWNGRADE"}, + {OP_PUTFH, "PUTFH"}, + {OP_PUTPUBFH, "PUTPUBFH"}, + {OP_PUTROOTFH, "PUTROOTFH"}, + {OP_READ, "READ"}, + {OP_READDIR, "READDIR"}, + {OP_READLINK, "READLINK"}, + {OP_REMOVE, "REMOVE"}, + {OP_RENAME, "RENAME"}, + {OP_RENEW, "RENEW"}, + {OP_RESTOREFH, "RESTOREFH"}, + {OP_SAVEFH, "SAVEFH"}, + {OP_SECINFO, "SECINFO"}, + {OP_SETATTR, "SETATTR"}, + {OP_SETCLIENTID, "SETCLIENTID"}, + {OP_SETCLIENTID_CONFIRM, "SETCLIENTID_CONFIRM"}, + {OP_VERIFY, "VERIFY"}, + {OP_WRITE, "WRITE"}, + {OP_RELEASE_LOCKOWNER, "RELEASE_LOCKOWNER"}, + {OP_ILLEGAL, "ILLEGAL"}, + }; + + for (i=0; i < args->opcnt; i++) { + op = &args->ops[i]; + sprintf(buf+cc, "%s(%d) ", nfs4_opttab[op->opnum].optstr, op->opnum); + cc = strlen(buf); + } + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} diff --git a/tapset/nfsd4_secinfo.stp b/tapset/nfsd4_secinfo.stp new file mode 100644 index 0000000..69ae6c2 --- /dev/null +++ b/tapset/nfsd4_secinfo.stp @@ -0,0 +1,32 @@ +%{ +#include <linux/sunrpc/svc.h> +#include <linux/sunrpc/cache.h> + +#include <linux/nfsd/nfsd.h> +#include <linux/nfsd/export.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/nfsd/state.h> +#include <linux/nfsd/xdr4.h> +%} + +function nfsd4_secinfo_dump:string(_secinfo:long) +%{ + struct nfsd4_secinfo *secinfo = + (struct nfsd4_secinfo *)(long) kread(&(THIS->_secinfo)); + char buf[MAXSTRINGLEN], *si_name=NULL; + int cc=0; + + if (secinfo <= 0) { + sprintf(buf+cc, "secinfo NULL"); + } else { + if (secinfo->si_namelen) + si_name = kread(&(secinfo->si_name)); + sprintf(buf+cc, "secinfo %p namelen %d name %s", + secinfo, secinfo->si_namelen, si_name); + cc = strlen(buf); + + } + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} diff --git a/tapset/nfsd_fh.stp b/tapset/nfsd_fh.stp new file mode 100644 index 0000000..1935e98 --- /dev/null +++ b/tapset/nfsd_fh.stp @@ -0,0 +1,69 @@ +%{ +#include <linux/fs.h> +#include <linux/nfsd/export.h> +#include <linux/nfsd/nfsfh.h> +#include <linux/nfsd/state.h> +#include <linux/nfsd/xdr4.h> +%} + + +function svcfhfmt:string(svcfh:long) +%{ + struct svc_fh *fhp = (struct svc_fh *)(long) kread(&(THIS->svcfh)); + struct knfsd_fh *fh = &fhp->fh_handle; + struct dentry *dentry; + char buf[MAXSTRINGLEN], *filename; + int cc=0; + + sprintf(buf+cc, "fh_version %d fh_fsid_type %d ", + fh->fh_version, fh->fh_fsid_type); + cc = strlen(buf); + if (fhp->fh_dentry) { + dentry = (struct dentry *) kread(&(fhp->fh_dentry)); + filename = (char *) dentry->d_name.name; + sprintf(buf+cc, "fh_dentry %p (%s)\n", dentry, filename); + } else { + sprintf(buf+cc, "fh_dentry %p\n", fhp->fh_dentry); + } + cc = strlen(buf); + + sprintf(buf+cc, " %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]); + cc = strlen(buf); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} +function cstate_pr:string(cptr:long) +%{ + struct nfsd4_compound_state *cstate = + (struct nfsd4_compound_state *)(long) kread(&(THIS->cptr)); + struct svc_fh *fhp = (struct svc_fh *)&cstate->current_fh; + struct knfsd_fh *fh = &fhp->fh_handle; + char buf[MAXSTRINGLEN]; + int cc=0; + + sprintf(buf+cc, "fh_dentry %p, fh_version %d fh_auth_type %d fh_fsid_type %d\n", + fhp->fh_dentry, fh->fh_version, fh->fh_auth_type, fh->fh_fsid_type); + cc = strlen(buf); + + sprintf(buf+cc, " %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]); + cc = strlen(buf); + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} diff --git a/tapset/nfsderrno.stp b/tapset/nfsderrno.stp new file mode 100644 index 0000000..3a533fd --- /dev/null +++ b/tapset/nfsderrno.stp @@ -0,0 +1,105 @@ + +%{ +#include <linux/kernel.h> +#include <linux/linkage.h> +#include <linux/time.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/stat.h> +#include <linux/fcntl.h> +#include <linux/net.h> +#include <linux/in.h> +#include <linux/namei.h> +#include <linux/unistd.h> +#include <linux/slab.h> + +#include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/svc.h> +#include <linux/nfsd/nfsd.h> +%} + +function nfsderror:string(err:long) +%{ + static struct { + int nfserr; + char *string; + } nfs_errtbl[] = { + {nfs_ok, "NFS_OK"}, + {nfserr_perm, "NFSERR_PERM"}, + {nfserr_noent, "NFSERR_NOENT"}, + {nfserr_io, "NFSERR_IO"}, + {nfserr_nxio, "NFSERR_NXIO"}, + {nfserr_eagain, "NFSERR_EAGAIN"}, + {nfserr_acces, "NFSERR_ACCES"}, + {nfserr_exist, "NFSERR_EXIST"}, + {nfserr_xdev, "NFSERR_XDEV"}, + {nfserr_nodev, "NFSERR_NODEV"}, + {nfserr_notdir, "NFSERR_NOTDIR"}, + {nfserr_isdir, "NFSERR_ISDIR"}, + {nfserr_inval, "NFSERR_INVAL"}, + {nfserr_fbig, "NFSERR_FBIG"}, + {nfserr_nospc, "NFSERR_NOSPC"}, + {nfserr_rofs, "NFSERR_ROFS"}, + {nfserr_mlink, "NFSERR_MLINK"}, + {nfserr_opnotsupp, "NFSERR_OPNOTSUPP"}, + {nfserr_nametoolong, "NFSERR_NAMETOOLONG"}, + {nfserr_notempty, "NFSERR_NOTEMPTY"}, + {nfserr_dquot, "NFSERR_DQUOT"}, + {nfserr_stale, "NFSERR_STALE"}, + {nfserr_remote, "NFSERR_REMOTE"}, + {nfserr_wflush, "NFSERR_WFLUSH"}, + {nfserr_badhandle, "NFSERR_BADHANDLE"}, + {nfserr_notsync, "NFSERR_NOT_SYNC"}, + {nfserr_badcookie, "NFSERR_BAD_COOKIE"}, + {nfserr_notsupp, "NFSERR_NOTSUPP"}, + {nfserr_toosmall, "NFSERR_TOOSMALL"}, + {nfserr_serverfault, "NFSERR_SERVERFAULT"}, + {nfserr_badtype, "NFSERR_BADTYPE"}, + {nfserr_jukebox, "NFSERR_JUKEBOX"}, + {nfserr_denied, "NFSERR_DENIED"}, + {nfserr_deadlock, "NFSERR_DEADLOCK"}, + {nfserr_expired, "NFSERR_EXPIRED"}, + {nfserr_bad_cookie, "NFSERR_BAD_COOKIE"}, + {nfserr_same, "NFSERR_SAME"}, + {nfserr_clid_inuse, "NFSERR_CLID_INUSE"}, + {nfserr_stale_clientid, "NFSERR_STALE_CLIENTID"}, + {nfserr_resource, "NFSERR_RESOURCE"}, + {nfserr_moved, "NFSERR_MOVED"}, + {nfserr_nofilehandle, "NFSERR_NOFILEHANDLE"}, + {nfserr_minor_vers_mismatch, "NFSERR_MINOR_VERS_MISMATCH"}, + {nfserr_share_denied, "NFSERR_SHARE_DENIED"}, + {nfserr_stale_stateid, "NFSERR_STALE_STATEID"}, + {nfserr_old_stateid, "NFSERR_OLD_STATEID"}, + {nfserr_bad_stateid, "NFSERR_BAD_STATEID"}, + {nfserr_bad_seqid, "NFSERR_BAD_SEQID"}, + {nfserr_symlink , "NFSERR_SYMLINK"}, + {nfserr_not_same , "NFSERR_NOT_SAME"}, + {nfserr_restorefh , "NFSERR_RESTOREFH"}, + {nfserr_attrnotsupp, "NFSERR_ATTRNOTSUPP"}, + {nfserr_bad_xdr, "NFSERR_BAD_XDR"}, + {nfserr_openmode, "NFSERR_OPENMODE"}, + {nfserr_locks_held, "NFSERR_LOCKS_HELD"}, + {nfserr_op_illegal, "NFSERR_OP_ILLEGAL"}, + {nfserr_grace, "NFSERR_GRACE"}, + {nfserr_no_grace, "NFSERR_NO_GRACE"}, + {nfserr_reclaim_bad, "NFSERR_RECLAIM_BAD"}, + {nfserr_badname, "NFSERR_BADNAME"}, + {nfserr_cb_path_down, "NFSERR_CB_PATH_DOWN"}, + {nfserr_locked, "NFSERR_LOCKED"}, + {nfserr_wrongsec, "NFSERR_WRONGSEC"}, + }; + int i; + int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (nfs_errtbl[i].nfserr == THIS->err) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "nfsderr %d", ntohl(THIS->err)); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, + "nfsderr %d(%s)", ntohl(nfs_errtbl[i].nfserr), nfs_errtbl[i].string); + +%} diff --git a/tapset/nfsderrno.stp.orig b/tapset/nfsderrno.stp.orig new file mode 100644 index 0000000..c15e2c5 --- /dev/null +++ b/tapset/nfsderrno.stp.orig @@ -0,0 +1,70 @@ + +%{ +#include <linux/kernel.h> +#include <linux/linkage.h> +#include <linux/time.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/stat.h> +#include <linux/fcntl.h> +#include <linux/net.h> +#include <linux/in.h> +#include <linux/namei.h> +#include <linux/unistd.h> +#include <linux/slab.h> + +#include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/svc.h> +#include <linux/nfsd/nfsd.h> +%} + +function nfsderror:string(err:long) +%{ + static struct { + int nfserr; + int syserr; + char *string; + } nfs_errtbl[] = { + { nfs_ok, 0, "nfserr_ok(ESUCCESS)" }, + { nfserr_perm, EPERM, "nfserr_perm(EPERM)" }, + { nfserr_noent, ENOENT , "nfserr_noent(ENOENT)"}, + { nfserr_io, EIO , "nfserr_io(EIO)"}, + { nfserr_nxio, ENXIO , "nfserr_nxio(ENXIO)"}, + { nfserr_acces, EACCES , "nfserr_acces(EACCES)"}, + { nfserr_exist, EEXIST , "nfserr_exist(EEXIST)"}, + { nfserr_xdev, EXDEV , "nfserr_xdev(EXDEV)"}, + { nfserr_mlink, EMLINK , "nfserr_mlink(EMLINK)"}, + { nfserr_nodev, ENODEV , "nfserr_nodev(ENODEV)"}, + { nfserr_notdir, ENOTDIR , "nfserr_notdir(ENOTDIR)"}, + { nfserr_isdir, EISDIR , "nfserr_isdir(EISDIR)"}, + { nfserr_inval, EINVAL , "nfserr_inval(EINVAL)"}, + { nfserr_fbig, EFBIG , "nfserr_fbig(EFBIG)"}, + { nfserr_nospc, ENOSPC , "nfserr_nospc(ENOSPC)"}, + { nfserr_rofs, EROFS , "nfserr_rofs(EROFS)"}, + { nfserr_mlink, EMLINK , "nfserr_mlink(EMLINK)"}, + { nfserr_nametoolong, ENAMETOOLONG , "nfserr_nametoolong(ENAMETOOLONG)"}, + { nfserr_notempty, ENOTEMPTY , "nfserr_notempty(ENOTEMPTY)"}, + { nfserr_dquot, EDQUOT , "nfserr_dquot(EDQUOT)"}, + { nfserr_stale, ESTALE , "nfserr_stale(ESTALE)"}, + { nfserr_jukebox, ETIMEDOUT , "nfserr_jukebox(ETIMEDOUT)"}, + { nfserr_dropit, EAGAIN , "nfserr_dropit(EAGAIN)"}, + { nfserr_dropit, ENOMEM , "nfserr_dropit(ENOMEM)"}, + { nfserr_badname, ESRCH , "nfserr_badname(ESRCH)"}, + { nfserr_io, ETXTBSY , "nfserr_io(ETXTBSY)"}, + { nfserr_notsupp, EOPNOTSUPP , "nfserr_notsupp(EOPNOTSUPP)"}, + }; + int i; + int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (nfs_errtbl[i].nfserr == THIS->err) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "nfsderr %d", ntohl(THIS->err)); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, + "nfsderr %d(%s)", ntohl(nfs_errtbl[i].nfserr), nfs_errtbl[i].string); + +%} diff --git a/tapset/nfsmntflags.stp b/tapset/nfsmntflags.stp new file mode 100644 index 0000000..98f4bb5 --- /dev/null +++ b/tapset/nfsmntflags.stp @@ -0,0 +1,41 @@ +%{ +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/dcache.h> +#include <linux/sunrpc/sched.h> +#include <linux/sunrpc/clnt.h> +#include <linux/nfs_fs.h> +#include <linux/nfs_mount.h> +%} +function nfs_mntflags:string(rawdata) +%{ + char buf[1024], *ptr; + int i, cc; + static struct proc_nfs_info { + int flag; + char *str; + char *nostr; + } nfs_info[] = { + { NFS_MOUNT_SOFT, ",soft", ",hard" }, + { NFS_MOUNT_INTR, ",intr", "" }, + { NFS_MOUNT_NOCTO, ",nocto", "" }, + { NFS_MOUNT_NOAC, ",noac", "" }, + { NFS_MOUNT_NONLM, ",nolock", "" }, + { NFS_MOUNT_NOACL, ",noacl", "" }, + { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" }, + { NFS_MOUNT_UNSHARED, ",nosharecache", "" }, + { NFS_MOUNT_FSCACHE, ",fsc", "" }, + { 0, "", "" } + }; + struct nfs_mount_data *data = (struct nfs_mount_data *)(long) THIS->rawdata; + + ptr = buf; + for (i=0; nfs_info[i].flag != 0; i++) { + //if (data->flags & nfs_info[i].flag) { + cc = sprintf(ptr, "%s", nfs_info[i].str); + ptr += cc; + //} + } + strlcpy(THIS->__retvalue, buf,1024); + +%} diff --git a/tapset/nfsunlinkdata.stp b/tapset/nfsunlinkdata.stp new file mode 100644 index 0000000..5d987d9 --- /dev/null +++ b/tapset/nfsunlinkdata.stp @@ -0,0 +1,25 @@ +%{ +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/dcache.h> +#include <linux/sunrpc/sched.h> +#include <linux/sunrpc/clnt.h> +#include <linux/nfs_fs.h> +%} +function nfs_unlinkdata:long(calldata) +%{ + struct nfs_unlinkdata { + struct nfs_unlinkdata *next; + struct dentry *dir, *dentry; + struct qstr name; + struct rpc_task *task; + struct rpc_cred *cred; + unsigned int count; + }; + //struct nfs_unlinkdata *cd = (struct nfs_unlinkdata *)(long) kread(&(THIS->calldata)); + struct nfs_unlinkdata *cd = (struct nfs_unlinkdata *)(long) THIS->calldata; + printk("nfs_unlinkdata: name.len %d\n", cd->name.len); + + + //CATCH_DEREF_FAULT(); +%} diff --git a/tapset/sock.stp b/tapset/sock.stp new file mode 100644 index 0000000..101a347 --- /dev/null +++ b/tapset/sock.stp @@ -0,0 +1,87 @@ +%{ +#include <linux/socket.h> +#include <net/sock.h> +#include <net/inet_sock.h> +%} + +function struct_socket:string(_sock:long) +%{ + struct socket *sock = (struct socket *) (long) kread(&(THIS->_sock)); + struct sock *sk = (struct sock *) (long) kread(&(sock->sk)); + struct proto *skprot = (struct proto *)(long)kread(&(sk->__sk_common.skc_prot)); + struct inet_sock *inet = inet_sk(sk); + struct sockaddr *addr; + struct in6_addr *saddr6; + char buf[MAXSTRINGLEN]; + int cc=0; + + snprintf(buf+cc, MAXSTRINGLEN, + "sock %p sk %p state %d flags 0x%lx type %d file %p", sock, sock->sk, sock->state, + sock->flags, sock->type, sock->file); + + cc = strlen(buf); + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} +function struct_sock:string(_sk:long) +%{ + struct sock *sk = (struct sock *) (long) kread(&(THIS->_sk)); + struct proto *skprot = (struct proto *)(long)kread(&(sk->__sk_common.skc_prot)); + struct inet_sock *inet = inet_sk(sk); + char buf[MAXSTRINGLEN]; + int cc=0; + + snprintf(buf+cc, MAXSTRINGLEN, + "sk %p inet %p skprot %p sk_reuse %d sk_state %d", + sk, inet, skprot, sk->sk_reuse, sk->sk_state); + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} + +function struct_sockaddr:string(_uaddr:long, _addrlen:long) +%{ + struct sockaddr *addr; + struct in6_addr *saddr6; + char buf[MAXSTRINGLEN], *family; + + addr = (struct sockaddr *) (long) kread(&(THIS->_uaddr)); + switch(addr->sa_family) { + case AF_INET: + family = "AF_INET"; + break; + case AF_INET6: + family = "AF_INET6"; + break; + default: + goto myout; + } + sprintf(buf, "addr %p family %s", addr, family); + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + +myout: + CATCH_DEREF_FAULT(); +%} +function ipv6_addr_diff:string(_sk:long, _sk2:long) +%{ + struct sock *sk = (struct sock *) (long) kread(&(THIS->_sk)); + struct sock *sk2 = (struct sock *) (long) kread(&(THIS->_sk)); + struct inet_sock *inet = inet_sk(sk); + struct inet_sock *inet2 = inet_sk(sk); + struct ipv6_pinfo *pinfo = (struct ipv6_pinfo *)(long)inet->pinet6; + struct ipv6_pinfo *pinfo2 = (struct ipv6_pinfo *)(long)inet2->pinet6; + struct in6_addr *rcv_addr = &pinfo->rcv_saddr; + struct in6_addr *rcv_addr2 = NULL; + __be32 sk_rcv_saddr = inet_->rcv_saddr; + __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2); + char buf[MAXSTRINGLEN], *family; + + if (sk2->sk_family == AF_INET6) + rcv_addr2 = &pinfo2->rcv_saddr; + + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} diff --git a/tapset/svc_error.stp b/tapset/svc_error.stp new file mode 100644 index 0000000..f3bace8 --- /dev/null +++ b/tapset/svc_error.stp @@ -0,0 +1,32 @@ + +function svcerror:string(err:long) +%{ + static struct { + int svcerr; + char *string; + } svc_errtbl[] = { + {1, "SVC_GARBAGE" }, + {2, "SVC_SYSERR" }, + {3, "SVC_VALID" }, + {4, "SVC_NEGATIVE" }, + {5, "SVC_OK" }, + {6, "SVC_DROP" }, + {7, "SVC_DENIED" }, + {8, "SVC_PENDING" }, + {9, "SVC_COMPLETE" }, + }; + int i; + int tabsz = (sizeof(svc_errtbl)/sizeof(svc_errtbl[0])); + + for (i = 0; i < tabsz; i++) { + if (svc_errtbl[i].svcerr == THIS->err) { + break; + } + } + if (i == tabsz) + snprintf(THIS->__retvalue, MAXSTRINGLEN, "svcerr %lld", THIS->err); + else + snprintf(THIS->__retvalue, MAXSTRINGLEN, + "svcderr %d(%s)", svc_errtbl[i].svcerr, svc_errtbl[i].string); + +%} diff --git a/tapset/svc_export.stp b/tapset/svc_export.stp new file mode 100644 index 0000000..72bce5c --- /dev/null +++ b/tapset/svc_export.stp @@ -0,0 +1,61 @@ +%{ +#include <linux/fs.h> +#include <linux/nfsd/export.h> +%} + +function svc_export_dump:string(_exp:long) +%{ + struct svc_export *exp = (struct svc_export *)(long) kread(&(THIS->_exp)); + struct dentry *dentry = NULL; + struct vfsmount *mnt = NULL; + char buf[MAXSTRINGLEN], *fname=NULL; + int cc=0; + + if (exp <= 0) { + sprintf(buf+cc, "exp NULL"); + } else { + sprintf(buf+cc, "exp %p path %s flg 0x%x fsid %d nflavors %d\n", + exp, exp->ex_path > 0 ? exp->ex_path : NULL, + exp->ex_flags, exp->ex_fsid, exp->ex_nflavors); + cc = strlen(buf); + + dentry = (struct dentry *) (long) kread(&(exp->ex_dentry)); + mnt = (struct vfsmount *) kread(&(exp->ex_mnt)); + if (mnt && dentry) + fname = d_path(dentry, mnt, buf, MAXSTRINGLEN); + sprintf(buf+cc, " mnt %p dentry %p(%s)", + exp->ex_mnt, exp->ex_dentry, fname > 0 ? fname : NULL); + } + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} + +function svc_export_flavors:string(_exp:long) +%{ + struct svc_export *exp = (struct svc_export *)(long) kread(&(THIS->_exp)); + struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; + struct exp_flavor_info *f; + char buf[MAXSTRINGLEN], *fname=NULL; + int cc=0; + + if (exp <= 0) { + sprintf(buf+cc, "exp NULL"); + } else { + sprintf(buf+cc, "ex_flavors[%d] ", exp->ex_nflavors); + cc = strlen(buf); + if (exp->ex_nflavors) { + sprintf(buf+cc, "["); + cc = strlen(buf); + for (f = exp->ex_flavors; f < end; f++) { + sprintf(buf+cc, "%d,", f->pseudoflavor); + cc = strlen(buf); + } + sprintf(buf+cc, "]"); + cc = strlen(buf); + } + } + snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", buf); + + CATCH_DEREF_FAULT(); +%} |