From: Stefan Metzmacher <[email protected]>
To: [email protected], [email protected]
Cc: Stefan Metzmacher <[email protected]>
Subject: [RFC PATCH 3/8] io_uring: check legacy layout of struct io_uring_sqe with BUILD_BUG_SQE_LEGACY*
Date: Fri, 12 Aug 2022 10:34:27 +0200 [thread overview]
Message-ID: <f8fbaaff66246111ec0469ecb6da5d833d3af618.1660291547.git.metze@samba.org> (raw)
In-Reply-To: <[email protected]>
This makes the next changes easier.
Signed-off-by: Stefan Metzmacher <[email protected]>
---
io_uring/io_uring.c | 88 +++++++++++++++++++++++----------------------
1 file changed, 46 insertions(+), 42 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 427dde7dfbd1..60426265ee9f 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3908,6 +3908,10 @@ static int __init io_uring_init(void)
#define BUILD_BUG_SQE_ALIAS(eoffset, etype, ename, aname) \
__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)
+#define BUILD_BUG_SQE_LEGACY_SIZE(eoffset, esize, lname) \
+ __BUILD_BUG_VERIFY_OFFSET_SIZE(struct io_uring_sqe, eoffset, esize, lname)
#define BUILD_BUG_SQE_LEGACY_ALIAS(eoffset, etype, ename, lname) \
__BUILD_BUG_VERIFY_ALIAS(struct io_uring_sqe, eoffset, sizeof(etype), ename, lname)
@@ -3941,48 +3945,48 @@ static int __init io_uring_init(void)
BUILD_BUG_SQE_ELEM(48, __u64, u64_ofs48);
BUILD_BUG_SQE_ELEM(56, __u64, u64_ofs56);
/* Legacy layout */
- BUILD_BUG_SQE_ELEM(0, __u8, opcode);
- BUILD_BUG_SQE_ELEM(1, __u8, flags);
- BUILD_BUG_SQE_ELEM(2, __u16, ioprio);
- BUILD_BUG_SQE_ELEM(4, __s32, fd);
- BUILD_BUG_SQE_ELEM(8, __u64, off);
- BUILD_BUG_SQE_ELEM(8, __u64, addr2);
- BUILD_BUG_SQE_ELEM(8, __u32, cmd_op);
- BUILD_BUG_SQE_ELEM(12, __u32, __pad1);
- BUILD_BUG_SQE_ELEM(16, __u64, addr);
- BUILD_BUG_SQE_ELEM(16, __u64, splice_off_in);
- BUILD_BUG_SQE_ELEM(24, __u32, len);
- BUILD_BUG_SQE_ELEM(28, __kernel_rwf_t, rw_flags);
- BUILD_BUG_SQE_ELEM(28, /* compat */ int, rw_flags);
- BUILD_BUG_SQE_ELEM(28, /* compat */ __u32, rw_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, fsync_flags);
- BUILD_BUG_SQE_ELEM(28, /* compat */ __u16, poll_events);
- BUILD_BUG_SQE_ELEM(28, __u32, poll32_events);
- BUILD_BUG_SQE_ELEM(28, __u32, sync_range_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, msg_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, timeout_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, accept_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, cancel_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, open_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, statx_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, fadvise_advice);
- BUILD_BUG_SQE_ELEM(28, __u32, splice_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, rename_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, unlink_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, hardlink_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, xattr_flags);
- BUILD_BUG_SQE_ELEM(28, __u32, msg_ring_flags);
- BUILD_BUG_SQE_ELEM(32, __u64, user_data);
- BUILD_BUG_SQE_ELEM(40, __u16, buf_index);
- BUILD_BUG_SQE_ELEM(40, __u16, buf_group);
- BUILD_BUG_SQE_ELEM(42, __u16, personality);
- BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in);
- BUILD_BUG_SQE_ELEM(44, __u32, file_index);
- BUILD_BUG_SQE_ELEM(44, __u16, notification_idx);
- BUILD_BUG_SQE_ELEM(46, __u16, addr_len);
- BUILD_BUG_SQE_ELEM(48, __u64, addr3);
- BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd);
- BUILD_BUG_SQE_ELEM(56, __u64, __pad2);
+ BUILD_BUG_SQE_LEGACY(0, __u8, opcode);
+ BUILD_BUG_SQE_LEGACY(1, __u8, flags);
+ BUILD_BUG_SQE_LEGACY(2, __u16, ioprio);
+ BUILD_BUG_SQE_LEGACY(4, __s32, fd);
+ BUILD_BUG_SQE_LEGACY(8, __u64, off);
+ BUILD_BUG_SQE_LEGACY(8, __u64, addr2);
+ BUILD_BUG_SQE_LEGACY(8, __u32, cmd_op);
+ BUILD_BUG_SQE_LEGACY(12, __u32, __pad1);
+ BUILD_BUG_SQE_LEGACY(16, __u64, addr);
+ BUILD_BUG_SQE_LEGACY(16, __u64, splice_off_in);
+ BUILD_BUG_SQE_LEGACY(24, __u32, len);
+ BUILD_BUG_SQE_LEGACY(28, __kernel_rwf_t, rw_flags);
+ BUILD_BUG_SQE_LEGACY(28, /* compat */ int, rw_flags);
+ BUILD_BUG_SQE_LEGACY(28, /* compat */ __u32, rw_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, fsync_flags);
+ BUILD_BUG_SQE_LEGACY(28, /* compat */ __u16, poll_events);
+ BUILD_BUG_SQE_LEGACY(28, __u32, poll32_events);
+ BUILD_BUG_SQE_LEGACY(28, __u32, sync_range_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, msg_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, timeout_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, accept_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, cancel_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, open_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, statx_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, fadvise_advice);
+ BUILD_BUG_SQE_LEGACY(28, __u32, splice_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, rename_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, unlink_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, hardlink_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, xattr_flags);
+ BUILD_BUG_SQE_LEGACY(28, __u32, msg_ring_flags);
+ BUILD_BUG_SQE_LEGACY(32, __u64, user_data);
+ BUILD_BUG_SQE_LEGACY(40, __u16, buf_index);
+ BUILD_BUG_SQE_LEGACY(40, __u16, buf_group);
+ BUILD_BUG_SQE_LEGACY(42, __u16, personality);
+ BUILD_BUG_SQE_LEGACY(44, __s32, splice_fd_in);
+ BUILD_BUG_SQE_LEGACY(44, __u32, file_index);
+ BUILD_BUG_SQE_LEGACY(44, __u16, notification_idx);
+ BUILD_BUG_SQE_LEGACY(46, __u16, addr_len);
+ BUILD_BUG_SQE_LEGACY(48, __u64, addr3);
+ BUILD_BUG_SQE_LEGACY_SIZE(48, 0, cmd);
+ BUILD_BUG_SQE_LEGACY(56, __u64, __pad2);
BUILD_BUG_ON(sizeof(struct io_uring_files_update) !=
sizeof(struct io_uring_rsrc_update));
--
2.34.1
next prev parent reply other threads:[~2022-08-12 8:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 8:34 [RFC PATCH 0/8] cleanup struct io_uring_sqe layout Stefan Metzmacher
2022-08-12 8:34 ` [RFC PATCH 1/8] io_uring: move the current struct io_uring_sqe members to legacy sub struct Stefan Metzmacher
2022-08-12 8:34 ` [RFC PATCH 2/8] io_uring: add a generic structure for struct io_uring_sqe Stefan Metzmacher
2022-08-12 8:34 ` Stefan Metzmacher [this message]
2022-08-12 8:34 ` [RFC PATCH 4/8] io_uring: only make use generic struct io_uring_sqe elements for tracing Stefan Metzmacher
2022-08-12 8:34 ` [RFC PATCH 5/8] io_uring: only access generic struct io_uring_sqe elements in io_uring.c Stefan Metzmacher
2022-08-12 8:34 ` [RFC PATCH 6/8] io_uring: add BUILD_BUG_SQE_HDR_COMMON() macro Stefan Metzmacher
2022-08-12 8:34 ` [RFC PATCH 7/8] io_uring: introduce struct io_uring_sqe_rw for all io_prep_rw() using opcodes Stefan Metzmacher
2022-08-12 8:34 ` [RFC PATCH 8/8] io_uring: introduce struct io_uring_sqe_{fsync,sfr,fallocate} Stefan Metzmacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8fbaaff66246111ec0469ecb6da5d833d3af618.1660291547.git.metze@samba.org \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox