diff options
author | David Smith <dsmith@redhat.com> | 2010-04-06 11:36:29 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2010-04-06 11:36:29 -0500 |
commit | dd3d6ed1d4187da281fac6c344ebe765274325bc (patch) | |
tree | d8e6caecb80c21bc36cfc0b55da3acc652ba0683 | |
parent | 84b869bbf6a14f2640b97e937c11705fa7861076 (diff) | |
download | systemtap-steved-dd3d6ed1d4187da281fac6c344ebe765274325bc.tar.gz systemtap-steved-dd3d6ed1d4187da281fac6c344ebe765274325bc.tar.xz systemtap-steved-dd3d6ed1d4187da281fac6c344ebe765274325bc.zip |
PR 9871 (partial) fix. Removed some embedded-C in scsi.stp.
* tapset/scsi.stp: Added script function timer_pending(). Rewrote
embedded-C function scsi_timer_pending() in script language.
-rw-r--r-- | tapset/scsi.stp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/tapset/scsi.stp b/tapset/scsi.stp index 2d5cda7a..7acc1499 100644 --- a/tapset/scsi.stp +++ b/tapset/scsi.stp @@ -162,20 +162,21 @@ probe scsi.iocompleted goodbytes = $good_bytes } -function scsi_timer_pending:long(var:long) -%{ /* pure */ - struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) - THIS->__retvalue = timer_pending(&cmd->eh_timeout); /* FIXME: deref hazard! */ -#else - struct request *req; - struct request_queue *rq; - req = (struct request *)kread(&cmd->request); - rq = (struct request_queue *)kread(&req->q); - THIS->__retvalue = timer_pending(&rq->timeout); /* FIXME: deref hazard! */ - CATCH_DEREF_FAULT(); -#endif -%} +function timer_pending:long(timer:long) +{ + return (@defined(@cast(timer, "timer_list")->entry->next) + ? (@cast(timer, "timer_list")->entry->next != 0) + : (@cast(timer, "timer_list")->base != 0)) +} + +function scsi_timer_pending:long(cmd:long) +{ +%( kernel_v >= "2.6.28" %? + return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout) +%: + return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->eh_timeout) +%) +} function get_devstate_from_req:long(var:long) { |