2 * Blktrace record utility - Convert binary trace data into bunches of IOs
4 * Copyright (C) 2007 Alan D. Brunelle <Alan.Brunelle@hp.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #if !defined(__BTRECORD_H__)
22 #define __BTRECORD_H__
24 #include <asm/types.h>
26 #define BT_MAX_PKTS 512
29 * Header for each bunch
31 * @nkts: Number of IO packets to process
32 * @time_stamp: Time stamp for this bunch of IOs
42 * @sector: Sector number of IO
43 * @nbytes: Number of bytes to process
44 * @rw: IO direction: 0 = write, 1 = read
53 * Shorthand notion of a bunch of IOs
55 * @hdr: Header describing stall and how many IO packets follow
56 * @pkts: Individual IOs are described here
59 struct io_bunch_hdr hdr;
60 struct io_pkt pkts[BT_MAX_PKTS];
64 * Header for each recorded file
66 * @version: Version information
67 * @genesis: Time stamp for earliest bunch
68 * @nbunches: Number of bunches put into the file
69 * @total_pkts: Number of packets to be processed
78 static inline __u64 mk_btversion(int mjr, int mnr, int sub)
80 return ((mjr & 0xff) << 16) | ((mnr & 0xff) << 8) | (sub & 0xff);
83 static inline void get_btversion(__u64 version, int *mjr, int *mnr, int *sub)
85 *mjr = (int)((version >> 16) & 0xff);
86 *mnr = (int)((version >> 8) & 0xff);
87 *sub = (int)((version >> 0) & 0xff);
90 static char my_btversion[] = "0.9.3";
91 static int btver_mjr = 0;
92 static int btver_mnr = 9;
93 static int btver_sub = 3;