Fixed address prep helpers should include buf_index
io_uring depends on the caller specifying the index into the array
of registered buffers for doing pre-mapped IO. Make this explicit
by requiring the caller to pass in this value for the
io_uring_prep_read_fixed() and io_uring_prep_write_fixed() helpers.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 7d7c9df..7d884c9 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -166,9 +166,10 @@
static inline void io_uring_prep_read_fixed(struct io_uring_sqe *sqe, int fd,
void *buf, unsigned nbytes,
- off_t offset)
+ off_t offset, int buf_index)
{
io_uring_prep_rw(IORING_OP_READ_FIXED, sqe, fd, buf, nbytes, offset);
+ sqe->buf_index = buf_index;
}
static inline void io_uring_prep_writev(struct io_uring_sqe *sqe, int fd,
@@ -180,9 +181,10 @@
static inline void io_uring_prep_write_fixed(struct io_uring_sqe *sqe, int fd,
const void *buf, unsigned nbytes,
- off_t offset)
+ off_t offset, int buf_index)
{
io_uring_prep_rw(IORING_OP_WRITE_FIXED, sqe, fd, buf, nbytes, offset);
+ sqe->buf_index = buf_index;
}
static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,