Update io_uring.h to match the corresponding kernel changes. Signed-off-by: Josh Triplett --- I've tested this, and it works. The test I'd propose is "open two files, read bytes from both files, test if they have the expected values", to make sure each operation operates on the right file. I've attached a draft of that test that submits the read operations in a separate batch, which passes. src/include/liburing.h | 10 ++++++++++ src/include/liburing/io_uring.h | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/include/liburing.h b/src/include/liburing.h index 0505a4f..0352837 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -412,6 +412,16 @@ static inline void io_uring_prep_openat2(struct io_uring_sqe *sqe, int dfd, (uint64_t) (uintptr_t) how); } +static inline void io_uring_prep_openat2_fixed_file(struct io_uring_sqe *sqe, + int dfd, const char *path, + struct open_how *how, + uint32_t index) +{ + io_uring_prep_rw(IORING_OP_OPENAT2_FIXED_FILE, sqe, dfd, path, + sizeof(*how), (uint64_t) (uintptr_t) how); + sqe->open_fixed_idx = index; +} + struct epoll_event; static inline void io_uring_prep_epoll_ctl(struct io_uring_sqe *sqe, int epfd, int fd, int op, diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index d39b45f..0d2c41b 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h @@ -59,7 +59,10 @@ struct io_uring_sqe { } __attribute__((packed)); /* personality to use, if used */ __u16 personality; - __s32 splice_fd_in; + union { + __s32 splice_fd_in; + __s32 open_fixed_idx; + }; }; __u64 __pad2[3]; }; @@ -135,6 +138,7 @@ enum { IORING_OP_PROVIDE_BUFFERS, IORING_OP_REMOVE_BUFFERS, IORING_OP_TEE, + IORING_OP_OPENAT2_FIXED_FILE, /* this goes last, obviously */ IORING_OP_LAST, -- 2.28.0.rc0