summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2010-03-09 15:39:15 -0600
committerDavid Smith <dsmith@redhat.com>2010-03-09 15:39:15 -0600
commit595187eb19a18c6f534d1e44aeb912c01b8dc41b (patch)
tree951fcaa12eafdbddc2c6b4945a980a70cef72d1a
parenta8350a5d1c6e99d6929d1891767c6ddee015137a (diff)
downloadsystemtap-steved-595187eb19a18c6f534d1e44aeb912c01b8dc41b.tar.gz
systemtap-steved-595187eb19a18c6f534d1e44aeb912c01b8dc41b.tar.xz
systemtap-steved-595187eb19a18c6f534d1e44aeb912c01b8dc41b.zip
PR 11338 (partial): Used '@defined()' in task, dentry, and scsi tapsets.
* tapset/task.stp: Used '@defined()' to remove kernel version checks. * tapset/dentry.stp: Ditto. * tapset/scsi.stp: Ditto.
-rw-r--r--tapset/dentry.stp14
-rw-r--r--tapset/scsi.stp11
-rw-r--r--tapset/task.stp8
3 files changed, 13 insertions, 20 deletions
diff --git a/tapset/dentry.stp b/tapset/dentry.stp
index af8a866f..1d045d02 100644
--- a/tapset/dentry.stp
+++ b/tapset/dentry.stp
@@ -86,14 +86,12 @@ function reverse_path_walk:string(dentry:long)
function d_path:string(nd:long)
{
root = __dentry_get_current_root()
- dentry = %( kernel_vr < "2.6.25"
- %? @cast(nd,"nameidata")->dentry
- %: @cast(nd,"nameidata")->path->dentry
- %)
- vfsmnt = %( kernel_vr < "2.6.25"
- %? @cast(nd,"nameidata")->mnt
- %: @cast(nd,"nameidata")->path->mnt
- %)
+ dentry = (@defined(@cast(nd,"nameidata")->path->dentry)
+ ? @cast(nd,"nameidata")->path->dentry
+ : @cast(nd,"nameidata")->dentry)
+ vfsmnt = (@defined(@cast(nd,"nameidata")->path->mnt)
+ ? @cast(nd,"nameidata")->path->mnt
+ : @cast(nd,"nameidata")->mnt)
while (1) {
if (dentry == @cast(root, "path")->dentry &&
vfsmnt == @cast(root, "path")->mnt)
diff --git a/tapset/scsi.stp b/tapset/scsi.stp
index ba2ac771..2d5cda7a 100644
--- a/tapset/scsi.stp
+++ b/tapset/scsi.stp
@@ -96,13 +96,10 @@ probe scsi.iodispatching
device_state_str = describe_device_state(device_state)
data_direction = $cmd->sc_data_direction
data_direction_str = describe_data_direction(data_direction)
-%( kernel_v >= "2.6.25" %?
- request_buffer = $cmd->sdb->table->sgl
- request_bufflen = $cmd->sdb->length
-%:
- request_buffer = $cmd->request_buffer
- request_bufflen = $cmd->request_bufflen
-%)
+ request_buffer = (@defined($cmd->sdb->table->sgl)
+ ? $cmd->sdb->table->sgl : $cmd->request_buffer)
+ request_bufflen = (@defined($cmd->sdb->length)
+ ? $cmd->sdb->length : $cmd->request_bufflen)
req_addr = $cmd->request
}
diff --git a/tapset/task.stp b/tapset/task.stp
index 9cd37026..b8b24d7e 100644
--- a/tapset/task.stp
+++ b/tapset/task.stp
@@ -241,11 +241,9 @@ function task_nice:long (task:long) %{ /* pure */
*/
function task_cpu:long (task:long)
{
-%( kernel_v >= "2.6.22" %?
- ti = @cast(task, "task_struct", "kernel<linux/sched.h>")->stack
-%:
- ti = @cast(task, "task_struct", "kernel<linux/sched.h>")->thread_info
-%)
+ ti = (@defined(@cast(task, "task_struct", "kernel<linux/sched.h>")->stack)
+ ? @defined(@cast(task, "task_struct", "kernel<linux/sched.h>")->stack)
+ : @cast(task, "task_struct", "kernel<linux/sched.h>")->thread_info)
return @cast(ti, "thread_info", "kernel<linux/sched.h>")->cpu
}