forked from shuveb/loti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delme.c
226 lines (212 loc) · 8.25 KB
/
delme.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/* Supported Ops */
/*****************/
/* DONE */
io_uring_get_probe_ring(struct io_uring *ring);
/* DONE */
io_uring_get_probe(void);
/* DONE */
io_uring_opcode_supported(struct io_uring_probe *p, int op)
/* Setup & tear down */
/*********************/
/* DONE */
extern int io_uring_queue_init(unsigned entries, struct io_uring *ring,
unsigned flags);
/* DONE */
extern int io_uring_queue_init_params(unsigned entries, struct io_uring *ring,
struct io_uring_params *p);
/* DONE */
extern int io_uring_queue_mmap(int fd, struct io_uring_params *p,
struct io_uring *ring);
/* DONE */
extern int io_uring_ring_dontfork(struct io_uring *ring);
/* DONE */
extern void io_uring_queue_exit(struct io_uring *ring);
/*Completion-related*/
/********************/
/* DONE */
static inline void *io_uring_cqe_get_data(const struct io_uring_cqe *cqe)
/* DONE */
unsigned io_uring_peek_batch_cqe(struct io_uring *ring, struct io_uring_cqe **cqes, unsigned count);
/* DONE */
extern int io_uring_wait_cqes(struct io_uring *ring, struct io_uring_cqe **cqe_ptr, unsigned wait_nr, struct __kernel_timespec *ts, sigset_t *sigmask);
/* DONE */
extern int io_uring_wait_cqe_timeout(struct io_uring *ring, struct io_uring_cqe **cqe_ptr, struct __kernel_timespec *ts);
/*
* Return an IO completion, waiting for 'wait_nr' completions if one isn't
* readily available. Returns 0 with cqe_ptr filled in on success, -errno on
* failure.
*/
/* DONE */
static inline int io_uring_wait_cqe_nr(struct io_uring *ring, struct io_uring_cqe **cqe_ptr, unsigned wait_nr)
/*
* Return an IO completion, if one is readily available. Returns 0 with
* cqe_ptr filled in on success, -errno on failure.
*/
/* DONE */
static inline int io_uring_peek_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr)
/*
* Return an IO completion, waiting for it if necessary. Returns 0 with
* cqe_ptr filled in on success, -errno on failure.
*/
/* DONE */
static inline int io_uring_wait_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr)
/* Completion-related helpers */
/******************************/
io_uring_for_each_cqe(ring, head, cqe)
/* DONE */
static inline void io_uring_cq_advance(struct io_uring *ring, unsigned nr)
/*
* Must be called after io_uring_{peek,wait}_cqe() after the cqe has
* been processed by the application.
*/
/* DONE */
static inline void io_uring_cqe_seen(struct io_uring *ring, struct io_uring_cqe *cqe)
static inline unsigned io_uring_cq_ready(struct io_uring *ring)
/* Submission-related */
/**********************/
/* DONE */
extern int io_uring_submit(struct io_uring *ring);
/* DONE */
extern int io_uring_submit_and_wait(struct io_uring *ring, unsigned wait_nr);
/* DONE */
extern struct io_uring_sqe *io_uring_get_sqe(struct io_uring *ring);
/* DONE */
static inline void io_uring_sqe_set_data(struct io_uring_sqe *sqe, void *data)
/* DONE */
static inline void io_uring_sqe_set_flags(struct io_uring_sqe *sqe,
unsigned flags)
/*
* submission helpers
*/
/* DONE */
static inline void io_uring_prep_splice(struct io_uring_sqe *sqe,
int fd_in, loff_t off_in,
int fd_out, loff_t off_out,
unsigned int nbytes,
unsigned int splice_flags)
/* DONE */
static inline void io_uring_prep_readv(struct io_uring_sqe *sqe, int fd,
const struct iovec *iovecs,
unsigned nr_vecs, off_t offset)
/* DONE */
static inline void io_uring_prep_read_fixed(struct io_uring_sqe *sqe, int fd,
void *buf, unsigned nbytes,
off_t offset, int buf_index)
/* DONE */
static inline void io_uring_prep_writev(struct io_uring_sqe *sqe, int fd,
const struct iovec *iovecs,
unsigned nr_vecs, off_t offset)
/* DONE */
static inline void io_uring_prep_write_fixed(struct io_uring_sqe *sqe, int fd,
const void *buf, unsigned nbytes,
off_t offset, int buf_index)
/* DONE */
static inline void io_uring_prep_recvmsg(struct io_uring_sqe *sqe, int fd,
struct msghdr *msg, unsigned flags)
/* DONE */
static inline void io_uring_prep_sendmsg(struct io_uring_sqe *sqe, int fd,
const struct msghdr *msg, unsigned flags)
/* DONE */
static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,
short poll_mask)
/* DONE */
static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
void *user_data)
/* DONE */
static inline void io_uring_prep_fsync(struct io_uring_sqe *sqe, int fd,
unsigned fsync_flags)
/* DONE */
static inline void io_uring_prep_nop(struct io_uring_sqe *sqe)
/* DONE */
static inline void io_uring_prep_accept(struct io_uring_sqe *sqe, int fd,
struct sockaddr *addr,
socklen_t *addrlen, int flags)
/* DONE */
static inline void io_uring_prep_connect(struct io_uring_sqe *sqe, int fd,
struct sockaddr *addr,
socklen_t addrlen)
/* DONE */
static inline void io_uring_prep_fallocate(struct io_uring_sqe *sqe, int fd,
int mode, off_t offset, off_t len)
/* DONE */
static inline void io_uring_prep_openat(struct io_uring_sqe *sqe, int dfd,
const char *path, int flags, mode_t mode)
/* DONE */
static inline void io_uring_prep_close(struct io_uring_sqe *sqe, int fd)
/* DONE */
static inline void io_uring_prep_read(struct io_uring_sqe *sqe, int fd,
void *buf, unsigned nbytes, off_t offset)
/* DONE */
static inline void io_uring_prep_write(struct io_uring_sqe *sqe, int fd,
const void *buf, unsigned nbytes, off_t offset)
/* DONE */
static inline void io_uring_prep_statx(struct io_uring_sqe *sqe, int dfd,
const char *path, int flags, unsigned mask,
struct statx *statxbuf)
/* DONE */
static inline void io_uring_prep_fadvise(struct io_uring_sqe *sqe, int fd,
off_t offset, off_t len, int advice)
/* DONE */
static inline void io_uring_prep_madvise(struct io_uring_sqe *sqe, void *addr,
off_t length, int advice)
/* DONE */
static inline void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd,
const void *buf, size_t len, int flags)
/* DONE */
static inline void io_uring_prep_recv(struct io_uring_sqe *sqe, int sockfd,
void *buf, size_t len, int flags)
/* DONE */
static inline void io_uring_prep_openat2(struct io_uring_sqe *sqe, int dfd,
const char *path, struct open_how *how)
/* DONE */
static inline void io_uring_prep_epoll_ctl(struct io_uring_sqe *sqe, int epfd,
int fd, int op,
struct epoll_event *ev)
/* Advanced use */
/* DONE */
extern int io_uring_register_buffers(struct io_uring *ring,
const struct iovec *iovecs,
unsigned nr_iovecs);
/* DONE */
extern int io_uring_unregister_buffers(struct io_uring *ring);
/* DONE */
extern int io_uring_register_files(struct io_uring *ring, const int *files,
unsigned nr_files);
/* DONE */
extern int io_uring_unregister_files(struct io_uring *ring);
/* DONE */
extern int io_uring_register_files_update(struct io_uring *ring, unsigned off,
int *files, unsigned nr_files);
/* DONE */
extern int io_uring_register_eventfd(struct io_uring *ring, int fd);
/* DONE */
extern int io_uring_register_eventfd_async(struct io_uring *ring, int fd);
/* DONE */
extern int io_uring_unregister_eventfd(struct io_uring *ring);
/* DONE */
extern int io_uring_register_probe(struct io_uring *ring,
struct io_uring_probe *p, unsigned nr);
/* DONE */
extern int io_uring_register_personality(struct io_uring *ring);
/* DONE */
extern int io_uring_unregister_personality(struct io_uring *ring, int id);
static inline void io_uring_prep_files_update(struct io_uring_sqe *sqe,
int *fds, unsigned nr_fds,
int offset)
static inline void io_uring_prep_provide_buffers(struct io_uring_sqe *sqe,
void *addr, int len, int nr,
int bgid, int bid)
static inline void io_uring_prep_remove_buffers(struct io_uring_sqe *sqe,
int nr, int bgid)
static inline unsigned io_uring_sq_ready(struct io_uring *ring)
static inline unsigned io_uring_sq_space_left(struct io_uring *ring)
static inline void io_uring_prep_timeout(struct io_uring_sqe *sqe,
struct __kernel_timespec *ts,
unsigned count, unsigned flags)
static inline void io_uring_prep_timeout_remove(struct io_uring_sqe *sqe,
__u64 user_data, unsigned flags)
static inline void io_uring_prep_cancel(struct io_uring_sqe *sqe, void *user_data,
int flags)
static inline void io_uring_prep_link_timeout(struct io_uring_sqe *sqe,
struct __kernel_timespec *ts,
unsigned flags)