From f96a2eacc3ca1e6268a0b4ddcb838b3f89301469 Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Tue, 23 Feb 2010 11:29:06 -0500 Subject: [PATCH] Updated nfsd.proc.lookup probes Converted the nfsd.proc.lookup probes to used the @cast() mechanism. Created the nfsd.proc4.lookup probes Signed-off-by: Steve Dickson --- tapset/nfsd.stp | 109 +++++++++++++----------------------------------- 1 file changed, 30 insertions(+), 79 deletions(-) diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp index df8efa87b..92f682fb8 100644 --- a/tapset/nfsd.stp +++ b/tapset/nfsd.stp @@ -11,10 +11,6 @@ %{ #include -#include -#include -#include -#include %} /* @@ -35,75 +31,6 @@ *15 :nfsd.proc3.rename.tfh */ -/*Get file handler from argp,the index indicates the type of argp*/ -function __get_fh:long(argp:long,index:long) %{ /* pure */ - int index = (int)((long)THIS->index); - struct nfsd_diropargs * argp = NULL ; - struct nfsd3_diropargs * argp3 = NULL ; - struct nfsd_readargs * argpr = NULL; - struct nfsd3_readargs * argpr3 = NULL; - struct nfsd_writeargs * argpw = NULL; - struct nfsd3_writeargs * argpw3 = NULL; - struct nfsd3_commitargs * argpc3 = NULL; - struct nfsd_createargs *argpcr = NULL; - struct nfsd3_createargs *argpcr3 = NULL; - struct nfsd_diropargs *argpre = NULL; - struct nfsd3_diropargs *argpre3 = NULL; - struct nfsd_renameargs *argpren = NULL; - struct nfsd3_renameargs *argpren3 = NULL; - struct svc_fh * fhp = NULL; - - switch(index) - { - case 1: argp = (struct nfsd_diropargs *)((long)THIS->argp); - fhp = &argp->fh; - break; - case 2: argp3 = (struct nfsd3_diropargs *)((long)THIS->argp); - fhp = &argp3->fh; - break; - case 3: argpr = (struct nfsd_readargs * )((long)THIS->argp); - fhp = &argpr->fh; - break; - case 4: argpr3 = (struct nfsd3_readargs * )((long)THIS->argp); - fhp = &argpr3->fh; - break; - case 5: argpw = (struct nfsd_writeargs * )((long)THIS->argp); - fhp = &argpw->fh; - break; - case 6: argpw3 = (struct nfsd3_writeargs * )((long)THIS->argp); - fhp = &argpw3->fh; - break; - case 7: argpc3 = (struct nfsd3_commitargs * )((long)THIS->argp); - fhp = &argpc3->fh; - break; - case 8: argpcr = (struct nfsd_createargs * )((long)THIS->argp); - fhp = &argpcr->fh; - break; - case 9: argpcr3 = (struct nfsd3_createargs * )((long)THIS->argp); - fhp = &argpcr3->fh; - break; - case 10: argpre = (struct nfsd_diropargs * )((long)THIS->argp); - fhp = &argpre->fh; - break; - case 11: argpre3 = (struct nfsd3_diropargs * )((long)THIS->argp); - fhp = &argpre3->fh; - break; - case 12: argpren = (struct nfsd_renameargs * )((long)THIS->argp); - fhp = &argpren->ffh; - break; - case 13: argpren = (struct nfsd_renameargs * )((long)THIS->argp); - fhp = &argpren->tfh; - break; - case 14: argpren3 = (struct nfsd3_renameargs * )((long)THIS->argp); - fhp = &argpren3->ffh; - break; - case 15: argpren3 = (struct nfsd3_renameargs * )((long)THIS->argp); - fhp = &argpren3->tfh; - break; - } - - THIS->__retvalue = (long)fhp; -%} /*Get file handler from struct svc_fh */ function __svc_fh:string(fh :long) %{ /* pure */ struct svc_fh * fhp = (struct svc_fh *) (long)(THIS->fh); @@ -194,11 +121,13 @@ probe nfsd.proc.return = nfsd.proc.lookup.return, * filelen : the length of file name */ probe nfsd.proc.lookup = nfsd.proc2.lookup, - nfsd.proc3.lookup + nfsd.proc3.lookup, + nfsd.proc4.lookup {} probe nfsd.proc.lookup.return = nfsd.proc2.lookup.return, - nfsd.proc3.lookup.return + nfsd.proc3.lookup.return, + nfsd.proc4.lookup.return {} probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !, @@ -207,7 +136,7 @@ probe nfsd.proc2.lookup = kernel.function("nfsd_proc_lookup") !, client_ip = addr_from_rqst($rqstp) proto = $rqstp->rq_prot version = 2 - fh = __get_fh($argp,1) + fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh filelen = $argp->len filename = kernel_string_n($argp->name, filelen) @@ -222,7 +151,7 @@ probe nfsd.proc2.lookup.return = kernel.function("nfsd_proc_lookup").return !, { name = "nfsd.proc2.lookup.return" version = 2 - retstr = sprintf("%d",$return) + retstr = sprintf("%s", nfsderror($return)) } probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !, @@ -231,7 +160,7 @@ probe nfsd.proc3.lookup = kernel.function("nfsd3_proc_lookup") !, client_ip = addr_from_rqst($rqstp) proto = $rqstp->rq_prot version = 3 - fh = __get_fh($argp,1) + fh = & @cast($argp, "nfsd_diropargs", "kernel:nfsd")->fh filelen = $argp->len filename = kernel_string_n($argp->name, filelen) @@ -245,9 +174,31 @@ probe nfsd.proc3.lookup.return = kernel.function("nfsd3_proc_lookup").return !, { name = "nfsd.proc3.lookup.return" version = 3 - retstr = sprintf("%d",$return) + retstr = sprintf("%s", nfsderror($return)) } +probe nfsd.proc4.lookup = kernel.function("nfsd4_lookup") !, + module("nfsd").function("nfsd4_lookup") ? +{ + client_ip = addr_from_rqst($rqstp) + proto = $rqstp->rq_prot + version = 4 + fh = & @cast($cstate, "nfsd4_compound_state", "kernel:nfsd")->current_fh + + filelen = $lookup->lo_len + filename = kernel_string_n($lookup->lo_name, filelen) + + name = "nfsd.proc4.lookup" + argstr = sprintf("%s",filename) +} + +probe nfsd.proc4.lookup.return = kernel.function("nfsd4_lookup").return !, + module("nfsd").function("nfsd4_lookup").return ? +{ + name = "nfsd.proc4.lookup.return" + version = 4 + retstr = sprintf("%s",nfsderror($return)) +} /* *probe nfsd.proc.read -- 2.43.5