403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/systemtap/tapset/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/systemtap/tapset/nfs_proc.stp
%{
	#include <linux/nfs_fs.h>
	#include <linux/nfs_xdr.h>
%}

%{
/*Get rpc_clnt from inode, same as kernel function NFS_CLIENT*/
	static struct rpc_clnt *_stap_NFS_CLIENT(struct inode *inode, struct context * __restrict__ c);
/*Get ip address from a rpc_clnt*/
	static __u32 _get_ip_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c);
/*Get protocol types from a rpc_clnt*/
	static int _get_prot_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c);
/*Get ip address from a rpc_task*/
	static __u32 get_ip(struct rpc_task *, struct context * __restrict__);
/*Get protocol types from a rpc_task*/
	static int get_prot(struct rpc_task *, struct context * __restrict__);
%}
%{
    static struct rpc_clnt *_stap_NFS_CLIENT(struct inode *inode, struct context * __restrict__ c) {
	struct super_block *i_sb;
	struct nfs_server *server;
	i_sb = kread(&(inode->i_sb));
	server = kread(&(i_sb->s_fs_info));
	return kread(&(server->client));
	CATCH_DEREF_FAULT();
	return NULL;
    }

    static __u32 _get_ip_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c) {
	struct rpc_xprt * cl_xprt;
	struct sockaddr_in *addr;
	cl_xprt= kread(&(clnt->cl_xprt));
	addr = (struct sockaddr_in *)&(cl_xprt->addr);
	if (kread(&(addr->sin_family)) != AF_INET)
		/* Now consider ipv4 only */
		return 0;
	return kread(&(addr->sin_addr.s_addr));
	CATCH_DEREF_FAULT();
	return -1;
    }

    static int _get_prot_from_client(struct rpc_clnt *clnt, struct context * __restrict__ c) {
	struct rpc_xprt * cl_xprt;
	cl_xprt= kread(&(clnt->cl_xprt));
	return kread(&(cl_xprt->prot));
	CATCH_DEREF_FAULT();
	return -1;
    }

    static __u32 get_ip(struct rpc_task * task, struct context * __restrict__ c) {
	struct rpc_clnt * clnt;
	clnt = kread(&(task->tk_client));
	return _get_ip_from_client(clnt, c);
	CATCH_DEREF_FAULT();
	return -1;
    }

    static int get_prot(struct rpc_task * task, struct context * __restrict__ c) {
	struct rpc_clnt * clnt;
	clnt = kread(&(task->tk_client));
	return _get_prot_from_client(clnt, c);
	CATCH_DEREF_FAULT();
	return -1;
    }
%}

function stap_NFS_CLIENT:long(inode:long) %{ /* pure */
	struct inode *inode = (struct inode *)(long)THIS->inode;
	THIS->__retvalue = (long)_stap_NFS_CLIENT(inode, CONTEXT);
%}

function get_ip_from_client:long(clnt:long) %{ /* pure */
	struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt;
	THIS->__retvalue = _get_ip_from_client(clnt, CONTEXT);
%}

function get_prot_from_client:long(clnt:long) %{ /* pure */
	struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt;
	THIS->__retvalue = _get_prot_from_client(clnt, CONTEXT);
%}

/*
  0:get ip address
  1:get proto
*/
function __i2n_ip_proto :long(dir:long,index:long) %{ /* pure */
        int index;
        struct inode * dir;
        struct rpc_clnt * clnt;
        struct rpc_xprt * cl_xprt;
        struct sockaddr_in *addr;

        index = (int) (THIS->index);
        dir = (struct inode *)(uintptr_t)(THIS->dir);
        clnt = NFS_CLIENT(dir); /* FIXME: deref hazard! */
        cl_xprt = kread(&(clnt->cl_xprt));
  	/* sockaddr_storage is used since 2.6.19. Need cast*/
	addr = (struct sockaddr_in *)&(cl_xprt->addr);

        if(index == 0) {
                if (kread(&(addr->sin_family)) == AF_INET) {
                        /* Now consider ipv4 only */
                        THIS->__retvalue = kread(&(addr->sin_addr.s_addr));
                } else
                        THIS->__retvalue = 0;
        } else
                THIS->__retvalue = kread(&(cl_xprt->prot));
        CATCH_DEREF_FAULT();
%}

/*
  0: get ip address
  1: get proto
  2: get res->count
  3: get res->fattr->valid
  4: get timestamp
*/
function __nfs_read_data_info:long (rdata :long,index :long) %{ /* pure */
        struct nfs_read_data * rdata = (struct nfs_read_data *)(long)THIS->rdata;
	struct rpc_task *task = &(rdata->task);
        struct nfs_readres *rres = &(rdata->res);
        int index = THIS->index;

	switch(index) {
		case 0:
			THIS->__retvalue = get_ip(task, CONTEXT); 
			break;
		case 1: 
			THIS->__retvalue = get_prot(task, CONTEXT);
			break;
		case 2:
			THIS->__retvalue = kread(&(rres->count));
			break;
		case 3: {
			struct nfs_fattr *fattr = kread(&(rres->fattr));
			THIS->__retvalue = kread(&(fattr->valid));
			break;
			}
#ifdef CONFIG_NFS_V4
		case 4:
			THIS->__retvalue = kread(&(rdata->timestamp));
			break;
#endif
		default:
			THIS->__retvalue = 0;
			break;
	}
	CATCH_DEREF_FAULT();
%}

/*
  0: get ip address
  1: get proto
  2: get res->count
  3: get res->fattr->valid
  4: get timestamp
*/
function __nfs_write_data_info:long (wdata :long,index :long) %{ /* pure */
        struct nfs_write_data * wdata = (struct nfs_write_data *)(long)THIS->wdata;
	struct rpc_task *task = &(wdata->task);
	struct nfs_writeres *wres = &(wdata->res);
        int index = THIS->index;

	switch(index) {
		case 0:
			THIS->__retvalue = get_ip(task, CONTEXT); 
			break;
		case 1: 
			THIS->__retvalue = get_prot(task, CONTEXT);
			break;

		case 2:
			THIS->__retvalue = kread(&(wres->count));
			break;
		case 3: {
			struct nfs_fattr *fattr = kread(&(wres->fattr));
			THIS->__retvalue = kread(&(fattr->valid));
			break;
		}
#ifdef CONFIG_NFS_V4
		case 4:
			THIS->__retvalue = kread(&(wdata->timestamp));
			break;
#endif
		default:
			THIS->__retvalue = 0;
			break;
	}
	CATCH_DEREF_FAULT();
%}

function __nfsv4_bitmask :long(dir:long,i:long) %{ /* pure */
        int i = (int) (THIS->i);
	struct inode * dir = (struct inode *)(long)(THIS->dir);
        struct nfs_server * server = NFS_SERVER(dir); /* FIXME: deref hazard! */

#ifdef CONFIG_NFS_V4
        THIS->__retvalue = kread(&(server->attr_bitmask[i]));
#endif
        CATCH_DEREF_FAULT();
%}

function __getfh_inode :long(dir:long) %{ /* pure */
	struct inode * dir = (struct inode *)(long)(THIS->dir);
	struct nfs_fh * fh = NFS_FH(dir); /* FIXME: deref hazard! */

	THIS->__retvalue =(long) fh;
%}
probe nfs.proc.entries = nfs.proc.lookup,
			nfs.proc.read,
			nfs.proc.write,
			nfs.proc.commit,
			nfs.proc.read_setup,
			nfs.proc.write_setup,
			nfs.proc.commit_setup,
			nfs.proc.read_done,
			nfs.proc.write_done,
			nfs.proc.commit_done,
			nfs.proc.open,
			nfs.proc.create,
			nfs.proc.rename,
			nfs.proc.remove,
			nfs.proc.release
{
}


probe nfs.proc.return = nfs.proc.lookup.return,
			nfs.proc.read.return,
			nfs.proc.write.return,
			nfs.proc.commit.return,
			nfs.proc.read_setup.return,
			nfs.proc.write_setup.return,
			nfs.proc.commit_setup.return,
			nfs.proc.read_done.return,
			nfs.proc.write_done.return,
			nfs.proc.commit_done.return,
			nfs.proc.open.return,
			nfs.proc.create.return,
			nfs.proc.rename.return,
			nfs.proc.remove.return,
			nfs.proc.release.return  
{
}

/*
*probe nfs.proc.lookup
*
* Fires when client opens/searchs a file on server
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   filename : the name of  file which client opens/searchs on server
*   name_len : the length of file name
*   bitmask0:
*   bitmask1 :V4 bitmask representing the set of attributes 
*             supported on this filesystem (only in probe nfs.proc4.lookup)
* 
*/
probe nfs.proc.lookup = nfs.proc2.lookup,
                        nfs.proc3.lookup,
                        nfs.proc4.lookup
{
}

probe nfs.proc.lookup.return = nfs.proc2.lookup.return,
                               nfs.proc3.lookup.return,
                               nfs.proc4.lookup.return
{}

probe nfs.proc2.lookup = kernel.function("nfs_proc_lookup")!,
                         module("nfs").function("nfs_proc_lookup")?
{
	server_ip = __i2n_ip_proto($dir,0)
        prot   = __i2n_ip_proto($dir,1)
        version =2

	name_len = $name->len
	filename = kernel_string_n($name->name, name_len)

        name = "nfs.proc2.lookup"
        argstr = sprintf("%s",filename) 
}

probe nfs.proc2.lookup.return = kernel.function("nfs_proc_lookup").return!,
                                module("nfs").function("nfs_proc_lookup").return?
{
        version =2
	name = "nfs.proc2.lookup.return"
	retstr = sprintf("%d", $return)
}

probe nfs.proc3.lookup = kernel.function("nfs3_proc_lookup")!,
                         module("nfs").function("nfs3_proc_lookup")?
{

	server_ip = __i2n_ip_proto($dir,0)
        prot   = __i2n_ip_proto($dir,1)
        version =3

	name_len = $name->len
	filename = kernel_string_n($name->name, name_len)

        name = "nfs.proc3.lookup"
        argstr = sprintf("%s",filename) 
}


probe nfs.proc3.lookup.return = kernel.function("nfs3_proc_lookup").return!,
                                module("nfs").function("nfs3_proc_lookup").return?
{
        version =3
	name = "nfs.proc3.lookup.return"
	retstr = sprintf("%d", $return)
}

probe nfs.proc4.lookup = kernel.function("nfs4_proc_lookup")!,
                         module("nfs").function("nfs4_proc_lookup")?
{

	server_ip = __i2n_ip_proto($dir,0)
        prot   = __i2n_ip_proto($dir,1)
        version =4

	name_len = $name->len
	filename = kernel_string_n($name->name, name_len)
        bitmask0 = __nfsv4_bitmask($dir,0)
        bitmask1 = __nfsv4_bitmask($dir,1)

        name = "nfs.proc4.lookup"
        argstr = sprintf("%s",filename) 
}

probe nfs.proc4.lookup.return = kernel.function("nfs4_proc_lookup").return!,
                                module("nfs").function("nfs4_proc_lookup").return?
{
        version =4
	name = "nfs.proc4.lookup.return"
	retstr = sprintf("%d", $return)
}

/*
*probe nfs.proc.read
*
* Fires when client synchronously reads file from server 
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   flags  : used to set task->tk_flags in rpc_init_task function
*   size:
*   count : read bytes in this execution
*   offset : the file offset
* 
*/
probe nfs.proc.read = nfs.proc2.read ,
                      nfs.proc3.read ,
                      nfs.proc4.read 
{}


probe nfs.proc.read.return = nfs.proc2.read.return ,
                      nfs.proc3.read.return ,
                      nfs.proc4.read.return 
{
}

probe nfs.proc2.read = kernel.function("nfs_proc_read") !,
                       module("nfs").function("nfs_proc_read")?
{
	server_ip = __nfs_read_data_info($rdata,0)
        prot = __nfs_read_data_info($rdata,1)
        version =2

	flags = $rdata->flags
        count = $rdata->args->count
        offset = $rdata->args->offset

	name = "nfs.proc2.read"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc2.read.return = kernel.function("nfs_proc_read").return !,
                       module("nfs").function("nfs_proc_read").return?
{
        version =2
	name = "nfs.proc2.read.return"
	retstr = sprintf("%d", $return)
}


probe nfs.proc3.read = kernel.function("nfs3_proc_read") !,
                       module("nfs").function("nfs3_proc_read")?
{
	server_ip = __nfs_read_data_info($rdata,0)
        prot = __nfs_read_data_info($rdata,1)
        version =3

	flags = $rdata->flags
        count = $rdata->args->count
        offset = $rdata->args->offset

	name = "nfs.proc3.read"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc3.read.return = kernel.function("nfs3_proc_read").return !,
                       module("nfs").function("nfs3_proc_read").return?
{
        version =3
	name = "nfs.proc3.read.return"
        retstr = sprintf("%d", $return)
}

probe nfs.proc4.read = kernel.function("nfs4_proc_read") !,
                       module("nfs").function("nfs4_proc_read")?
{
	server_ip = __nfs_read_data_info($rdata,0)
        prot = __nfs_read_data_info($rdata,1)
        version =4

	flags = $rdata->flags
        count = $rdata->args->count
        offset = $rdata->args->offset

	name = "nfs.proc4.read"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc4.read.return = kernel.function("nfs4_proc_read").return !,
                       module("nfs").function("nfs4_proc_read").return?
{
        version =4
	name = "nfs.proc4.read.return"
        retstr = sprintf("%d", $return)
}


/*
*probe nfs.proc.write
*
* Fires when client synchronously writes file to server 
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   flags  : used to set task->tk_flags in rpc_init_task function
*   count :
*   size  : read bytes in this execution
*   offset : the file offset
*   bitmask0:
*   bitmask1 :V4 bitmask representing the set of attributes 
*             supported on this filesystem (only in probe nfs.proc4.write)
*/

probe nfs.proc.write = nfs.proc2.write ,
                      nfs.proc3.write ,
                      nfs.proc4.write 
{}


probe nfs.proc.write.return = nfs.proc2.write.return ,
                      nfs.proc3.write.return ,
                      nfs.proc4.write.return 
{}

probe nfs.proc2.write = kernel.function("nfs_proc_write")!,
                        module("nfs").function("nfs_proc_write")?
{
      
	server_ip = __nfs_write_data_info($wdata,0)
        prot = __nfs_write_data_info($wdata,1)
        version =2

	flags = $wdata->flags
        count = $wdata->args->count
        offset = $wdata->args->offset

	name = "nfs.proc2.write"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc2.write.return = kernel.function("nfs_proc_write").return !,
                       module("nfs").function("nfs_proc_write").return?
{
        version =2
	name = "nfs.proc2.write.return"
	retstr = sprintf("%d", $return)
        if($return >= 0)
        {  
        	size = $return
	        units = "bytes"
	}
}


probe nfs.proc3.write = kernel.function("nfs3_proc_write")!,
                        module("nfs").function("nfs3_proc_write")?
{
      
	server_ip = __nfs_write_data_info($wdata,0)
        prot = __nfs_write_data_info($wdata,1)
        version =3

	flags = $wdata->flags
        count = $wdata->args->count
        offset = $wdata->args->offset

	name = "nfs.proc3.write"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}


probe nfs.proc3.write.return = kernel.function("nfs3_proc_write").return !,
                       module("nfs").function("nfs3_proc_write").return?
{
        version =3
	name = "nfs.proc3.write.return"
	retstr = sprintf("%d", $return)
        
        if($return >= 0)
        {  
        	size = $return
	        units = "bytes"
	}
}


probe nfs.proc4.write = kernel.function("nfs4_proc_write")!,
                        module("nfs").function("nfs4_proc_write")?
{
      
	server_ip = __nfs_write_data_info($wdata,0)
        prot = __nfs_write_data_info($wdata,1)
        version =4

	flags = $wdata->flags
        count = $wdata->args->count
        offset = $wdata->args->offset
        bitmask0 = __nfsv4_bitmask($wdata->inode,0)
        bitmask1 = __nfsv4_bitmask($wdata->inode,1)

	name = "nfs.proc4.write"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}


probe nfs.proc4.write.return = kernel.function("nfs4_proc_write").return !,
                       module("nfs").function("nfs4_proc_write").return?
{
        version =4
	name = "nfs.proc4.write.return"
	retstr = sprintf("%d", $return)
        
        if($return >= 0)
        {  
        	size = $return
	        units = "bytes"
	}
}

/*
*probe nfs.proc.commit
*
* Fires when client writes the buffered data to disk,the buffered 
* data is asynchronously written by client before
* The commit function works in sync way,not exist in NFSV2
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   count :
*   size  : read bytes in this execution
*   offset : the file offset
*   bitmask0:
*   bitmask1 :V4 bitmask representing the set of attributes 
*             supported on this filesystem (only in probe nfs.proc4.commit)
*/
probe nfs.proc.commit = nfs.proc3.commit,
                        nfs.proc4.commit
{}

probe nfs.proc.commit.return = nfs.proc3.commit.return,
                               nfs.proc4.commit.return
{}

// XXX: on kernels > 2.6.18 (?), module("nfs") -> module("nfsd") and
// function("nfsN...") becomes function("nfsdN...").  PR3833.
   
probe nfs.proc3.commit = kernel.function ("nfs3_proc_commit")!,
                         module("nfs").function("nfs3_proc_commit")?
{
	server_ip = __nfs_write_data_info($cdata,0)
        prot = __nfs_write_data_info($cdata,1)
        version =3

        count = $cdata->args->count
        offset = $cdata->args->offset

	name = "nfs.proc3.commit"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc3.commit.return = kernel.function ("nfs3_proc_commit").return!,
                         module("nfs").function("nfs3_proc_commit").return?
{
        version =3
	name = "nfs.proc3.commit.return"
	retstr = sprintf("%d", $return)
        
        if($return >= 0)
        {  
        	size = $return
	        units = "bytes"
	}
}


probe nfs.proc4.commit = kernel.function ("nfs4_proc_commit")!,
                         module("nfs").function("nfs4_proc_commit")?
{
	server_ip = __nfs_write_data_info($cdata,0)
        prot = __nfs_write_data_info($cdata,1)
        version =4

        count = $cdata->args->count
        offset = $cdata->args->offset
        bitmask0 = __nfsv4_bitmask($cdata->inode,0)
        bitmask1 = __nfsv4_bitmask($cdata->inode,1)

	name = "nfs.proc4.commit"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc4.commit.return = kernel.function ("nfs4_proc_commit").return!,
                         module("nfs").function("nfs4_proc_commit").return?
{
        version =4
	name = "nfs.proc4.commit.return"
	retstr = sprintf("%d", $return)
        
        if($return >= 0)
        {  
        	size = $return
	        units = "bytes"
	}
}

/*
*probe nfs.proc.read_setup
*
* The read_setup function is used to setup a read rpc task,not do
* a real read operation.
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   count :
*   size  : read bytes in this execution
*   offset : the file offset 
*/
probe nfs.proc.read_setup = nfs.proc2.read_setup ,
                      nfs.proc3.read_setup ,
                      nfs.proc4.read_setup 
{}

probe nfs.proc.read_setup.return = nfs.proc2.read_setup.return ,
                      nfs.proc3.read_setup.return ,
                      nfs.proc4.read_setup.return 
{}



probe nfs.proc2.read_setup = kernel.function("nfs_proc_read_setup") !,
                       module("nfs").function("nfs_proc_read_setup")?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =2

        count = $data->args->count
        offset = $data->args->offset

	name = "nfs.proc2.read_setup"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc2.read_setup.return = kernel.function("nfs_proc_read_setup").return !,
                       module("nfs").function("nfs_proc_read_setup").return?
{
	name =  "nfs.proc2.read_setup.return"
	retvalue = 0;
}

probe nfs.proc3.read_setup = kernel.function("nfs3_proc_read_setup") !,
                       module("nfs").function("nfs3_proc_read_setup")?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =3
	fh = 

        count = $data->args->count
        offset = $data->args->offset

	name = "nfs.proc3.read_setup"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}

probe nfs.proc3.read_setup.return = kernel.function("nfs3_proc_read_setup").return !,
                       module("nfs").function("nfs3_proc_read_setup").return?
{
	name =  "nfs.proc3.read_setup.return"
	retvalue = 0;
}

probe nfs.proc4.read_setup = kernel.function("nfs4_proc_read_setup") !,
                       module("nfs").function("nfs4_proc_read_setup")?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =4

        count = $data->args->count
        offset = $data->args->offset
	//timestamp = $jiffies

	name = "nfs.proc4.read_setup"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}
probe nfs.proc4.read_setup.return = kernel.function("nfs4_proc_read_setup").return !,
                       module("nfs").function("nfs4_proc_read_setup").return?
{
	name =  "nfs.proc4.read_setup.return"
	retvalue = 0;
}

/*probe nfs.proc.read_done
*
* Fires when a read reply is received or some read error occur
* (timeout or socket shutdown)
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   status : result of last operation
*   count  : number of bytes read
*   timestamp : time stamp ,which is used for lease renewal (only
    in nfs.proc4.read_done)
*/
probe nfs.proc.read_done = nfs.proc2.read_done,
                           nfs.proc3.read_done,
                           nfs.proc4.read_done
{}

probe nfs.proc.read_done.return = nfs.proc2.read_done.return,
                           nfs.proc3.read_done.return,
                           nfs.proc4.read_done.return
{}

probe nfs.proc2.read_done = kernel.function("nfs_read_done")!,
                            module("nfs").function("nfs_read_done")?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_read_data_info($data,0)
        prot = __nfs_read_data_info($data,1)
	count = __nfs_read_data_info($data, 2)
%:
	server_ip = __nfs_read_data_info($task->tk_calldata,0)
        prot = __nfs_read_data_info($task->tk_calldata,1)
	count = __nfs_read_data_info($task->tk_calldata, 2)
%)
        version =2
	status = $task->tk_status

	name = "nfs.proc2.read_done"
        argstr = sprintf("%d",status)

}

probe nfs.proc2.read_done.return = kernel.function("nfs_read_done").return!,
                            module("nfs").function("nfs_read_done").return?
{
        version =2
	name = "nfs.proc2.read_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}


probe nfs.proc3.read_done = kernel.function("nfs3_read_done")!,
                            module("nfs").function("nfs3_read_done")?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_read_data_info($data,0)
        prot = __nfs_read_data_info($data,1)
	count = __nfs_read_data_info($data, 2)
%:
	server_ip = __nfs_read_data_info($task->tk_calldata,0)
        prot = __nfs_read_data_info($task->tk_calldata,1)
	count = __nfs_read_data_info($task->tk_calldata, 2)
%)
        version =3
	status = $task->tk_status

	name = "nfs.proc3.read_done"
        argstr = sprintf("%d",status)

}

probe nfs.proc3.read_done.return = kernel.function("nfs3_read_done").return!,
                            module("nfs").function("nfs3_read_done").return?
{
        version =3
	name = "nfs.proc3.read_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}


probe nfs.proc4.read_done = kernel.function("nfs4_read_done")!,
                            module("nfs").function("nfs4_read_done")?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_read_data_info($data,0)
        prot = __nfs_read_data_info($data,1)
	count = __nfs_read_data_info($data, 2)
        timestamp = __nfs_read_data_info($data, 4)
%:
	server_ip = __nfs_read_data_info($task->tk_calldata,0)
        prot = __nfs_read_data_info($task->tk_calldata,1)
	count = __nfs_read_data_info($task->tk_calldata, 2)
        timestamp = __nfs_read_data_info($task->tk_calldata, 4)
%)
        version =4
	status = $task->tk_status

	name = "nfs.proc4.read_done"
        argstr = sprintf("%d",status)

}

probe nfs.proc4.read_done.return = kernel.function("nfs4_read_done").return!,
                            module("nfs").function("nfs4_read_done").return?
{
        version =4
	name = "nfs.proc4.read_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}

/*probe nfs.proc.write_setup
*
* The write_setup function is used to setup a write rpc task,not do
* a real write operation.
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   size :
*   count : read bytes in this execution
*   offset : the file offset
*   how : used to set args.stable.
*         The stable value could be:
*         NFS_UNSTABLE,NFS_DATA_SYNC,NFS_FILE_SYNC(in nfs.proc3.write_setup and nfs.proc4.write_setup)
*   bitmask0:
*   bitmask1 :V4 bitmask representing the set of attributes 
*             supported on this filesystem (only in probe nfs.proc4.write_setup)
*/

probe nfs.proc.write_setup = nfs.proc2.write_setup,
                             nfs.proc3.write_setup,
                             nfs.proc4.write_setup
{}
probe nfs.proc.write_setup.return = nfs.proc2.write_setup.return,
                             nfs.proc3.write_setup.return,
                             nfs.proc4.write_setup.return
{}


probe nfs.proc2.write_setup = kernel.function("nfs_proc_write_setup") !,
                              module("nfs").function("nfs_proc_write_setup") ?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =2

        count = $data->args->count
        offset = $data->args->offset

	name = "nfs.proc2.write_setup"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}
probe nfs.proc2.write_setup.return = kernel.function("nfs_proc_write_setup").return !,
                              module("nfs").function("nfs_proc_write_setup").return ?
{
	name = "nfs.proc2.write_setup.return"
	retvalue = 0
}


probe nfs.proc3.write_setup = kernel.function("nfs3_proc_write_setup") !,
                              module("nfs").function("nfs3_proc_write_setup") ?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =3

        count = $data->args->count
        offset = $data->args->offset
	how = $how

	name = "nfs.proc3.write_setup"
	argstr = sprintf("%d,%d,%d",count,offset,how)

        size = count
        units = "bytes"
}
probe nfs.proc3.write_setup.return = kernel.function("nfs3_proc_write_setup").return !,
                              module("nfs").function("nfs3_proc_write_setup").return ?
{
	name = "nfs.proc3.write_setup.return"
	retvalue = 0
}

probe nfs.proc4.write_setup = kernel.function("nfs4_proc_write_setup") !,
                              module("nfs").function("nfs4_proc_write_setup") ?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =4

        count = $data->args->count
        offset = $data->args->offset
	how = $how
        bitmask0 = __nfsv4_bitmask($data->inode,0)
        bitmask1 = __nfsv4_bitmask($data->inode,1)
	//timestamp = $jiffies
	
	name = "nfs.proc4.write_setup"
	argstr = sprintf("%d,%d,%d",count,offset,how)

        size = count
        units = "bytes"
}
probe nfs.proc4.write_setup.return = kernel.function("nfs4_proc_write_setup").return !,
                              module("nfs").function("nfs4_proc_write_setup").return ?
{
	name = "nfs.proc4.write_setup.return"
	retvalue = 0
}


/*probe nfs.proc.write_done
*
* Fires when a write reply is received or some write error occur
* (timeout or socket shutdown)
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   status : result of last operation
*   valid  : fattr->valid ,indicates which fields are valid 
*   count  : number of bytes written
*   timestamp : time stamp ,which is used for lease renewal (only
    in nfs.proc4.write_done)
*/
probe nfs.proc.write_done = nfs.proc2.write_done,
                            nfs.proc3.write_done,
                            nfs.proc4.write_done 
{}

probe nfs.proc.write_done.return = nfs.proc2.write_done.return,
                            nfs.proc3.write_done.return,
                            nfs.proc4.write_done.return 
{}

probe nfs.proc2.write_done = kernel.function("nfs_write_done") !,
                             module("nfs").function("nfs_write_done") ?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_write_data_info($data,0)
        prot = __nfs_write_data_info($data,1)
	count = __nfs_write_data_info($data, 2)
	valid = __nfs_write_data_info($data, 3)
%:
	server_ip = __nfs_write_data_info($task->tk_calldata,0)
        prot = __nfs_write_data_info($task->tk_calldata,1)
	count = __nfs_write_data_info($task->tk_calldata, 2)
	valid = __nfs_write_data_info($task->tk_calldata, 3)
%)
        version =2
	status = $task->tk_status

	name = "nfs.proc2.write_done"
	argstr = sprintf("%d",status)
}

probe nfs.proc2.write_done.return = kernel.function("nfs_write_done").return !,
                             module("nfs").function("nfs_write_done").return ?
{
        version =2
	name = "nfs.proc2.write_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}

probe nfs.proc3.write_done = kernel.function("nfs3_write_done") !,
                             module("nfs").function("nfs3_write_done") ?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_write_data_info($data,0)
        prot = __nfs_write_data_info($data,1)
	count = __nfs_write_data_info($data, 2)
	valid = __nfs_write_data_info($data, 3)
%:
	server_ip = __nfs_write_data_info($task->tk_calldata,0)
        prot = __nfs_write_data_info($task->tk_calldata,1)
	count = __nfs_write_data_info($task->tk_calldata, 2)
	valid = __nfs_write_data_info($task->tk_calldata, 3)
%)
        version =3
	status = $task->tk_status

	name = "nfs.proc3.write_done"
	argstr = sprintf("%d",status)
}

probe nfs.proc3.write_done.return = kernel.function("nfs3_write_done").return !,
                             module("nfs").function("nfs3_write_done").return ?
{
        version =3
	name = "nfs.proc3.write_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}

probe nfs.proc4.write_done = kernel.function("nfs4_write_done") !,
                             module("nfs").function("nfs4_write_done") ?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_write_data_info($data,0)
        prot = __nfs_write_data_info($data,1)
	count = __nfs_write_data_info($data, 2)
	valid = __nfs_write_data_info($data, 3)
	timestamp = __nfs_write_data_info($data, 4)
%:
	server_ip = __nfs_write_data_info($task->tk_calldata,0)
        prot = __nfs_write_data_info($task->tk_calldata,1)
	count = __nfs_write_data_info($task->tk_calldata, 2)
	valid = __nfs_write_data_info($task->tk_calldata, 3)
	timestamp = __nfs_write_data_info($task->tk_calldata, 4)
%)
        version =4
	status = $task->tk_status

	name = "nfs.proc4.write_done"
	argstr = sprintf("%d",status)
}

probe nfs.proc4.write_done.return = kernel.function("nfs4_write_done").return !,
                             module("nfs").function("nfs4_write_done").return ?
{
        version =4
	name = "nfs.proc4.write_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}


/*probe nfs.proc.commit_setup
*
* The commit_setup function is used to setup a commit rpc task,not do
* a real commit operation.It is not exist in NFSV2
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   size :
*   count : read bytes in this execution
*   offset : the file offset
*   bitmask0:
*   bitmask1 :V4 bitmask representing the set of attributes 
*             supported on this filesystem (only in probe nfs.proc4.commit_setup)
*/

probe nfs.proc.commit_setup =nfs.proc3.commit_setup,
                             nfs.proc4.commit_setup
{}
probe nfs.proc.commit_setup.return =nfs.proc3.commit_setup.return,
                             nfs.proc4.commit_setup.return
{}



probe nfs.proc3.commit_setup = kernel.function("nfs3_proc_commit_setup") !,
                              module("nfs").function("nfs3_proc_commit_setup") ?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =3

        count = $data->args->count
        offset = $data->args->offset

	name = "nfs.proc3.commit_setup"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}
probe nfs.proc3.commit_setup.return = kernel.function("nfs3_proc_commit_setup") .return!,
                              module("nfs").function("nfs3_proc_commit_setup").return ?
{
	name = "nfs.proc3.commit_setup.return"
	retvalue = 0
}

probe nfs.proc4.commit_setup = kernel.function("nfs4_proc_commit_setup") !,
                              module("nfs").function("nfs4_proc_commit_setup") ?
{
	client = stap_NFS_CLIENT($data->inode)
	server_ip = get_ip_from_client(client)
	prot = get_prot_from_client(client)
        version =4

        count = $data->args->count
        offset = $data->args->offset
        bitmask0 = __nfsv4_bitmask($data->inode,0)
        bitmask1 = __nfsv4_bitmask($data->inode,1)
	//timestamp = $jiffies
	
	name = "nfs.proc4.commit_setup"
	argstr = sprintf("%d,%d",count,offset)

        size = count
        units = "bytes"
}
probe nfs.proc4.commit_setup.return = kernel.function("nfs4_proc_commit_setup") .return!,
                              module("nfs").function("nfs4_proc_commit_setup").return ?
{
	name = "nfs.proc4.commit_setup.return"
	retvalue = 0
}


/*probe nfs.proc.commit_done
*
* Fires when a commit reply is received or some commit operation error occur
* (timeout or socket shutdown)
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version
*   status : result of last operation
*   valid  : fattr->valid ,indicates which fields are valid 
*   count  : number of bytes commited
*   timestamp : time stamp ,which is used for lease renewal (only
    in nfs.proc4.commit_done)
*/
probe nfs.proc.commit_done = 
                            nfs.proc3.commit_done,
                            nfs.proc4.commit_done 
{}

probe nfs.proc.commit_done.return = 
                            nfs.proc3.commit_done.return,
                            nfs.proc4.commit_done.return 
{}


probe nfs.proc3.commit_done = kernel.function("nfs3_commit_done") !,
                             module("nfs").function("nfs3_commit_done") ?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_write_data_info($data,0)
        prot = __nfs_write_data_info($data,1)
	count = __nfs_write_data_info($data, 2)
	valid = __nfs_write_data_info($data, 3)
%:
	server_ip = __nfs_write_data_info($task->tk_calldata,0)
        prot = __nfs_write_data_info($task->tk_calldata,1)
	count = __nfs_write_data_info($task->tk_calldata, 2)
	valid = __nfs_write_data_info($task->tk_calldata, 3)
%)
        version =3
	status = $task->tk_status

	name = "nfs.proc3.commit_done"
	argstr = sprintf("%d",status)
}

probe nfs.proc3.commit_done.return = kernel.function("nfs3_commit_done").return !,
                             module("nfs").function("nfs3_commit_done").return ?
{
        version =3
	name = "nfs.proc3.commit_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}

probe nfs.proc4.commit_done = kernel.function("nfs4_commit_done") !,
                             module("nfs").function("nfs4_commit_done") ?
{
%( kernel_v >= "2.6.10" %?
	server_ip = __nfs_write_data_info($data,0)
        prot = __nfs_write_data_info($data,1)
	count = __nfs_write_data_info($data, 2)
	valid = __nfs_write_data_info($data, 3)
	timestamp = __nfs_write_data_info($data, 4)
%:
	server_ip = __nfs_write_data_info($task->tk_calldata,0)
        prot = __nfs_write_data_info($task->tk_calldata,1)
	count = __nfs_write_data_info($task->tk_calldata, 2)
	valid = __nfs_write_data_info($task->tk_calldata, 3)
	timestamp = __nfs_write_data_info($task->tk_calldata, 4)
%)
        version =4
	status = $task->tk_status

	name = "nfs.proc4.commit_done"
	argstr = sprintf("%d",status)
}

probe nfs.proc4.commit_done.return = kernel.function("nfs4_commit_done").return !,
                             module("nfs").function("nfs4_commit_done").return ?
{
        version =4
	name = "nfs.proc4.commit_done.return"
%( kernel_v >= "2.6.17" %?
	retstr = sprintf("%d", $return)
%)
}
/*probe nfs.proc.open
*
*  Allocate file read/write context information
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version(the function is used for all NFS version)
*   filename : file name 
*   flag   : file flag
*   mode   : file  mode
*/

probe nfs.proc.open = kernel.function("nfs_open") !,
                      module("nfs").function("nfs_open") ?
{
	server_ip = __i2n_ip_proto($inode,0)
	prot = __i2n_ip_proto($inode,1)  	
	version = __nfs_version($inode)

	filename = __file_filename($filp)
	flag = $filp->f_flags
	mode = $filp->f_mode

	name = "nfs.proc.open"
	argstr = sprintf("%s,%d,%d",filename,flag,mode)
}

probe nfs.proc.open.return = kernel.function("nfs_open").return !,
                      module("nfs").function("nfs_open").return ?
{
	name = "nfs.proc.open.return"
	retstr = sprintf("%d", $return)
}

/*probe nfs.proc.release
*
*  Release file read/write context information
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version(the function is used for all NFS version)
*   filename : file name 
*   flag   : file flag
*   mode   : file  mode
*/
probe nfs.proc.release= kernel.function("nfs_release") !,
                      module("nfs").function("nfs_release") ?
{
	server_ip = __i2n_ip_proto($inode,0)
	prot = __i2n_ip_proto($inode,1)  	
	version = __nfs_version($inode)

	filename = __file_filename($filp)
	flag = $filp->f_flags
	mode = $filp->f_mode

	name = "nfs.proc.release"
	argstr = sprintf("%s,%d,%d",filename,flag,mode)
}

probe nfs.proc.release.return = kernel.function("nfs_release").return !,
                      module("nfs").function("nfs_release").return ?
{
	name = "nfs.proc.release.return"
	retstr = sprintf("%d", $return)
}
/*
*probe nfs.proc4.hadle_exception (only for NFSV4)
* This is the error handling routine for processes for nfsv4
*
* Arguments:
*  errorcode : indicates the type of error
*/
probe nfs.proc4.handle_exception = kernel.function("nfs4_handle_exception") !,
                               module("nfs").function("nfs4_handle_exception")?
{
	version =4
	
        errorcode = $errorcode

        name = "nfs.proc4.handle_exception"
        argstr =  sprintf("%d",errorcode)
}

probe nfs.proc4.handle_exception.return = kernel.function("nfs4_handle_exception").return !,
                               module("nfs").function("nfs4_handle_exception").return?
{
        name = "nfs.proc4.handle_exception.return"
        retstr =  sprintf("%d",$return)
}

/*
* probe nfs.proc.create
*   Fires when client creates a file on server
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version(the function is used for all NFS version)
*   fh : file handler of parent dir
*   filename : file name 
*   filelen : length of file name
*   flag : indicates create mode(only for NFSV3 and NFSV4)
*/
probe nfs.proc.create = nfs.proc2.create,
                        nfs.proc3.create,
                        nfs.proc4.create
{}

probe nfs.proc.create.return = nfs.proc2.create.return,
                               nfs.proc3.create.return,
                               nfs.proc4.create.return
{}

probe nfs.proc2.create = kernel.function("nfs_proc_create")!,
                         module("nfs").function("nfs_proc_create")?
{
	server_ip = __i2n_ip_proto($dir,0)
	prot = __i2n_ip_proto($dir,1)  	
	version =2

	fh = __getfh_inode($dir)
	filelen = $dentry->d_name->len
	filename = kernel_string_n($dentry->d_name->name, filelen)
	mode = $sattr->ia_mode

	name = "nfs.proc2.create"
	argstr = sprintf("%s",filename)
}

probe nfs.proc2.create.return = kernel.function("nfs_proc_create").return!,
                         module("nfs").function("nfs_proc_create").return?
{
	name = "nfs.proc2.create.return"
	version =2
	retstr = sprintf("%d",$return)
}

probe nfs.proc3.create = kernel.function("nfs3_proc_create")!,
                         module("nfs").function("nfs3_proc_create")?
{
	server_ip = __i2n_ip_proto($dir,0)
	prot = __i2n_ip_proto($dir,1)  	
	version =3

	fh = __getfh_inode($dir)
	filelen = $dentry->d_name->len
	filename = kernel_string_n($dentry->d_name->name, filelen)
	flag = $flags
	mode = $sattr->ia_mode

	name = "nfs.proc3.create"
	argstr = sprintf("%s",filename)
}

probe nfs.proc3.create.return = kernel.function("nfs3_proc_create").return!,
                         module("nfs").function("nfs3_proc_create").return?
{
	name = "nfs.proc3.create.return"
	version =3
	retstr = sprintf("%d",$return)
}

probe nfs.proc4.create = kernel.function("nfs4_proc_create")!,
                         module("nfs").function("nfs4_proc_create")?
{
	server_ip = __i2n_ip_proto($dir,0)
	prot = __i2n_ip_proto($dir,1)  	
	version =4

	fh = __getfh_inode($dir)
	filelen = $dentry->d_name->len
	filename = kernel_string_n($dentry->d_name->name, filelen)
	flag = $flags
	mode = $sattr->ia_mode

	name = "nfs.proc4.create"
	argstr = sprintf("%s",filename)
}

probe nfs.proc4.create.return = kernel.function("nfs4_proc_create").return!,
                         module("nfs").function("nfs4_proc_create").return?
{
	name = "nfs.proc4.create.return"
	version =4
	retstr = sprintf("%d",$return)
}

/*
* probe nfs.proc.remove
*   Fires when client removes a file on server
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version(the function is used for all NFS version)
*   fh : file handler of parent dir
*   filename : file name 
*   filelen : length of file name
*/
probe nfs.proc.remove = nfs.proc2.remove,
                        nfs.proc3.remove,
                        nfs.proc4.remove
{}

probe nfs.proc.remove.return = nfs.proc2.remove.return,
                               nfs.proc3.remove.return,
                               nfs.proc4.remove.return
{}

probe nfs.proc2.remove = kernel.function("nfs_proc_remove")!,
                         module("nfs").function("nfs_proc_remove")?
{
	server_ip = __i2n_ip_proto($dir,0)
	prot = __i2n_ip_proto($dir,1)  	
	version =2

	fh = __getfh_inode($dir)
	filelen = $name->len
	filename = kernel_string_n($name->name, filelen)

	name = "nfs.proc2.remove"
	argstr = sprintf("%s",filename)
}

probe nfs.proc2.remove.return = kernel.function("nfs_proc_remove").return!,
                         module("nfs").function("nfs_proc_remove").return?
{
	name = "nfs.proc2.remove.return"
	version =2
	retstr = sprintf("%d",$return)
}

probe nfs.proc3.remove = kernel.function("nfs3_proc_remove")!,
                         module("nfs").function("nfs3_proc_remove")?
{
	server_ip = __i2n_ip_proto($dir,0)
	prot = __i2n_ip_proto($dir,1)  	
	version =3

	fh = __getfh_inode($dir)
	filelen = $name->len
	filename = kernel_string_n($name->name, filelen)

	name = "nfs.proc3.remove"
	argstr = sprintf("%s",filename)
}

probe nfs.proc3.remove.return = kernel.function("nfs3_proc_remove").return!,
                         module("nfs").function("nfs3_proc_remove").return?
{
	name = "nfs.proc3.remove.return"
	version =3
	retstr = sprintf("%d",$return)
}

probe nfs.proc4.remove = kernel.function("nfs4_proc_remove")!,
                         module("nfs").function("nfs4_proc_remove")?
{
	server_ip = __i2n_ip_proto($dir,0)
	prot = __i2n_ip_proto($dir,1)  	
	version =4

	fh = __getfh_inode($dir)
	filelen = $name->len
	filename = kernel_string_n($name->name, filelen)

	name = "nfs.proc4.remove"
	argstr = sprintf("%s",filename)
}

probe nfs.proc4.remove.return = kernel.function("nfs4_proc_remove").return!,
                         module("nfs").function("nfs4_proc_remove").return?
{
	name = "nfs.proc4.remove.return"
	version =4
	retstr = sprintf("%d",$return)
}

/*
* probe nfs.proc.rename
*   Fires when client renames a file on server
*
* Arguments:
*   server_ip : ip address of server
*   prot  : transfer protocol
*   version : nfs version(the function is used for all NFS version)
*   old_fh : file handler of old parent dir
*   new_fh : file handler of new parent dir
*   old_name : old file name 
*   old_filelen : length of old file name
*   new_name : new file name 
*   new_filelen : length of new file name
*/
probe nfs.proc.rename = nfs.proc2.rename,
                        nfs.proc3.rename,
                        nfs.proc4.rename
{}

probe nfs.proc.rename.return = nfs.proc2.rename.return,
                               nfs.proc3.rename.return,
                               nfs.proc4.rename.return
{}

probe nfs.proc2.rename = kernel.function("nfs_proc_rename")!,
                         module("nfs").function("nfs_proc_rename")?
{
	server_ip = __i2n_ip_proto($old_dir,0)
	prot = __i2n_ip_proto($old_dir,1)  	
	version =2

	old_fh = __getfh_inode($old_dir)
	old_filelen = $old_name->len
	old_name = kernel_string_n($old_name->name, old_filelen)
	new_fh = __getfh_inode($new_dir)
	new_filelen = $new_name->len
	new_name = kernel_string_n($new_name->name, new_filelen)

	name = "nfs.proc2.rename"
	argstr = sprintf("%s,%s",old_name,new_name)
}

probe nfs.proc2.rename.return = kernel.function("nfs_proc_rename").return!,
                         module("nfs").function("nfs_proc_rename").return?
{
	name = "nfs.proc2.rename.return"
	version =2
	retstr = sprintf("%d",$return)
}

probe nfs.proc3.rename = kernel.function("nfs3_proc_rename")!,
                         module("nfs").function("nfs3_proc_rename")?
{
	server_ip = __i2n_ip_proto($old_dir,0)
	prot = __i2n_ip_proto($old_dir,1)  	
	version =3

	old_fh = __getfh_inode($old_dir)
	old_filelen = $old_name->len
	old_name = kernel_string_n($old_name->name, old_filelen)
	new_fh = __getfh_inode($new_dir)
	new_filelen = $new_name->len
	new_name = kernel_string_n($new_name->name, new_filelen)

	name = "nfs.proc3.rename"
	argstr = sprintf("%s,%s",old_name,new_name)
}

probe nfs.proc3.rename.return = kernel.function("nfs3_proc_rename").return!,
                         module("nfs").function("nfs3_proc_rename").return?
{
	name = "nfs.proc3.rename.return"
	version =3
	retstr = sprintf("%d",$return)
}

probe nfs.proc4.rename = kernel.function("nfs4_proc_rename")!,
                         module("nfs").function("nfs4_proc_rename")?
{
	server_ip = __i2n_ip_proto($old_dir,0)
	prot = __i2n_ip_proto($old_dir,1)  	
	version =4

	old_fh = __getfh_inode($old_dir)
	old_filelen = $old_name->len
	old_name = kernel_string_n($old_name->name, old_filelen)
	new_fh = __getfh_inode($new_dir)
	new_filelen = $new_name->len
	new_name = kernel_string_n($new_name->name, new_filelen)

	name = "nfs.proc4.rename"
	argstr = sprintf("%s,%s",old_name,new_name)
}

probe nfs.proc4.rename.return = kernel.function("nfs4_proc_rename").return!,
                         module("nfs").function("nfs4_proc_rename").return?
{
	name = "nfs.proc4.rename.return"
	version =4
	retstr = sprintf("%d",$return)
}

Youez - 2016 - github.com/yon3zu
LinuXploit