[RFC PATCH] io_uring: Handle io_cqring_offsets.flags
Chris Packham
chris.packham at alliedtelesis.co.nz
Fri Jun 12 02:48:41 UTC 2020
The flags field was added in Linux v5.7-rc4-11-g0d9b5b3af134. Which
trips up the static_assert in io_uring.c. Update
struct_io_cqring_offsets with the new fields and adjust io_uring.c
accordingly.
Signed-off-by: Chris Packham <chris.packham at alliedtelesis.co.nz>
---
This is my attempt top fix an issue I reported at https://github.com/strace/strace/issues/138
Obviously this is lacking tests. I had a look at tests/io_uring_setup.c but got
confused by HAVE_STRUCT_IO_URING_PARAMS_FEATURES and what the impications were
for handling old/new kernels so I figured I'd send this as RFC and see what
suggestions people had.
io_uring.c | 25 ++++++++++++-------------
types/io_uring.h | 4 +++-
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/io_uring.c b/io_uring.c
index cd183457..1acf7cfa 100644
--- a/io_uring.c
+++ b/io_uring.c
@@ -19,17 +19,17 @@
#include "xlat/uring_register_opcodes.h"
#ifdef HAVE_STRUCT_IO_CQRING_OFFSETS
-# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV
-static_assert(offsetof(struct_io_cqring_offsets, resv)
- >= offsetof(struct io_cqring_offsets, resv),
- "struct io_cqring_offsets.resv offset mismatch"
+# ifdef HAVE_STRUCT_IO_CQRING_OFFSETS_RESV2
+static_assert(offsetof(struct_io_cqring_offsets, resv2)
+ >= offsetof(struct io_cqring_offsets, resv2),
+ "struct io_cqring_offsets.resv2 offset mismatch"
", please update the decoder");
-static_assert(sizeof_field(struct_io_cqring_offsets, resv)
- <= sizeof_field(struct io_cqring_offsets, resv),
- "struct io_cqring_offsets.resv size mismatch"
+static_assert(sizeof_field(struct_io_cqring_offsets, resv2)
+ <= sizeof_field(struct io_cqring_offsets, resv2),
+ "struct io_cqring_offsets.resv2 size mismatch"
", please update the decoder");
-# else /* !HAVE_STRUCT_IO_CQRING_OFFSETS_RESV */
-static_assert(0, "struct io_cqring_offsets.resv is missing"
+# else /* !HAVE_STRUCT_IO_CQRING_OFFSETS_RESV2 */
+static_assert(0, "struct io_cqring_offsets.resv2 is missing"
", please update the decoder");
# endif
#endif /* HAVE_STRUCT_IO_CQRING_OFFSETS */
@@ -103,10 +103,9 @@ SYS_FUNC(io_uring_setup)
PRINT_FIELD_U(", ", params.cq_off, ring_entries);
PRINT_FIELD_U(", ", params.cq_off, overflow);
PRINT_FIELD_U(", ", params.cq_off, cqes);
- if (!IS_ARRAY_ZERO(params.cq_off.resv)) {
- PRINT_FIELD_ARRAY(", ", params.cq_off, resv, tcp,
- print_xint64_array_member);
- }
+ PRINT_FIELD_U(", ", params.cq_off, flags);
+ PRINT_FIELD_U(", ", params.cq_off, resv1);
+ PRINT_FIELD_U(", ", params.cq_off, resv2);
tprints("}");
}
tprints("}");
diff --git a/types/io_uring.h b/types/io_uring.h
index 76f432c3..09f2fcef 100644
--- a/types/io_uring.h
+++ b/types/io_uring.h
@@ -31,7 +31,9 @@ typedef struct {
uint32_t ring_entries;
uint32_t overflow;
uint32_t cqes;
- uint64_t resv[2];
+ uint32_t flags;
+ uint32_t resv1;
+ uint64_t resv2;
} struct_io_cqring_offsets;
typedef struct {
--
2.27.0
More information about the Strace-devel
mailing list