Fix compatibility with liburing >= 2.1 where it only has __pad2[2]

non-odp-rdma
Vitaliy Filippov 2022-01-31 22:49:40 +03:00
parent 140309620a
commit d4bc10542c
1 changed files with 6 additions and 9 deletions

View File

@ -17,15 +17,12 @@
static inline void my_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd, const void *addr, unsigned len, off_t offset) static inline void my_uring_prep_rw(int op, struct io_uring_sqe *sqe, int fd, const void *addr, unsigned len, off_t offset)
{ {
sqe->opcode = op; // Prepare a read/write operation without clearing user_data
sqe->flags = 0; // Very recently, 22 Dec 2021, liburing finally got this change too (8ecd3fd959634df81d66af8b3a69c16202a014e8)
sqe->ioprio = 0; // But all versions prior to it (sadly) clear user_data
sqe->fd = fd; __u64 user_data = sqe->user_data;
sqe->off = offset; io_uring_prep_rw(op, sqe, fd, addr, len, offset);
sqe->addr = (unsigned long) addr; sqe->user_data = user_data;
sqe->len = len;
sqe->rw_flags = 0;
sqe->__pad2[0] = sqe->__pad2[1] = sqe->__pad2[2] = 0;
} }
static inline void my_uring_prep_readv(struct io_uring_sqe *sqe, int fd, const struct iovec *iovecs, unsigned nr_vecs, off_t offset) static inline void my_uring_prep_readv(struct io_uring_sqe *sqe, int fd, const struct iovec *iovecs, unsigned nr_vecs, off_t offset)