io_uring/query: return number of available queries
PATCH 1/1 io_uring/query: return number of available queries
It's useful to know which query opcodes are available. Extend the structure and return that. It's a trivial change, and even though it can be painlessly extended later, it'd still require adding a v2 of the structure.
---
Note: the query interface is extendible, but it's still best to avoid changing structure sizes as it may cause trouble for multi component application using different definitions. So the extensions would look like creating a v2 of the structure and migrating all kernel code to it. Also, tests work just fine even without updating the structure just as intended.
include/uapi/linux/io_uring/query.h | 3 +++ io_uring/query.c | 2 ++ 2 files changed, 5 insertions(+)
include/uapi/linux/io_uring/query.h +3 -0
@@ -36,6 +36,9 @@ struct io_uring_query_opcode {__u64 enter_flags;/* Bitmask of all supported IOSQE_* flags */ __u64 sqe_flags; +/* The number of available query opcodes */ +__u32 nr_query_opcodes; + __u32 __pad; };#endif
io_uring/query.c +2 -0
@@ -20,6 +20,8 @@ static ssize_t io_query_ops(void *data) e->ring_setup_flags =IORING_SETUP_FLAGS ; e->enter_flags =IORING_ENTER_FLAGS ; e->sqe_flags =SQE_VALID_FLAGS ; + e->nr_query_opcodes = __IO_URING_QUERY_MAX; + e->__pad =0 ;return sizeof (*e); }
Signature · 1 line
2.49.0
Quoted 6 lines · Pavel Begunkov
It's useful to know which query opcodes are available. Extend the structure and return that. It's a trivial change, and even though it can be painlessly extended later, it'd still require adding a v2 of the structure.
Applied, thanks!
[1/1] io_uring/query: return number of available queries
commit: 6a77267d97b5b6cd0e35099ab4eb054e5f965ee6
Best regards,
Signature · 1 line
Jens Axboe