this repo has no description
1#ifndef __URING_IO_H
2#define __URING_IO_H
3
4#include <stdbool.h>
5#define TASK_COMM_LEN 16
6#define MAX_OP_STR_LEN 127
7
8enum tracepoint_t {
9 IO_URING_CREATE,
10 IO_URING_REGISTER,
11 IO_URING_FILE_GET,
12 IO_URING_SUBMIT_SQE,
13 IO_URING_QUEUE_ASYNC_WORK,
14 IO_URING_POLL_ARM,
15 IO_URING_TASK_ADD,
16 IO_URING_TASK_WORK_RUN,
17 IO_URING_SHORT_WRITE,
18 IO_URING_LOCAL_WORK_RUN,
19 IO_URING_DEFER,
20 IO_URING_LINK,
21 IO_URING_FAIL_LINK,
22 IO_URING_CQRING_WAIT,
23 IO_URING_REQ_FAILED,
24 IO_URING_CQE_OVERFLOW,
25 IO_URING_COMPLETE,
26 KPROBE_IO_INIT_NEW_WORKER,
27 SYS_ENTER_IO_URING_SETUP,
28 SYS_EXIT_IO_URING_SETUP,
29 SYS_ENTER_IO_URING_REGISTER,
30 SYS_EXIT_IO_URING_REGISTER,
31 SYS_ENTER_IO_URING_ENTER,
32 SYS_EXIT_IO_URING_ENTER
33};
34
35struct io_uring_create {
36 int fd;
37 void *ctx;
38 unsigned long sq_entries;
39 unsigned long cq_entries;
40 unsigned long flags;
41};
42
43struct io_uring_register {
44 void *ctx;
45 unsigned opcode;
46 unsigned nr_files;
47 unsigned nr_bufs;
48 long ret;
49};
50
51struct io_uring_file_get {
52 void *ctx;
53 void *req;
54 /* unsigned long long user_data; */
55 int fd;
56};
57
58struct io_uring_submit_sqe {
59 void *ctx;
60 void *req;
61 /* unsigned long long user_data; */
62 unsigned char opcode;
63 unsigned long flags;
64 bool force_nonblock;
65 bool sq_thread;
66 /* unsigned long __data_loc_op_str; */
67 char op_str[MAX_OP_STR_LEN];
68};
69
70struct io_uring_queue_async_work {
71 void *ctx;
72 void *req;
73 /* unsigned long long user_data; */
74 unsigned char opcode;
75 unsigned int flags;
76 void *work;
77 /* int rw; */
78 /* unsigned long __data_loc_op_str; */
79 char op_str[MAX_OP_STR_LEN];
80};
81
82struct io_uring_poll_arm {
83 void *ctx;
84 void *req;
85 /* unsigned long long user_data; */
86 unsigned char opcode;
87 int mask;
88 int events;
89 char op_str[MAX_OP_STR_LEN];
90};
91
92struct io_uring_task_add {
93 void *ctx;
94 void *req;
95 /* unsigned long long user_data; */
96 unsigned char opcode;
97 int mask;
98 char op_str[MAX_OP_STR_LEN];
99};
100
101struct io_uring_task_work_run {
102 void *tctx;
103 unsigned int count;
104 unsigned int loops;
105};
106
107struct io_uring_short_write {
108 void *ctx;
109 unsigned long long fpos;
110 unsigned long long wanted;
111 unsigned long long got;
112};
113
114struct io_uring_local_work_run {
115 void *ctx;
116 int count;
117 unsigned int loops;
118};
119
120struct io_uring_defer {
121 void *ctx;
122 void *req;
123 /* unsigned long long data; */
124 unsigned char opcode;
125 char op_str[MAX_OP_STR_LEN];
126};
127
128struct io_uring_link {
129
130 void *ctx;
131 void *req;
132 void *target_req;
133};
134
135struct io_uring_fail_link {
136 void *ctx;
137 void *req;
138 /* unsigned long long user_data; */
139 unsigned char opcode;
140 void *link;
141 char op_str[MAX_OP_STR_LEN];
142};
143
144struct io_uring_cqring_wait {
145 void *ctx;
146 int min_events;
147};
148
149struct io_uring_req_failed {
150 void *ctx;
151 void *req;
152 /* unsigned long long user_data; */
153 unsigned char opcode;
154 unsigned char flags;
155 unsigned char ioprio;
156 unsigned long long off;
157 unsigned long long addr;
158 unsigned long len;
159 unsigned long op_flags;
160 unsigned int buf_index;
161 unsigned int personality;
162 unsigned long file_index;
163 unsigned long long pad1;
164 unsigned long long addr3;
165 int error;
166 char op_str[MAX_OP_STR_LEN];
167};
168
169struct io_uring_cqe_overflow {
170 void *ctx;
171 unsigned long long user_data;
172 long res;
173 unsigned long cflags;
174 void *ocqe;
175};
176
177struct io_uring_complete {
178 void *ctx;
179 void *req;
180 /* unsigned long long user_data; */
181 int res;
182 unsigned int cflags;
183 /* unsigned long long extra1; */
184 /* unsigned long long extra2; */
185};
186
187struct io_init_new_worker {
188 int io_worker_tid;
189};
190
191/* struct sys_enter_io_uring_enter { */
192/* unsigned int fd; */
193/* unsigned long to_submit; */
194/* unsigned long min_complete; */
195/* unsigned long flags; */
196/* unsigned */
197/* } */
198
199struct event {
200 enum tracepoint_t ty;
201 int pid;
202 int tid;
203 unsigned long long ts;
204 char comm[TASK_COMM_LEN];
205 union {
206 struct io_uring_create io_uring_create;
207 struct io_uring_register io_uring_register;
208 struct io_uring_file_get io_uring_file_get;
209 struct io_uring_submit_sqe io_uring_submit_sqe;
210 struct io_uring_queue_async_work io_uring_queue_async_work;
211 struct io_uring_poll_arm io_uring_poll_arm;
212 struct io_uring_task_add io_uring_task_add;
213 struct io_uring_task_work_run io_uring_task_work_run;
214 struct io_uring_short_write io_uring_short_write;
215 struct io_uring_local_work_run io_uring_local_work_run;
216 struct io_uring_defer io_uring_defer;
217 struct io_uring_link io_uring_link;
218 struct io_uring_fail_link io_uring_fail_link;
219 struct io_uring_cqring_wait io_uring_cqring_wait;
220 struct io_uring_req_failed io_uring_req_failed;
221 struct io_uring_cqe_overflow io_uring_cqe_overflow;
222 struct io_uring_complete io_uring_complete;
223 struct io_init_new_worker io_init_new_worker;
224 };
225};
226
227/* enum io_uring_op { */
228/* IORING_OP_NOP = 0, */
229/* IORING_OP_READV = 1, */
230/* IORING_OP_WRITEV = 2, */
231/* IORING_OP_FSYNC = 3, */
232/* IORING_OP_READ_FIXED = 4, */
233/* IORING_OP_WRITE_FIXED = 5, */
234/* IORING_OP_POLL_ADD = 6, */
235/* IORING_OP_POLL_REMOVE = 7, */
236/* IORING_OP_SYNC_FILE_RANGE = 8, */
237/* IORING_OP_SENDMSG = 9, */
238/* IORING_OP_RECVMSG = 10, */
239/* IORING_OP_TIMEOUT = 11, */
240/* IORING_OP_TIMEOUT_REMOVE = 12, */
241/* IORING_OP_ACCEPT = 13, */
242/* IORING_OP_ASYNC_CANCEL = 14, */
243/* IORING_OP_LINK_TIMEOUT = 15, */
244/* IORING_OP_CONNECT = 16, */
245/* IORING_OP_FALLOCATE = 17, */
246/* IORING_OP_OPENAT = 18, */
247/* IORING_OP_CLOSE = 19, */
248/* IORING_OP_FILES_UPDATE = 20, */
249/* IORING_OP_STATX = 21, */
250/* IORING_OP_READ = 22, */
251/* IORING_OP_WRITE = 23, */
252/* IORING_OP_FADVISE = 24, */
253/* IORING_OP_MADVISE = 25, */
254/* IORING_OP_SEND = 26, */
255/* IORING_OP_RECV = 27, */
256/* IORING_OP_OPENAT2 = 28, */
257/* IORING_OP_EPOLL_CTL = 29, */
258/* IORING_OP_SPLICE = 30, */
259/* IORING_OP_PROVIDE_BUFFERS = 31, */
260/* IORING_OP_REMOVE_BUFFERS = 32, */
261/* IORING_OP_TEE = 33, */
262/* IORING_OP_SHUTDOWN = 34, */
263/* IORING_OP_RENAMEAT = 35, */
264/* IORING_OP_UNLINKAT = 36, */
265/* IORING_OP_MKDIRAT = 37, */
266/* IORING_OP_SYMLINKAT = 38, */
267/* IORING_OP_LINKAT = 39, */
268/* IORING_OP_MSG_RING = 40, */
269/* IORING_OP_FSETXATTR = 41, */
270/* IORING_OP_SETXATTR = 42, */
271/* IORING_OP_FGETXATTR = 43, */
272/* IORING_OP_GETXATTR = 44, */
273/* IORING_OP_SOCKET = 45, */
274/* IORING_OP_URING_CMD = 46, */
275/* IORING_OP_SEND_ZC = 47, */
276/* IORING_OP_SENDMSG_ZC = 48, */
277/* IORING_OP_LAST = 49, */
278/* }; */
279
280#endif