[PATCH] kernel: update patch to 2.6.14-rc3
[blktrace.git] / blktrace.h
index 8329d0aa793eae3c2130a92be1366dded9649c6c..799acf869613a1562eb3d75b8a31b0d91627dc82 100644 (file)
@@ -6,8 +6,42 @@
 #include <asm/byteorder.h>
 #include "blktrace_api.h"
 
+#define MINORBITS      20
+#define MINORMASK      ((1U << MINORBITS) - 1)
+#define MAJOR(dev)     ((unsigned int) ((dev) >> MINORBITS))
+#define MINOR(dev)     ((unsigned int) ((dev) & MINORMASK))
+
+#define SECONDS(x)             ((unsigned long long)(x) / 1000000000)
+#define NANO_SECONDS(x)                ((unsigned long long)(x) % 1000000000)
+#define DOUBLE_TO_NANO_ULL(d)  ((unsigned long long)((d) * 1000000000))
+
+#define min(a, b)      ((a) < (b) ? (a) : (b))
+
+typedef __u32 u32;
+typedef __u8 u8;
+
+struct io_stats {
+       unsigned long qreads, qwrites, creads, cwrites, mreads, mwrites;
+       unsigned long ireads, iwrites;
+       unsigned long long qread_kb, qwrite_kb, cread_kb, cwrite_kb;
+       unsigned long long iread_kb, iwrite_kb;
+       unsigned long io_unplugs, timer_unplugs;
+};
+
+struct per_cpu_info {
+       unsigned int cpu;
+       unsigned int nelems;
+
+       int fd;
+       char fname[128];
+
+       struct io_stats io_stats;
+};
+
+extern FILE *ofp;
+
 #define CHECK_MAGIC(t)         (((t)->magic & 0xffffff00) == BLK_IO_TRACE_MAGIC)
-#define SUPPORTED_VERSION      (0x04)
+#define SUPPORTED_VERSION      (0x05)
 
 #if defined(__LITTLE_ENDIAN_BITFIELD)
 #define be16_to_cpu(x)         __bswap_16(x)
@@ -54,6 +88,7 @@ static inline void trace_to_be(struct blk_io_trace *t)
        t->cpu          = cpu_to_be32(t->cpu);
        t->error        = cpu_to_be16(t->error);
        t->pdu_len      = cpu_to_be16(t->pdu_len);
+       t->device       = cpu_to_be32(t->device);
        /* t->comm is a string (endian neutral) */
 }
 
@@ -69,7 +104,13 @@ static inline void trace_to_cpu(struct blk_io_trace *t)
        t->cpu          = be32_to_cpu(t->cpu);
        t->error        = be16_to_cpu(t->error);
        t->pdu_len      = be16_to_cpu(t->pdu_len);
+       t->device       = be32_to_cpu(t->device);
        /* t->comm is a string (endian neutral) */
 }
 
+extern void set_all_format_specs(char *);
+extern int add_format_spec(char *);
+extern void process_fmt(char *, struct per_cpu_info *, struct blk_io_trace *,
+                       unsigned long long, int, unsigned char *);
+
 #endif