diff options
-rw-r--r-- | tapset/ChangeLog | 6 | ||||
-rw-r--r-- | tapset/LKET/Changelog | 5 | ||||
-rwxr-xr-x | tapset/LKET/nfs.stp | 16 | ||||
-rw-r--r-- | tapset/ioscheduler.stp | 12 | ||||
-rw-r--r-- | tapset/nfs.stp | 154 | ||||
-rw-r--r-- | tapset/nfs_proc.stp | 32 | ||||
-rw-r--r-- | tapset/nfsd.stp | 18 | ||||
-rw-r--r-- | tapset/rpc.stp | 20 | ||||
-rw-r--r-- | tapset/vfs.stp | 151 |
9 files changed, 306 insertions, 108 deletions
diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 8ab95e7b..c73c5b6b 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,9 @@ +2006-12-29 Li Guanglei <guanglei@cn.ibm.com> + + From Gui Jian <guij@cn.ibm.com> + * ioscheduler.stp, nfsd.stp, nfs.stp, nfs_proc.stp, + rpc.stp, vfs.stp: patch for 2.6.19 kernel + 2006-12-18 Frank Ch. Eigler <fche@elastic.org> * vfs.stp (ppos_pos): Protect contents with deref(), though diff --git a/tapset/LKET/Changelog b/tapset/LKET/Changelog index 68c6fd57..96bfadc0 100644 --- a/tapset/LKET/Changelog +++ b/tapset/LKET/Changelog @@ -1,3 +1,8 @@ +2006-12-29 Li Guanglei <guanglei@cn.ibm.com> + + From Gui Jian <guij@cn.ibm.com> + * nfs.stp: patch for 2.6.19 kernel + 2006-12-23 Li Guanglei <guanglei@cn.ibm.com> From Gui Jian <guij@cn.ibm.com> diff --git a/tapset/LKET/nfs.stp b/tapset/LKET/nfs.stp index eb2566b3..3e4c1e53 100755 --- a/tapset/LKET/nfs.stp +++ b/tapset/LKET/nfs.stp @@ -1,3 +1,15 @@ +/* Helper functions */ +function __file_fsname:string (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) + || (file->f_dentry == NULL) + || (file->f_dentry->d_inode == NULL)) + strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN); + else { + strlcpy(THIS->__retvalue, file->f_dentry->d_inode->i_sb->s_type->name, MAXSTRINGLEN); + } +%} + probe never { printf("%d",GROUP_NFS) @@ -108,7 +120,7 @@ probe addevent.nfs.fop.read.entry probe _addevent.nfs.fop.read.entry = nfs.fop.read { - filesystem = kernel_string($filp->f_dentry->d_inode->i_sb->s_type->name) + filesystem = __file_fsname($filp) if(filesystem == "nfs") log_fop_rw(HOOKID_NFS_FOP_READ_ENTRY,s_id,fileid,buf,len,pos) @@ -144,7 +156,7 @@ probe addevent.nfs.fop.write.entry probe _addevent.nfs.fop.write.entry = nfs.fop.write { - filesystem = kernel_string($filp->f_dentry->d_inode->i_sb->s_type->name) + filesystem = __file_fsname($filp) if(filesystem == "nfs") log_fop_rw(HOOKID_NFS_FOP_WRITE_ENTRY,s_id,fileid,buf,len,pos) diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp index 9c3714f4..ba732b65 100644 --- a/tapset/ioscheduler.stp +++ b/tapset/ioscheduler.stp @@ -32,7 +32,11 @@ probe ioscheduler.elv_next_request.return disk_minor = -1 } else { req = $return +%( kernel_v >= "2.6.19" %? + req_flags = $return->cmd_flags +%: req_flags = $return->flags +%) if($return->rq_disk == 0) { disk_major = -1 disk_minor = -1 @@ -66,7 +70,11 @@ probe ioscheduler.elv_add_request } req = $rq +%( kernel_v >= "2.6.19" %? + req_flags = $rq->cmd_flags +%: req_flags = $rq->flags +%) } /* when a request is completed */ @@ -92,7 +100,11 @@ probe ioscheduler.elv_completed_request } req = $rq +%( kernel_v >= "2.6.19" %? + req_flags = $rq->cmd_flags +%: req_flags = $rq->flags +%) } function disk_major_from_request:long(var_q:long) diff --git a/tapset/nfs.stp b/tapset/nfs.stp index 2edf59cd..39040c68 100644 --- a/tapset/nfs.stp +++ b/tapset/nfs.stp @@ -232,6 +232,54 @@ function __d_loff_t :long (ppos :long) %{ /* pure */ THIS->__retvalue = *ppos; %} +function __file_inode:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = deref(sizeof(file->f_dentry->d_inode), + &(file->f_dentry->d_inode)); + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference fault"; + } +%} + +function __file_id:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = (long)&(file->f_dentry->d_inode->i_sb->s_id); +%} + +function __file_mode:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = deref(sizeof(file->f_dentry->d_inode->i_mode), + &(file->f_dentry->d_inode->i_mode)); + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference fault"; + } +%} + +function __file_parentname:string (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) + || (file->f_dentry == NULL) + || (file->f_dentry->d_parent == NULL)) + strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN); + else { + strlcpy(THIS->__retvalue, file->f_dentry->d_parent->d_name->name, MAXSTRINGLEN); + } +%} + probe nfs.fop.entries = nfs.fop.llseek, nfs.fop.read, nfs.fop.write, @@ -283,12 +331,12 @@ probe nfs.fop.return = nfs.fop.llseek.return, probe nfs.fop.llseek = kernel.function ("nfs_file_llseek") ?, module("nfs").function("nfs_file_llseek") ? { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - ino = $filp->f_dentry->d_inode->i_ino - s_id = $filp->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($filp) + ino = __file_ino($filp) + s_id = __file_id($filp) devname = kernel_string(s_id) - maxbyte = $filp->f_dentry->d_inode->i_sb->s_maxbytes + maxbyte = __file_maxbytes($filp) offset = $offset origin = $origin @@ -313,7 +361,7 @@ probe nfs.fop.llseek.return = kernel.function ("nfs_file_llseek").return ?, */ probe nfs.fop.read = vfs.do_sync_read { - s_id = $filp->f_dentry->d_inode->i_sb->s_id + s_id = __file_id($filp) devname = kernel_string(s_id) name = "nfs.fop.read" } @@ -335,7 +383,7 @@ probe nfs.fop.read.return = vfs.do_sync_read.return probe nfs.fop.write = vfs.do_sync_write { - s_id = $filp->f_dentry->d_inode->i_sb->s_id + s_id = __file_id($filp) devname = kernel_string(s_id) name = "nfs.fop.write" } @@ -368,22 +416,27 @@ probe nfs.fop.write.return = vfs.do_sync_write.return probe nfs.fop.aio_read = kernel.function ("nfs_file_read") ?, module("nfs").function("nfs_file_read") ? { - dev = $iocb->ki_filp->f_dentry->d_inode->i_sb->s_dev - ino = $iocb->ki_filp->f_dentry->d_inode->i_ino - s_id = $iocb->ki_filp->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($iocb->ki_filp) + ino = __file_ino($iocb->ki_filp) + s_id = __file_id($iocb->ki_filp) devname = kernel_string(s_id) count = $count pos = $pos + +%( kernel_v >= "2.6.19" %? + buf = $iov->iov_base +%: buf = $buf +%) - parent_name = kernel_string($iocb->ki_filp->f_dentry->d_parent->d_name->name) - file_name = kernel_string($iocb->ki_filp->f_dentry->d_name->name) + parent_name = __file_parentname($iocb->ki_filp) + file_name = __file_filename($iocb->ki_filp) - cache_valid = __nfsi_cache_valid($iocb->ki_filp->f_dentry->d_inode) - cache_time = __nfsi_rcache_time($iocb->ki_filp->f_dentry->d_inode) - attr_time = __nfsi_attr_time($iocb->ki_filp->f_dentry->d_inode) + cache_valid = __nfsi_cache_valid(__file_inode($iocb->ki_filp)) + cache_time = __nfsi_rcache_time(__file_inode($iocb->ki_filp)) + attr_time = __nfsi_attr_time(__file_inode($iocb->ki_filp)) name = "nfs.fop.aio_read" @@ -423,17 +476,21 @@ probe nfs.fop.aio_read.return = kernel.function ("nfs_file_read").return ?, probe nfs.fop.aio_write = kernel.function("nfs_file_write") ?, module("nfs").function("nfs_file_write") ? { - dev = $iocb->ki_filp->f_dentry->d_inode->i_sb->s_dev - ino = $iocb->ki_filp->f_dentry->d_inode->i_ino - s_id = $iocb->ki_filp->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($iocb->ki_filp) + ino = __file_ino($iocb->ki_filp) + s_id = __file_id($iocb->ki_filp) devname = kernel_string(s_id) count = $count pos = $pos +%( kernel_v >= "2.6.19" %? + buf = $iov->iov_base +%: buf = $buf +%) - parent_name = kernel_string($iocb->ki_filp->f_dentry->d_parent->d_name->name) - file_name = kernel_string($iocb->ki_filp->f_dentry->d_name->name) + parent_name = __file_parentname($iocb->ki_filp) + file_name = __file_filename($iocb->ki_filp) name = "nfs.fop.aio.write" argstr = sprintf("%p, %d, %d", buf, count, pos) @@ -479,21 +536,21 @@ probe nfs.fop.aio_write.return = kernel.function("nfs_file_write").return ?, probe nfs.fop.mmap = kernel.function("nfs_file_mmap") ?, module("nfs").function("nfs_file_mmap") ? { - dev = $file->f_dentry->d_inode->i_sb->s_dev - ino = $file->f_dentry->d_inode->i_ino - s_id = $file->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($file) + ino = __file_ino($file) + s_id = __file_id($file) devname = kernel_string(s_id) vm_start = $vma->vm_start vm_end = $vma->vm_end vm_flags = $vma->vm_flags - parent_name = kernel_string($file->f_dentry->d_parent->d_name->name) - file_name = kernel_string($file->f_dentry->d_name->name) + parent_name = __file_parentname($file) + file_name = __file_filename($file) - cache_valid = __nfsi_cache_valid($file->f_dentry->d_inode) - cache_time = __nfsi_rcache_time($file->f_dentry->d_inode) - attr_time = __nfsi_attr_time($file->f_dentry->d_inode) + cache_valid = __nfsi_cache_valid(__file_inode($file)) + cache_time = __nfsi_rcache_time(__file_inode($file)) + attr_time = __nfsi_attr_time(__file_inode($file)) name = "nfs.fop.mmap" argstr = sprintf("0x%x, 0x%x, 0x%x", vm_start, vm_end, vm_flags) @@ -521,12 +578,12 @@ probe nfs.fop.mmap.return = kernel.function("nfs_file_mmap").return ?, probe nfs.fop.open = kernel.function("nfs_file_open") ?, module("nfs").function("nfs_file_open") ? { - dev = $filp->f_dentry->d_inode->i_sb->s_dev + dev = __file_dev($filp) ino = $inode->i_ino s_id = $inode->i_sb->s_id devname = kernel_string(s_id) - filename = kernel_string($filp->f_dentry->d_name->name) + filename = __file_filename($filp) flag = $filp->f_flags i_size = $inode->i_size @@ -556,13 +613,13 @@ probe nfs.fop.open.return = kernel.function("nfs_file_open").return ?, probe nfs.fop.flush = kernel.function("nfs_file_flush") ?, module("nfs").function("nfs_file_flush") ? { - dev = $file->f_dentry->d_inode->i_sb->s_dev - ino = $file->f_dentry->d_inode->i_ino; - s_id = $file->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($file) + ino = __file_ino($file) + s_id = __file_id($file) devname = kernel_string(s_id) mode = $file->f_mode - ndirty = __nfsi_ndirty($file->f_dentry->d_inode) + ndirty = __nfsi_ndirty(__file_inode($file)) name = "nfs.fop.flush" argstr = sprintf("%d",ino) @@ -588,7 +645,7 @@ probe nfs.fop.flush.return = kernel.function("nfs_file_flush").return ?, probe nfs.fop.release = kernel.function("nfs_file_release") ?, module("nfs").function("nfs_file_release") ? { - dev = $filp->f_dentry->d_inode->i_sb->s_dev + dev = __file_dev($filp) ino = $inode->i_ino s_id = $inode->i_sb->s_id devname = kernel_string(s_id) @@ -619,12 +676,12 @@ probe nfs.fop.release.return = kernel.function("nfs_file_release").return ?, probe nfs.fop.fsync = kernel.function("nfs_fsync") ?, module("nfs").function("nfs_fsync") ? { - dev = $file->f_dentry->d_inode->i_sb->s_dev - ino = $file->f_dentry->d_inode->i_ino - s_id = $file->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($file) + ino = __file_ino($file) + s_id = __file_id($file) devname = kernel_string(s_id) - ndirty = __nfsi_ndirty($file->f_dentry->d_inode) + ndirty = __nfsi_ndirty(__file_inode($file)) name = "nfs.fop.fsync" argstr = sprintf("%d",ino) @@ -655,12 +712,12 @@ probe nfs.fop.fsync.return = kernel.function("nfs_fsync").return ?, probe nfs.fop.lock = kernel.function("nfs_lock") ?, module("nfs").function("nfs_lock") ? { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - ino = $filp->f_dentry->d_inode->i_ino - s_id = $filp->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($filp) + ino = __file_ino($filp) + s_id = __file_id($filp) devname = kernel_string(s_id) - i_mode = $filp->f_dentry->d_inode->i_mode + i_mode = __file_mode($filp) cmd = $cmd fl_type = $fl->fl_type @@ -702,18 +759,17 @@ probe nfs.fop.sendfile = kernel.function("nfs_file_sendfile") ?, module("nfs").function("nfs_file_sendfile") ? { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - ino = $filp->f_dentry->d_inode->i_ino - s_id = $filp->f_dentry->d_inode->i_sb->s_id + dev = __file_dev($filp) + ino = __file_ino($filp) + s_id = __file_id($filp) devname = kernel_string(s_id) count = $count ppos = __d_loff_t($ppos) - cache_valid = __nfsi_cache_valid($filp->f_dentry->d_inode) - cache_time = __nfsi_rcache_time($filp->f_dentry->d_inode) - attr_time = __nfsi_attr_time($filp->f_dentry->d_inode) - + cache_valid = __nfsi_cache_valid(__file_inode($filp)) + cache_time = __nfsi_rcache_time(__file_inode($filp)) + attr_time = __nfsi_attr_time(__file_inode($filp)) name = "nfs.fop.sendfile" argstr = sprintf("%d,%d", count,ppos) diff --git a/tapset/nfs_proc.stp b/tapset/nfs_proc.stp index 6284ce63..b8226630 100644 --- a/tapset/nfs_proc.stp +++ b/tapset/nfs_proc.stp @@ -14,10 +14,14 @@ { struct rpc_clnt * tk_client; struct rpc_xprt * cl_xprt; + struct sockaddr_in *addr; tk_client = task->tk_client; cl_xprt= tk_client->cl_xprt; - - return cl_xprt->addr.sin_addr.s_addr; + addr = (struct sockaddr_in *)&(cl_xprt->addr); + if (addr->sin_family != AF_INET) + /* Now consider ipv4 only */ + return 0; + return addr->sin_addr.s_addr; } int get_prot(struct rpc_task * task) { @@ -34,16 +38,20 @@ 1:get proto */ function __i2n_ip_proto :long(dir:long,index:long) %{ /* pure */ - int index = (int) (THIS->index); - struct inode * dir = (struct inode *)(THIS->dir); + int index = (int) (THIS->index); + struct inode * dir = (struct inode *)(THIS->dir); struct rpc_clnt * clnt = NFS_CLIENT(dir); struct rpc_xprt * cl_xprt = clnt->cl_xprt; - struct sockaddr_in * addr = &(cl_xprt->addr); - - if(index == 0) - THIS->__retvalue = addr->sin_addr.s_addr; - else - THIS->__retvalue = cl_xprt->prot; + struct sockaddr_in * addr = (struct sockaddr_in *)&(cl_xprt->addr); + + if(index == 0) { + if (addr->sin_family == AF_INET) { + /* Now consider ipv4 only */ + THIS->__retvalue = addr->sin_addr.s_addr; + } else + THIS->__retvalue = 0; + } else + THIS->__retvalue = cl_xprt->prot; %} /* @@ -1220,7 +1228,7 @@ probe nfs.proc.open = kernel.function("nfs_open") ?, prot = __i2n_ip_proto($inode,1) version = __nfs_version($inode) - filename = kernel_string($filp->f_dentry->d_name->name) + filename = __file_filename($filp) flag = $filp->f_flags mode = $filp->f_mode @@ -1254,7 +1262,7 @@ probe nfs.proc.release= kernel.function("nfs_release") ?, prot = __i2n_ip_proto($inode,1) version = __nfs_version($inode) - filename = kernel_string($filp->f_dentry->d_name->name) + filename = __file_filename($filp) flag = $filp->f_flags mode = $filp->f_mode diff --git a/tapset/nfsd.stp b/tapset/nfsd.stp index aabdf51a..8d8a09a0 100644 --- a/tapset/nfsd.stp +++ b/tapset/nfsd.stp @@ -297,7 +297,11 @@ probe nfsd.proc2.read = kernel.function("nfsd_proc_read")?, count = $argp->count offset = $argp->offset +%( kernel_v >= "2.6.19" %? + vec = $rqstp->rq_vec +%: vec = $argp->vec +%) vlen = $argp->vlen name = "nfsd.proc2.read" @@ -326,7 +330,11 @@ probe nfsd.proc3.read = kernel.function("nfsd3_proc_read")?, count = $argp->count offset = $argp->offset +%( kernel_v >= "2.6.19" %? + vec = $rqstp->rq_vec +%: vec = $argp->vec +%) vlen = $argp->vlen name = "nfsd.proc3.read" @@ -382,7 +390,11 @@ probe nfsd.proc2.write = kernel.function("nfsd_proc_write")?, count = $argp->len offset = $argp->offset +%( kernel_v >= "2.6.19" %? + vec = $rqstp->rq_vec +%: vec = $argp->vec +%) vlen = $argp->vlen name = "nfsd.proc2.write" @@ -411,7 +423,11 @@ probe nfsd.proc3.write = kernel.function("nfsd3_proc_write")?, count = $argp->count offset = $argp->offset +%( kernel_v >= "2.6.19" %? + vec = $rqstp->rq_vec +%: vec = $argp->vec +%) vlen = $argp->vlen stable = $argp->stable @@ -778,7 +794,7 @@ probe nfsd.open.return = kernel.function("nfsd_open").return ?, probe nfsd.close = kernel.function("nfsd_close")?, module("nfsd").function("nfsd_close")? { - filename = kernel_string($filp->f_dentry->d_name->name) + filename = __file_filename($filp) name = "nfsd.close" argstr = sprintf("%s",filename) diff --git a/tapset/rpc.stp b/tapset/rpc.stp index 042f878f..ef001e9e 100644 --- a/tapset/rpc.stp +++ b/tapset/rpc.stp @@ -828,25 +828,41 @@ function xid_from_clnt:long(clnt:long) function prog_from_clnt:long(clnt:long) %{ struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + THIS->__retvalue = clnt ? clnt->cl_prog : 0; +#else THIS->__retvalue = clnt ? clnt->cl_pmap->pm_prog : 0; +#endif %} function vers_from_clnt:long(clnt:long) %{ struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + THIS->__retvalue = clnt ? clnt->cl_vers : 0; +#else THIS->__retvalue = clnt ? clnt->cl_pmap->pm_vers : 0; +#endif %} function prot_from_clnt:long(clnt:long) %{ struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt; - THIS->__retvalue = clnt ? clnt->cl_pmap->pm_prot : 0; + THIS->__retvalue = clnt ? clnt->cl_xprt->prot : 0; %} function port_from_clnt:long(clnt:long) %{ struct rpc_clnt *clnt = (struct rpc_clnt *)(long)THIS->clnt; - THIS->__retvalue = clnt ? clnt->cl_pmap->pm_port : 0; + if(clnt != NULL) { + struct sockaddr_in *addr = (struct sockaddr_in *)&(clnt->cl_xprt->addr); + if(addr != NULL && addr->sin_family == AF_INET) { + /* Now consider ipv4 only */ + THIS->__retvalue = ntohs(addr->sin_port); + return; + } + } + THIS->__retvalue = 0; %} function clones_from_clnt:long(clnt:long) diff --git a/tapset/vfs.stp b/tapset/vfs.stp index b121d5b9..eecc87f0 100644 --- a/tapset/vfs.stp +++ b/tapset/vfs.stp @@ -88,15 +88,82 @@ deref_fault: } %} +function __file_dev:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = deref(sizeof(file->f_dentry->d_inode->i_sb->s_dev), + &(file->f_dentry->d_inode->i_sb->s_dev)); + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference fault"; + } +%} + +function __file_bdev:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = deref(sizeof(file->f_dentry->d_inode->i_sb->s_bdev), + &(file->f_dentry->d_inode->i_sb->s_bdev)); + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference fault"; + } +%} + +function __file_ino:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = deref(sizeof(file->f_dentry->d_inode->i_ino), + &(file->f_dentry->d_inode->i_ino)); + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference fault"; + } +%} + +function __file_maxbytes:long (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) || (file->f_dentry == NULL)) { + THIS->__retvalue = 0; + return; + } + THIS->__retvalue = deref(sizeof(file->f_dentry->d_inode->i_sb->s_maxbytes), + &(file->f_dentry->d_inode->i_sb->s_maxbytes)); + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference fault"; + } +%} + +function __file_filename:string (file:long) %{ /* pure */ + struct file *file = (struct file *)(long)THIS->file; + if ((file == NULL) + || (file->f_dentry == NULL) + || (file->f_dentry->d_name.name == NULL)) + strlcpy(THIS->__retvalue, "NULL", MAXSTRINGLEN); + else { + strlcpy(THIS->__retvalue, file->f_dentry->d_name.name, MAXSTRINGLEN); + } +%} + probe generic.fop.llseek = kernel.function ("generic_file_llseek") { - dev = $file->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $file->f_dentry->d_inode->i_sb->s_bdev) - ino = $file->f_dentry->d_inode->i_ino + dev = __file_dev($file) + devname = __find_bdevname(dev, __file_bdev($file)) + ino = __file_ino($file) offset = $offset origin = $origin - maxbyte = $file->f_dentry->d_inode->i_sb->s_maxbytes + maxbyte = __file_maxbytes($file) name = "generic_file_llseek" argstr = sprintf("%d, %d", offset, origin) @@ -109,9 +176,9 @@ probe generic.fop.llseek.return = kernel.function ("generic_file_llseek").return probe generic.fop.aio_read = kernel.function ("generic_file_aio_read") { - dev = $iocb->ki_filp->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $iocb->ki_filp->f_dentry->d_inode->i_sb->s_bdev) - ino = $iocb->ki_filp->f_dentry->d_inode->i_ino + dev = __file_dev($iocb->ki_filp) + devname = __find_bdevname(dev, __file_bdev($iocb->ki_filp)) + ino = __file_ino($iocb->ki_filp) count = $count pos = $pos @@ -136,9 +203,9 @@ probe generic.fop.aio_read.return = kernel.function ("generic_file_aio_read").re probe generic.fop.aio_write = kernel.function ("generic_file_aio_write") { - dev = $iocb->ki_filp->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $iocb->ki_filp->f_dentry->d_inode->i_sb->s_bdev) - ino = $iocb->ki_filp->f_dentry->d_inode->i_ino + dev = __file_dev($iocb->ki_filp) + devname = __find_bdevname(dev, __file_bdev($iocb->ki_filp)) + ino = __file_ino($iocb->ki_filp) count = $count pos = $pos @@ -163,9 +230,9 @@ probe generic.fop.aio_write.return = kernel.function ("generic_file_aio_write"). probe generic.fop.readv = kernel.function ("generic_file_readv") { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $filp->f_dentry->d_inode->i_sb->s_bdev) - ino = $filp->f_dentry->d_inode->i_ino + dev = __file_dev($filp) + devname = __find_bdevname(dev, __file_bdev($filp)) + ino = __file_ino($filp) nr_segs = $nr_segs pos = ppos_pos($ppos) @@ -190,9 +257,9 @@ probe generic.fop.readv.return = kernel.function ("generic_file_readv").return /* calls __generic_file_write_nolock */ probe generic.fop.writev = kernel.function ("generic_file_writev") { - dev = $file->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $file->f_dentry->d_inode->i_sb->s_bdev) - ino = $file->f_dentry->d_inode->i_ino + dev = __file_dev($file) + devname = __find_bdevname(dev, __file_bdev($file)) + ino = __file_ino($file) nr_segs = $nr_segs pos = ppos_pos($ppos) @@ -219,9 +286,9 @@ probe generic.fop.writev.return = kernel.function ("generic_file_writev").return add filemap_nopage, filemap_populate */ probe generic.fop.mmap = kernel.function ("generic_file_mmap") { - dev = $file->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $file->f_dentry->d_inode->i_sb->s_bdev) - ino = $file->f_dentry->d_inode->i_ino + dev = __file_dev($file) + devname = __find_bdevname(dev, __file_bdev($file)) + ino = __file_ino($file) vm_start = $vma->vm_start vm_end = $vma->vm_end @@ -238,11 +305,11 @@ probe generic.fop.mmap.return = kernel.function ("generic_file_mmap").return probe generic.fop.open = kernel.function ("generic_file_open") { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $filp->f_dentry->d_inode->i_sb->s_bdev) + dev = __file_dev($filp) + devname = __find_bdevname(dev, __file_bdev($filp)) ino = $inode->i_ino - filename = kernel_string($filp->f_dentry->d_name->name) + filename = __file_filename($filp) flag = $filp->f_flags size = $inode->i_size @@ -257,9 +324,9 @@ probe generic.fop.open.return = kernel.function ("generic_file_open").return probe generic.fop.sendfile = kernel.function ("generic_file_sendfile") { - dev = $in_file->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $in_file->f_dentry->d_inode->i_sb->s_bdev) - ino = $in_file->f_dentry->d_inode->i_ino + dev = __file_dev($in_file) + devname = __find_bdevname(dev, __file_bdev($in_file)) + ino = __file_ino($in_file) count = $count ppos = $ppos @@ -283,9 +350,9 @@ probe generic.fop.sendfile.return = kernel.function ("generic_file_sendfile").re probe generic.fop.splice_read = kernel.function ("generic_file_splice_read") { - dev = $in->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $in->f_dentry->d_inode->i_sb->s_bdev) - ino = $in->f_dentry->d_inode->i_ino + dev = __file_dev($in) + devname = __find_bdevname(dev, __file_bdev($in)) + ino = __file_ino($in) len = $len flags = $flags @@ -309,9 +376,9 @@ probe generic.fop.splice_read.return = kernel.function ("generic_file_splice_rea probe generic.fop.splice_write = kernel.function ("generic_file_splice_write") { - dev = $out->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $out->f_dentry->d_inode->i_sb->s_bdev) - ino = $out->f_dentry->d_inode->i_ino + dev = __file_dev($out) + devname = __find_bdevname(dev, __file_bdev($out)) + ino = __file_ino($out) len = $len flags = $flags @@ -335,9 +402,9 @@ probe generic.fop.splice_write.return = kernel.function ("generic_file_splice_wr probe generic.fop.read = kernel.function ("generic_file_read") { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $filp->f_dentry->d_inode->i_sb->s_bdev) - ino = $filp->f_dentry->d_inode->i_ino + dev = __file_dev($filp) + devname = __find_bdevname(dev, __file_bdev($filp)) + ino = __file_ino($filp) count = $count @@ -360,9 +427,9 @@ probe generic.fop.read.return = kernel.function ("generic_file_read").return probe generic.fop.write = kernel.function ("generic_file_write") { - dev = $file->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $file->f_dentry->d_inode->i_sb->s_bdev) - ino = $file->f_dentry->d_inode->i_ino + dev = __file_dev($file) + devname = __find_bdevname(dev, __file_bdev($file)) + ino = __file_ino($file) count = $count @@ -406,8 +473,8 @@ probe generic.aop.writepages.return = kernel.function ("mpage_writepages").retur probe vfs.do_sync_read = kernel.function ("do_sync_read") { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - ino = $filp->f_dentry->d_inode->i_ino + dev = __file_dev($filp) + ino = __file_ino($filp) len = $len pos = ppos_pos($ppos) @@ -432,9 +499,9 @@ probe vfs.do_sync_read.return = kernel.function ("do_sync_read").return probe vfs.do_sync_write = kernel.function ("do_sync_write") { - dev = $filp->f_dentry->d_inode->i_sb->s_dev - devname = __find_bdevname(dev, $filp->f_dentry->d_inode->i_sb->s_bdev) - ino = $filp->f_dentry->d_inode->i_ino + dev = __file_dev($filp) + devname = __find_bdevname(dev, __file_bdev($filp)) + ino = __file_ino($filp) len = $len pos = ppos_pos($ppos) |