1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _UAPIBLKTRACE_H
8 #define _UAPIBLKTRACE_H
9 #include <linux/types.h>
10 enum blktrace_cat {
11   BLK_TC_READ = 1 << 0,
12   BLK_TC_WRITE = 1 << 1,
13   BLK_TC_FLUSH = 1 << 2,
14   BLK_TC_SYNC = 1 << 3,
15   BLK_TC_SYNCIO = BLK_TC_SYNC,
16   BLK_TC_QUEUE = 1 << 4,
17   BLK_TC_REQUEUE = 1 << 5,
18   BLK_TC_ISSUE = 1 << 6,
19   BLK_TC_COMPLETE = 1 << 7,
20   BLK_TC_FS = 1 << 8,
21   BLK_TC_PC = 1 << 9,
22   BLK_TC_NOTIFY = 1 << 10,
23   BLK_TC_AHEAD = 1 << 11,
24   BLK_TC_META = 1 << 12,
25   BLK_TC_DISCARD = 1 << 13,
26   BLK_TC_DRV_DATA = 1 << 14,
27   BLK_TC_FUA = 1 << 15,
28   BLK_TC_END = 1 << 15,
29 };
30 #define BLK_TC_SHIFT (16)
31 #define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
32 enum blktrace_act {
33   __BLK_TA_QUEUE = 1,
34   __BLK_TA_BACKMERGE,
35   __BLK_TA_FRONTMERGE,
36   __BLK_TA_GETRQ,
37   __BLK_TA_SLEEPRQ,
38   __BLK_TA_REQUEUE,
39   __BLK_TA_ISSUE,
40   __BLK_TA_COMPLETE,
41   __BLK_TA_PLUG,
42   __BLK_TA_UNPLUG_IO,
43   __BLK_TA_UNPLUG_TIMER,
44   __BLK_TA_INSERT,
45   __BLK_TA_SPLIT,
46   __BLK_TA_BOUNCE,
47   __BLK_TA_REMAP,
48   __BLK_TA_ABORT,
49   __BLK_TA_DRV_DATA,
50   __BLK_TA_CGROUP = 1 << 8,
51 };
52 enum blktrace_notify {
53   __BLK_TN_PROCESS = 0,
54   __BLK_TN_TIMESTAMP,
55   __BLK_TN_MESSAGE,
56   __BLK_TN_CGROUP = __BLK_TA_CGROUP,
57 };
58 #define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
59 #define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
60 #define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
61 #define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
62 #define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
63 #define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
64 #define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
65 #define BLK_TA_COMPLETE (__BLK_TA_COMPLETE | BLK_TC_ACT(BLK_TC_COMPLETE))
66 #define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
67 #define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
68 #define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
69 #define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
70 #define BLK_TA_SPLIT (__BLK_TA_SPLIT)
71 #define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
72 #define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
73 #define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
74 #define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
75 #define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
76 #define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
77 #define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
78 #define BLK_IO_TRACE_MAGIC 0x65617400
79 #define BLK_IO_TRACE_VERSION 0x07
80 struct blk_io_trace {
81   __u32 magic;
82   __u32 sequence;
83   __u64 time;
84   __u64 sector;
85   __u32 bytes;
86   __u32 action;
87   __u32 pid;
88   __u32 device;
89   __u32 cpu;
90   __u16 error;
91   __u16 pdu_len;
92 };
93 struct blk_io_trace_remap {
94   __be32 device_from;
95   __be32 device_to;
96   __be64 sector_from;
97 };
98 enum {
99   Blktrace_setup = 1,
100   Blktrace_running,
101   Blktrace_stopped,
102 };
103 #define BLKTRACE_BDEV_SIZE 32
104 struct blk_user_trace_setup {
105   char name[BLKTRACE_BDEV_SIZE];
106   __u16 act_mask;
107   __u32 buf_size;
108   __u32 buf_nr;
109   __u64 start_lba;
110   __u64 end_lba;
111   __u32 pid;
112 };
113 #endif
114