This will be used in the next commits in order to check common fields of opcode specific struct io_uring_sqe union arms. Signed-off-by: Stefan Metzmacher <metze@xxxxxxxxx> --- io_uring/io_uring.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index f82173bde393..8e1a8800b252 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3916,6 +3916,20 @@ static int __init io_uring_init(void) #define BUILD_BUG_SQE_LEGACY_ALIAS(eoffset, etype, ename, lname) \ __BUILD_BUG_VERIFY_ALIAS(struct io_uring_sqe, eoffset, sizeof(etype), ename, legacy.lname) +#define BUILD_BUG_SQE_HDR_COMMON(subtype, subname) do { \ + BUILD_BUG_ON(sizeof(subtype) != 64); \ + BUILD_BUG_SQE_ELEM(0, subtype, subname); \ + BUILD_BUG_SQE_ELEM(0, struct io_uring_sqe_hdr, subname.hdr); \ + BUILD_BUG_SQE_ALIAS(0, __u8, subname.hdr.opcode, hdr.opcode); \ + BUILD_BUG_SQE_ALIAS(1, __u8, subname.hdr.flags, hdr.flags); \ + BUILD_BUG_SQE_ALIAS(2, __u16, subname.hdr.ioprio, hdr.ioprio); \ + BUILD_BUG_SQE_ALIAS(4, __s32, subname.hdr.fd, hdr.fd); \ + BUILD_BUG_SQE_ELEM(32, struct io_uring_sqe_common, subname.common); \ + BUILD_BUG_SQE_ALIAS(32, __u64, subname.common.user_data, common.user_data); \ + BUILD_BUG_SQE_ALIAS(40, __u16, subname.common.buf_info, common.buf_info); \ + BUILD_BUG_SQE_ALIAS(42, __u16, subname.common.personality, common.personality); \ +} while (0) + BUILD_BUG_ON(sizeof(struct io_uring_sqe_hdr) != 8); BUILD_BUG_SQE_HDR_ELEM(0, __u8, opcode); BUILD_BUG_SQE_HDR_ELEM(1, __u8, flags); -- 2.34.1