1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPIBLKTRACE_H
20 #define _UAPIBLKTRACE_H
21 #include <linux/types.h>
22 enum blktrace_cat {
23   BLK_TC_READ = 1 << 0,
24   BLK_TC_WRITE = 1 << 1,
25   BLK_TC_FLUSH = 1 << 2,
26   BLK_TC_SYNC = 1 << 3,
27   BLK_TC_SYNCIO = BLK_TC_SYNC,
28   BLK_TC_QUEUE = 1 << 4,
29   BLK_TC_REQUEUE = 1 << 5,
30   BLK_TC_ISSUE = 1 << 6,
31   BLK_TC_COMPLETE = 1 << 7,
32   BLK_TC_FS = 1 << 8,
33   BLK_TC_PC = 1 << 9,
34   BLK_TC_NOTIFY = 1 << 10,
35   BLK_TC_AHEAD = 1 << 11,
36   BLK_TC_META = 1 << 12,
37   BLK_TC_DISCARD = 1 << 13,
38   BLK_TC_DRV_DATA = 1 << 14,
39   BLK_TC_FUA = 1 << 15,
40   BLK_TC_END = 1 << 15,
41 };
42 #define BLK_TC_SHIFT (16)
43 #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
44 enum blktrace_act {
45   __BLK_TA_QUEUE = 1,
46   __BLK_TA_BACKMERGE,
47   __BLK_TA_FRONTMERGE,
48   __BLK_TA_GETRQ,
49   __BLK_TA_SLEEPRQ,
50   __BLK_TA_REQUEUE,
51   __BLK_TA_ISSUE,
52   __BLK_TA_COMPLETE,
53   __BLK_TA_PLUG,
54   __BLK_TA_UNPLUG_IO,
55   __BLK_TA_UNPLUG_TIMER,
56   __BLK_TA_INSERT,
57   __BLK_TA_SPLIT,
58   __BLK_TA_BOUNCE,
59   __BLK_TA_REMAP,
60   __BLK_TA_ABORT,
61   __BLK_TA_DRV_DATA,
62   __BLK_TA_CGROUP = 1 << 8,
63 };
64 enum blktrace_notify {
65   __BLK_TN_PROCESS = 0,
66   __BLK_TN_TIMESTAMP,
67   __BLK_TN_MESSAGE,
68   __BLK_TN_CGROUP = __BLK_TA_CGROUP,
69 };
70 #define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
71 #define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
72 #define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
73 #define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
74 #define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
75 #define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
76 #define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
77 #define BLK_TA_COMPLETE (__BLK_TA_COMPLETE | BLK_TC_ACT(BLK_TC_COMPLETE))
78 #define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
79 #define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
80 #define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
81 #define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
82 #define BLK_TA_SPLIT (__BLK_TA_SPLIT)
83 #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
84 #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
85 #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
86 #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
87 #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
88 #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
89 #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
90 #define BLK_IO_TRACE_MAGIC 0x65617400
91 #define BLK_IO_TRACE_VERSION 0x07
92 struct blk_io_trace {
93   __u32 magic;
94   __u32 sequence;
95   __u64 time;
96   __u64 sector;
97   __u32 bytes;
98   __u32 action;
99   __u32 pid;
100   __u32 device;
101   __u32 cpu;
102   __u16 error;
103   __u16 pdu_len;
104 };
105 struct blk_io_trace_remap {
106   __be32 device_from;
107   __be32 device_to;
108   __be64 sector_from;
109 };
110 enum {
111   Blktrace_setup = 1,
112   Blktrace_running,
113   Blktrace_stopped,
114 };
115 #define BLKTRACE_BDEV_SIZE 32
116 struct blk_user_trace_setup {
117   char name[BLKTRACE_BDEV_SIZE];
118   __u16 act_mask;
119   __u32 buf_size;
120   __u32 buf_nr;
121   __u64 start_lba;
122   __u64 end_lba;
123   __u32 pid;
124 };
125 #endif
126