From 354c797ef6684dc64be916678efa85619571fdbb Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 7 Apr 2010 16:12:10 -0500 Subject: PR 9871 (partial) fix. Removed embedded-C in ioblock.stp and ipmib.stp. * tapset/ioblock.stp(__bio_start_sect): Converted from embedded-C to script language. * tapset/ipmib.stp: Replaced all _tcphdr_get_dport()/_tcphdr_get_sport() calls with _tcp_skb_dport()/_tcp_skb_sport() calls. Removed embedded-C functions _tcphdr_get_dport()/_tcphdr_get_sport(). (ipmib.OutRequests): Fixed for RHEL4. (_trn_unspec): New function. (_input_route_type): Originally called __input_route_type_old()/__input_route_type_new(), which were embedded-C functions. Now just does everything in script language. (__input_route_type_old): Deleted. (__input_route_type_new): Ditto. (_output_route_type): Originally called __output_route_type_old()/__output_route_type_new(), which were embedded-C functions. Now just does everything in script language. (__output_route_type_old): Deleted. (__output_route_type_new): Ditto. --- tapset/ioblock.stp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'tapset/ioblock.stp') 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) -- cgit