1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // iocall.cfa -- |
---|
8 | // |
---|
9 | // Author : Thierry Delisle |
---|
10 | // Created On : Wed Jul 1 14:51:00 2020 |
---|
11 | // Last Modified By : |
---|
12 | // Last Modified On : |
---|
13 | // Update Count : |
---|
14 | // |
---|
15 | |
---|
16 | #include "bits/defs.hfa" |
---|
17 | |
---|
18 | //============================================================================================= |
---|
19 | // I/O uring backend |
---|
20 | //============================================================================================= |
---|
21 | |
---|
22 | #if defined(HAVE_LINUX_IO_URING_H) |
---|
23 | #include <stdint.h> |
---|
24 | #include <linux/io_uring.h> |
---|
25 | |
---|
26 | #include "kernel_private.hfa" |
---|
27 | |
---|
28 | extern [* struct io_uring_sqe, uint32_t] __submit_alloc( struct __io_data & ring, uint64_t data ); |
---|
29 | extern void __submit( struct __io_data & ring, uint32_t idx ); |
---|
30 | |
---|
31 | static inline void ?{}(struct io_uring_sqe & this, uint8_t opcode, int fd) { |
---|
32 | this.opcode = opcode; |
---|
33 | #if !defined(IOSQE_ASYNC) |
---|
34 | this.flags = 0; |
---|
35 | #else |
---|
36 | this.flags = IOSQE_ASYNC; |
---|
37 | #endif |
---|
38 | this.ioprio = 0; |
---|
39 | this.fd = fd; |
---|
40 | this.off = 0; |
---|
41 | this.addr = 0; |
---|
42 | this.len = 0; |
---|
43 | this.rw_flags = 0; |
---|
44 | this.__pad2[0] = this.__pad2[1] = this.__pad2[2] = 0; |
---|
45 | } |
---|
46 | |
---|
47 | static inline void ?{}(struct io_uring_sqe & this, uint8_t opcode, int fd, void * addr, uint32_t len, uint64_t off ) { |
---|
48 | (this){ opcode, fd }; |
---|
49 | this.off = off; |
---|
50 | this.addr = (uint64_t)(uintptr_t)addr; |
---|
51 | this.len = len; |
---|
52 | } |
---|
53 | |
---|
54 | #define __submit_prelude \ |
---|
55 | __io_user_data_t data = { 0, active_thread() }; \ |
---|
56 | struct __io_data & ring = *data.thrd->curr_cluster->io; \ |
---|
57 | struct io_uring_sqe * sqe; \ |
---|
58 | uint32_t idx; \ |
---|
59 | [sqe, idx] = __submit_alloc( ring, (uint64_t)(uintptr_t)&data ); |
---|
60 | |
---|
61 | #define __submit_wait \ |
---|
62 | /*__cfaabi_bits_print_safe( STDERR_FILENO, "Preparing user data %p for %p\n", &data, data.thrd );*/ \ |
---|
63 | verify( sqe->user_data == (uint64_t)(uintptr_t)&data ); \ |
---|
64 | __submit( ring, idx ); \ |
---|
65 | park( __cfaabi_dbg_ctx ); \ |
---|
66 | return data.result; |
---|
67 | #endif |
---|
68 | |
---|
69 | //============================================================================================= |
---|
70 | // I/O Forwards |
---|
71 | //============================================================================================= |
---|
72 | |
---|
73 | // Some forward declarations |
---|
74 | #include <unistd.h> |
---|
75 | |
---|
76 | extern "C" { |
---|
77 | #include <sys/types.h> |
---|
78 | #include <sys/socket.h> |
---|
79 | #include <sys/syscall.h> |
---|
80 | |
---|
81 | #if defined(HAVE_PREADV2) |
---|
82 | struct iovec; |
---|
83 | extern ssize_t preadv2 (int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); |
---|
84 | #endif |
---|
85 | #if defined(HAVE_PWRITEV2) |
---|
86 | struct iovec; |
---|
87 | extern ssize_t pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags); |
---|
88 | #endif |
---|
89 | |
---|
90 | extern int fsync(int fd); |
---|
91 | extern int sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags); |
---|
92 | |
---|
93 | struct msghdr; |
---|
94 | struct sockaddr; |
---|
95 | extern ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags); |
---|
96 | extern ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags); |
---|
97 | extern ssize_t send(int sockfd, const void *buf, size_t len, int flags); |
---|
98 | extern ssize_t recv(int sockfd, void *buf, size_t len, int flags); |
---|
99 | extern int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags); |
---|
100 | extern int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen); |
---|
101 | |
---|
102 | extern int fallocate(int fd, int mode, uint64_t offset, uint64_t len); |
---|
103 | extern int posix_fadvise(int fd, uint64_t offset, uint64_t len, int advice); |
---|
104 | extern int madvise(void *addr, size_t length, int advice); |
---|
105 | |
---|
106 | extern int openat(int dirfd, const char *pathname, int flags, mode_t mode); |
---|
107 | extern int close(int fd); |
---|
108 | |
---|
109 | extern ssize_t read (int fd, void *buf, size_t count); |
---|
110 | |
---|
111 | extern ssize_t splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags); |
---|
112 | extern ssize_t tee(int fd_in, int fd_out, size_t len, unsigned int flags); |
---|
113 | } |
---|
114 | |
---|
115 | //============================================================================================= |
---|
116 | // I/O Interface |
---|
117 | //============================================================================================= |
---|
118 | |
---|
119 | //----------------------------------------------------------------------------- |
---|
120 | // Asynchronous operations |
---|
121 | #if defined(HAVE_PREADV2) |
---|
122 | ssize_t cfa_preadv2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) { |
---|
123 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READV) |
---|
124 | return preadv2(fd, iov, iovcnt, offset, flags); |
---|
125 | #else |
---|
126 | __submit_prelude |
---|
127 | |
---|
128 | (*sqe){ IORING_OP_READV, fd, iov, iovcnt, offset }; |
---|
129 | |
---|
130 | __submit_wait |
---|
131 | #endif |
---|
132 | } |
---|
133 | #endif |
---|
134 | |
---|
135 | #if defined(HAVE_PWRITEV2) |
---|
136 | ssize_t cfa_pwritev2(int fd, const struct iovec *iov, int iovcnt, off_t offset, int flags) { |
---|
137 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_WRITEV) |
---|
138 | return pwritev2(fd, iov, iovcnt, offset, flags); |
---|
139 | #else |
---|
140 | __submit_prelude |
---|
141 | |
---|
142 | (*sqe){ IORING_OP_WRITEV, fd, iov, iovcnt, offset }; |
---|
143 | |
---|
144 | __submit_wait |
---|
145 | #endif |
---|
146 | } |
---|
147 | #endif |
---|
148 | |
---|
149 | int cfa_fsync(int fd) { |
---|
150 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_FSYNC) |
---|
151 | return fsync(fd); |
---|
152 | #else |
---|
153 | __submit_prelude |
---|
154 | |
---|
155 | (*sqe){ IORING_OP_FSYNC, fd }; |
---|
156 | |
---|
157 | __submit_wait |
---|
158 | #endif |
---|
159 | } |
---|
160 | |
---|
161 | int cfa_sync_file_range(int fd, int64_t offset, int64_t nbytes, unsigned int flags) { |
---|
162 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SYNC_FILE_RANGE) |
---|
163 | return sync_file_range(fd, offset, nbytes, flags); |
---|
164 | #else |
---|
165 | __submit_prelude |
---|
166 | |
---|
167 | (*sqe){ IORING_OP_SYNC_FILE_RANGE, fd }; |
---|
168 | sqe->off = offset; |
---|
169 | sqe->len = nbytes; |
---|
170 | sqe->sync_range_flags = flags; |
---|
171 | |
---|
172 | __submit_wait |
---|
173 | #endif |
---|
174 | } |
---|
175 | |
---|
176 | |
---|
177 | ssize_t cfa_sendmsg(int sockfd, const struct msghdr *msg, int flags) { |
---|
178 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SENDMSG) |
---|
179 | return sendmsg(sockfd, msg, flags); |
---|
180 | #else |
---|
181 | __submit_prelude |
---|
182 | |
---|
183 | (*sqe){ IORING_OP_SENDMSG, sockfd, msg, 1, 0 }; |
---|
184 | sqe->msg_flags = flags; |
---|
185 | |
---|
186 | __submit_wait |
---|
187 | #endif |
---|
188 | } |
---|
189 | |
---|
190 | ssize_t cfa_recvmsg(int sockfd, struct msghdr *msg, int flags) { |
---|
191 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_RECVMSG) |
---|
192 | return recvmsg(sockfd, msg, flags); |
---|
193 | #else |
---|
194 | __submit_prelude |
---|
195 | |
---|
196 | (*sqe){ IORING_OP_RECVMSG, sockfd, msg, 1, 0 }; |
---|
197 | sqe->msg_flags = flags; |
---|
198 | |
---|
199 | __submit_wait |
---|
200 | #endif |
---|
201 | } |
---|
202 | |
---|
203 | ssize_t cfa_send(int sockfd, const void *buf, size_t len, int flags) { |
---|
204 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SEND) |
---|
205 | return send( sockfd, buf, len, flags ); |
---|
206 | #else |
---|
207 | __submit_prelude |
---|
208 | |
---|
209 | (*sqe){ IORING_OP_SEND, sockfd }; |
---|
210 | sqe->addr = (uint64_t)buf; |
---|
211 | sqe->len = len; |
---|
212 | sqe->msg_flags = flags; |
---|
213 | |
---|
214 | __submit_wait |
---|
215 | #endif |
---|
216 | } |
---|
217 | |
---|
218 | ssize_t cfa_recv(int sockfd, void *buf, size_t len, int flags) { |
---|
219 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_RECV) |
---|
220 | return recv( sockfd, buf, len, flags ); |
---|
221 | #else |
---|
222 | __submit_prelude |
---|
223 | |
---|
224 | (*sqe){ IORING_OP_RECV, sockfd }; |
---|
225 | sqe->addr = (uint64_t)buf; |
---|
226 | sqe->len = len; |
---|
227 | sqe->msg_flags = flags; |
---|
228 | |
---|
229 | __submit_wait |
---|
230 | #endif |
---|
231 | } |
---|
232 | |
---|
233 | int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) { |
---|
234 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_ACCEPT) |
---|
235 | return accept4( sockfd, addr, addrlen, flags ); |
---|
236 | #else |
---|
237 | __submit_prelude |
---|
238 | |
---|
239 | (*sqe){ IORING_OP_ACCEPT, sockfd }; |
---|
240 | sqe->addr = addr; |
---|
241 | sqe->addr2 = addrlen; |
---|
242 | sqe->accept_flags = flags; |
---|
243 | |
---|
244 | __submit_wait |
---|
245 | #endif |
---|
246 | } |
---|
247 | |
---|
248 | int cfa_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen) { |
---|
249 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_CONNECT) |
---|
250 | return connect( sockfd, addr, addrlen ); |
---|
251 | #else |
---|
252 | __submit_prelude |
---|
253 | |
---|
254 | (*sqe){ IORING_OP_CONNECT, sockfd }; |
---|
255 | sqe->addr = (uint64_t)addr; |
---|
256 | sqe->off = addrlen; |
---|
257 | |
---|
258 | __submit_wait |
---|
259 | #endif |
---|
260 | } |
---|
261 | |
---|
262 | int cfa_fallocate(int fd, int mode, uint64_t offset, uint64_t len) { |
---|
263 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_FALLOCATE) |
---|
264 | return fallocate( fd, mode, offset, len ); |
---|
265 | #else |
---|
266 | __submit_prelude |
---|
267 | |
---|
268 | (*sqe){ IORING_OP_FALLOCATE, fd }; |
---|
269 | sqe->off = offset; |
---|
270 | sqe->len = length; |
---|
271 | sqe->mode = mode; |
---|
272 | |
---|
273 | __submit_wait |
---|
274 | #endif |
---|
275 | } |
---|
276 | |
---|
277 | int cfa_fadvise(int fd, uint64_t offset, uint64_t len, int advice) { |
---|
278 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_FADVISE) |
---|
279 | return posix_fadvise( fd, offset, len, advice ); |
---|
280 | #else |
---|
281 | __submit_prelude |
---|
282 | |
---|
283 | (*sqe){ IORING_OP_FADVISE, fd }; |
---|
284 | sqe->off = (uint64_t)offset; |
---|
285 | sqe->len = length; |
---|
286 | sqe->fadvise_advice = advice; |
---|
287 | |
---|
288 | __submit_wait |
---|
289 | #endif |
---|
290 | } |
---|
291 | |
---|
292 | int cfa_madvise(void *addr, size_t length, int advice) { |
---|
293 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_MADVISE) |
---|
294 | return madvise( addr, length, advice ); |
---|
295 | #else |
---|
296 | __submit_prelude |
---|
297 | |
---|
298 | (*sqe){ IORING_OP_MADVISE, 0 }; |
---|
299 | sqe->addr = (uint64_t)addr; |
---|
300 | sqe->len = length; |
---|
301 | sqe->fadvise_advice = advice; |
---|
302 | |
---|
303 | __submit_wait |
---|
304 | #endif |
---|
305 | } |
---|
306 | |
---|
307 | int cfa_openat(int dirfd, const char *pathname, int flags, mode_t mode) { |
---|
308 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_OPENAT) |
---|
309 | return openat( dirfd, pathname, flags, mode ); |
---|
310 | #else |
---|
311 | __submit_prelude |
---|
312 | |
---|
313 | (*sqe){ IORING_OP_OPENAT, dirfd }; |
---|
314 | sqe->addr = (uint64_t)pathname; |
---|
315 | sqe->open_flags = flags; |
---|
316 | sqe->mode = mode; |
---|
317 | |
---|
318 | __submit_wait |
---|
319 | #endif |
---|
320 | } |
---|
321 | |
---|
322 | int cfa_close(int fd) { |
---|
323 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_CLOSE) |
---|
324 | return close( fd ); |
---|
325 | #else |
---|
326 | __submit_prelude |
---|
327 | |
---|
328 | (*sqe){ IORING_OP_CLOSE, fd }; |
---|
329 | |
---|
330 | __submit_wait |
---|
331 | #endif |
---|
332 | } |
---|
333 | |
---|
334 | ssize_t cfa_read(int fd, void *buf, size_t count) { |
---|
335 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_READ) |
---|
336 | return read( fd, buf, count ); |
---|
337 | #else |
---|
338 | __submit_prelude |
---|
339 | |
---|
340 | (*sqe){ IORING_OP_READ, fd, buf, count, 0 }; |
---|
341 | |
---|
342 | __submit_wait |
---|
343 | #endif |
---|
344 | } |
---|
345 | |
---|
346 | ssize_t cfa_write(int fd, void *buf, size_t count) { |
---|
347 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_WRITE) |
---|
348 | return read( fd, buf, count ); |
---|
349 | #else |
---|
350 | __submit_prelude |
---|
351 | |
---|
352 | (*sqe){ IORING_OP_WRITE, fd, buf, count, 0 }; |
---|
353 | |
---|
354 | __submit_wait |
---|
355 | #endif |
---|
356 | } |
---|
357 | |
---|
358 | ssize_t cfa_splice(int fd_in, loff_t *off_in, int fd_out, loff_t *off_out, size_t len, unsigned int flags) { |
---|
359 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_SPLICE) |
---|
360 | return splice( fd_in, off_in, fd_out, off_out, len, flags ); |
---|
361 | #else |
---|
362 | __submit_prelude |
---|
363 | |
---|
364 | (*sqe){ IORING_OP_SPLICE, fd_out, 0p, len, off_out }; |
---|
365 | sqe->splice_fd_in = fd_in; |
---|
366 | sqe->splice_off_in = off_in; |
---|
367 | sqe->splice_flags = flags; |
---|
368 | |
---|
369 | __submit_wait |
---|
370 | #endif |
---|
371 | } |
---|
372 | |
---|
373 | ssize_t cfa_tee(int fd_in, int fd_out, size_t len, unsigned int flags) { |
---|
374 | #if !defined(HAVE_LINUX_IO_URING_H) || !defined(IORING_OP_TEE) |
---|
375 | return tee( fd_in, fd_out, len, flags ); |
---|
376 | #else |
---|
377 | __submit_prelude |
---|
378 | |
---|
379 | (*sqe){ IORING_OP_TEE, fd_out, 0p, len, 0 }; |
---|
380 | sqe->splice_fd_in = fd_in; |
---|
381 | sqe->splice_flags = flags; |
---|
382 | |
---|
383 | __submit_wait |
---|
384 | #endif |
---|
385 | } |
---|
386 | |
---|
387 | //----------------------------------------------------------------------------- |
---|
388 | // Check if a function is asynchronous |
---|
389 | |
---|
390 | // Macro magic to reduce the size of the following switch case |
---|
391 | #define IS_DEFINED_APPLY(f, ...) f(__VA_ARGS__) |
---|
392 | #define IS_DEFINED_SECOND(first, second, ...) second |
---|
393 | #define IS_DEFINED_TEST(expansion) _CFA_IO_FEATURE_##expansion |
---|
394 | #define IS_DEFINED(macro) IS_DEFINED_APPLY( IS_DEFINED_SECOND,IS_DEFINED_TEST(macro) false, true) |
---|
395 | |
---|
396 | bool has_user_level_blocking( fptr_t func ) { |
---|
397 | #if defined(HAVE_LINUX_IO_URING_H) |
---|
398 | #if defined(HAVE_PREADV2) |
---|
399 | if( /*func == (fptr_t)preadv2 || */ |
---|
400 | func == (fptr_t)cfa_preadv2 ) |
---|
401 | #define _CFA_IO_FEATURE_IORING_OP_READV , |
---|
402 | return IS_DEFINED(IORING_OP_READV); |
---|
403 | #endif |
---|
404 | |
---|
405 | #if defined(HAVE_PWRITEV2) |
---|
406 | if( /*func == (fptr_t)pwritev2 || */ |
---|
407 | func == (fptr_t)cfa_pwritev2 ) |
---|
408 | #define _CFA_IO_FEATURE_IORING_OP_WRITEV , |
---|
409 | return IS_DEFINED(IORING_OP_WRITEV); |
---|
410 | #endif |
---|
411 | |
---|
412 | if( /*func == (fptr_t)fsync || */ |
---|
413 | func == (fptr_t)cfa_fsync ) |
---|
414 | #define _CFA_IO_FEATURE_IORING_OP_FSYNC , |
---|
415 | return IS_DEFINED(IORING_OP_FSYNC); |
---|
416 | |
---|
417 | if( /*func == (fptr_t)ync_file_range || */ |
---|
418 | func == (fptr_t)cfa_sync_file_range ) |
---|
419 | #define _CFA_IO_FEATURE_IORING_OP_SYNC_FILE_RANGE , |
---|
420 | return IS_DEFINED(IORING_OP_SYNC_FILE_RANGE); |
---|
421 | |
---|
422 | if( /*func == (fptr_t)sendmsg || */ |
---|
423 | func == (fptr_t)cfa_sendmsg ) |
---|
424 | #define _CFA_IO_FEATURE_IORING_OP_SENDMSG , |
---|
425 | return IS_DEFINED(IORING_OP_SENDMSG); |
---|
426 | |
---|
427 | if( /*func == (fptr_t)recvmsg || */ |
---|
428 | func == (fptr_t)cfa_recvmsg ) |
---|
429 | #define _CFA_IO_FEATURE_IORING_OP_RECVMSG , |
---|
430 | return IS_DEFINED(IORING_OP_RECVMSG); |
---|
431 | |
---|
432 | if( /*func == (fptr_t)send || */ |
---|
433 | func == (fptr_t)cfa_send ) |
---|
434 | #define _CFA_IO_FEATURE_IORING_OP_SEND , |
---|
435 | return IS_DEFINED(IORING_OP_SEND); |
---|
436 | |
---|
437 | if( /*func == (fptr_t)recv || */ |
---|
438 | func == (fptr_t)cfa_recv ) |
---|
439 | #define _CFA_IO_FEATURE_IORING_OP_RECV , |
---|
440 | return IS_DEFINED(IORING_OP_RECV); |
---|
441 | |
---|
442 | if( /*func == (fptr_t)accept4 || */ |
---|
443 | func == (fptr_t)cfa_accept4 ) |
---|
444 | #define _CFA_IO_FEATURE_IORING_OP_ACCEPT , |
---|
445 | return IS_DEFINED(IORING_OP_ACCEPT); |
---|
446 | |
---|
447 | if( /*func == (fptr_t)connect || */ |
---|
448 | func == (fptr_t)cfa_connect ) |
---|
449 | #define _CFA_IO_FEATURE_IORING_OP_CONNECT , |
---|
450 | return IS_DEFINED(IORING_OP_CONNECT); |
---|
451 | |
---|
452 | if( /*func == (fptr_t)fallocate || */ |
---|
453 | func == (fptr_t)cfa_fallocate ) |
---|
454 | #define _CFA_IO_FEATURE_IORING_OP_FALLOCATE , |
---|
455 | return IS_DEFINED(IORING_OP_FALLOCATE); |
---|
456 | |
---|
457 | if( /*func == (fptr_t)posix_fadvise || */ |
---|
458 | func == (fptr_t)cfa_fadvise ) |
---|
459 | #define _CFA_IO_FEATURE_IORING_OP_FADVISE , |
---|
460 | return IS_DEFINED(IORING_OP_FADVISE); |
---|
461 | |
---|
462 | if( /*func == (fptr_t)madvise || */ |
---|
463 | func == (fptr_t)cfa_madvise ) |
---|
464 | #define _CFA_IO_FEATURE_IORING_OP_MADVISE , |
---|
465 | return IS_DEFINED(IORING_OP_MADVISE); |
---|
466 | |
---|
467 | if( /*func == (fptr_t)openat || */ |
---|
468 | func == (fptr_t)cfa_openat ) |
---|
469 | #define _CFA_IO_FEATURE_IORING_OP_OPENAT , |
---|
470 | return IS_DEFINED(IORING_OP_OPENAT); |
---|
471 | |
---|
472 | if( /*func == (fptr_t)close || */ |
---|
473 | func == (fptr_t)cfa_close ) |
---|
474 | #define _CFA_IO_FEATURE_IORING_OP_CLOSE , |
---|
475 | return IS_DEFINED(IORING_OP_CLOSE); |
---|
476 | |
---|
477 | if( /*func == (fptr_t)read || */ |
---|
478 | func == (fptr_t)cfa_read ) |
---|
479 | #define _CFA_IO_FEATURE_IORING_OP_READ , |
---|
480 | return IS_DEFINED(IORING_OP_READ); |
---|
481 | |
---|
482 | if( /*func == (fptr_t)write || */ |
---|
483 | func == (fptr_t)cfa_write ) |
---|
484 | #define _CFA_IO_FEATURE_IORING_OP_WRITE , |
---|
485 | return IS_DEFINED(IORING_OP_WRITE); |
---|
486 | |
---|
487 | if( /*func == (fptr_t)splice || */ |
---|
488 | func == (fptr_t)cfa_splice ) |
---|
489 | #define _CFA_IO_FEATURE_IORING_OP_SPLICE , |
---|
490 | return IS_DEFINED(IORING_OP_SPLICE); |
---|
491 | |
---|
492 | if( /*func == (fptr_t)tee || */ |
---|
493 | func == (fptr_t)cfa_tee ) |
---|
494 | #define _CFA_IO_FEATURE_IORING_OP_TEE , |
---|
495 | return IS_DEFINED(IORING_OP_TEE); |
---|
496 | #endif |
---|
497 | |
---|
498 | return false; |
---|
499 | } |
---|