Signed-off-by: Stefan Metzmacher <metze@xxxxxxxxx> --- io_uring/io_uring.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 60426265ee9f..f82173bde393 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -39,6 +39,7 @@ * Copyright (C) 2018-2019 Jens Axboe * Copyright (c) 2018-2019 Christoph Hellwig */ +#define IO_URING_SQE_HIDE_LEGACY 1 #include <linux/kernel.h> #include <linux/init.h> #include <linux/errno.h> @@ -1837,10 +1838,10 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, u8 opcode; /* req is partially pre-initialised, see io_preinit_req() */ - req->opcode = opcode = READ_ONCE(sqe->opcode); + req->opcode = opcode = READ_ONCE(sqe->hdr.opcode); /* same numerical values with corresponding REQ_F_*, safe to copy */ - req->flags = sqe_flags = READ_ONCE(sqe->flags); - req->cqe.user_data = READ_ONCE(sqe->user_data); + req->flags = sqe_flags = READ_ONCE(sqe->hdr.flags); + req->cqe.user_data = READ_ONCE(sqe->common.user_data); req->file = NULL; req->rsrc_node = NULL; req->task = current; @@ -1857,7 +1858,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, if (sqe_flags & IOSQE_BUFFER_SELECT) { if (!def->buffer_select) return -EOPNOTSUPP; - req->buf_index = READ_ONCE(sqe->buf_group); + req->buf_index = READ_ONCE(sqe->common.buf_info); } if (sqe_flags & IOSQE_CQE_SKIP_SUCCESS) ctx->drain_disabled = true; @@ -1881,7 +1882,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, } } - if (!def->ioprio && sqe->ioprio) + if (!def->ioprio && sqe->hdr.ioprio) return -EINVAL; if (!def->iopoll && (ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; @@ -1889,7 +1890,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, if (def->needs_file) { struct io_submit_state *state = &ctx->submit_state; - req->cqe.fd = READ_ONCE(sqe->fd); + req->cqe.fd = READ_ONCE(sqe->hdr.fd); /* * Plug now if we have more than 2 IO left after this, and the @@ -1902,7 +1903,7 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req, } } - personality = READ_ONCE(sqe->personality); + personality = READ_ONCE(sqe->common.personality); if (personality) { int ret; @@ -3909,11 +3910,11 @@ static int __init io_uring_init(void) __BUILD_BUG_VERIFY_ALIAS(struct io_uring_sqe, eoffset, sizeof(etype), ename, aname) #define BUILD_BUG_SQE_LEGACY(eoffset, etype, lname) \ - __BUILD_BUG_VERIFY_OFFSET_SIZE(struct io_uring_sqe, eoffset, sizeof(etype), lname) + __BUILD_BUG_VERIFY_OFFSET_SIZE(struct io_uring_sqe, eoffset, sizeof(etype), legacy.lname) #define BUILD_BUG_SQE_LEGACY_SIZE(eoffset, esize, lname) \ - __BUILD_BUG_VERIFY_OFFSET_SIZE(struct io_uring_sqe, eoffset, esize, lname) + __BUILD_BUG_VERIFY_OFFSET_SIZE(struct io_uring_sqe, eoffset, esize, legacy.lname) #define BUILD_BUG_SQE_LEGACY_ALIAS(eoffset, etype, ename, lname) \ - __BUILD_BUG_VERIFY_ALIAS(struct io_uring_sqe, eoffset, sizeof(etype), ename, lname) + __BUILD_BUG_VERIFY_ALIAS(struct io_uring_sqe, eoffset, sizeof(etype), ename, legacy.lname) BUILD_BUG_ON(sizeof(struct io_uring_sqe_hdr) != 8); BUILD_BUG_SQE_HDR_ELEM(0, __u8, opcode); -- 2.34.1