diff options
Diffstat (limited to 'tapset/ioblock.stp')
-rw-r--r-- | tapset/ioblock.stp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/tapset/ioblock.stp b/tapset/ioblock.stp index 6376ac23..e5ad2c9b 100644 --- a/tapset/ioblock.stp +++ b/tapset/ioblock.stp @@ -1,6 +1,7 @@ // Block I/O tapset // Copyright (C) 2006 Intel Corp. // Copyright (C) 2006 IBM Corp. +// Copyright (C) 2010 Red Hat Inc. // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General @@ -46,19 +47,11 @@ function bio_rw_str(rw) /* returns start sector */ function __bio_start_sect:long(bio:long) -%{ /* pure */ - struct bio *bio; - struct block_device *bi_bdev; - struct hd_struct *bd_part; - bio = (struct bio *)(long)THIS->bio; - bi_bdev = bio? kread(&(bio->bi_bdev)) : NULL; - bd_part = bi_bdev? kread(&(bi_bdev->bd_part)) : NULL; - if (bd_part == NULL) - THIS->__retvalue = -1; - else - THIS->__retvalue = kread(&(bd_part->start_sect)); - CATCH_DEREF_FAULT(); -%} +{ + bi_bdev = bio ? @cast(bio, "bio")->bi_bdev : 0 + bd_part = bi_bdev ? @cast(bi_bdev, "block_device")->bd_part : 0 + return bd_part ? @cast(bd_part, "hd_struct")->start_sect : -1 +} /* returns the block device name */ function __bio_devname:string(bio:long) |