Skip to content

Commit 0f21a95

Browse files
krismanaxboe
authored andcommitted
io_uring: Avoid anonymous enums in io_uring uapi
While valid C, anonymous enums confuse Cython (Python to C translator), as reported by Ritesh (YoSTEALTH) [1] . Since people rely on it when building against liburing and we want to keep this header in sync with the library version, let's name the existing enums in the uapi header. [1] cython/cython#3240 Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 22537c9 commit 0f21a95

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

include/uapi/linux/io_uring.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct io_uring_sqe {
115115
*/
116116
#define IORING_FILE_INDEX_ALLOC (~0U)
117117

118-
enum {
118+
enum io_uring_sqe_flags_bit {
119119
IOSQE_FIXED_FILE_BIT,
120120
IOSQE_IO_DRAIN_BIT,
121121
IOSQE_IO_LINK_BIT,
@@ -374,7 +374,7 @@ enum io_uring_op {
374374
/*
375375
* IORING_OP_MSG_RING command types, stored in sqe->addr
376376
*/
377-
enum {
377+
enum io_uring_msg_ring_flags {
378378
IORING_MSG_DATA, /* pass sqe->len as 'res' and off as user_data */
379379
IORING_MSG_SEND_FD, /* send a registered fd to another ring */
380380
};
@@ -425,9 +425,7 @@ struct io_uring_cqe {
425425
#define IORING_CQE_F_SOCK_NONEMPTY (1U << 2)
426426
#define IORING_CQE_F_NOTIF (1U << 3)
427427

428-
enum {
429-
IORING_CQE_BUFFER_SHIFT = 16,
430-
};
428+
#define IORING_CQE_BUFFER_SHIFT 16
431429

432430
/*
433431
* Magic offsets for the application to mmap the data it needs
@@ -526,7 +524,7 @@ struct io_uring_params {
526524
/*
527525
* io_uring_register(2) opcodes and arguments
528526
*/
529-
enum {
527+
enum io_uring_register_op {
530528
IORING_REGISTER_BUFFERS = 0,
531529
IORING_UNREGISTER_BUFFERS = 1,
532530
IORING_REGISTER_FILES = 2,
@@ -583,7 +581,7 @@ enum {
583581
};
584582

585583
/* io-wq worker categories */
586-
enum {
584+
enum io_wq_type {
587585
IO_WQ_BOUND,
588586
IO_WQ_UNBOUND,
589587
};
@@ -688,7 +686,7 @@ struct io_uring_buf_ring {
688686
* IORING_OFF_PBUF_RING | (bgid << IORING_OFF_PBUF_SHIFT)
689687
* to get a virtual mapping for the ring.
690688
*/
691-
enum {
689+
enum io_uring_register_pbuf_ring_flags {
692690
IOU_PBUF_RING_MMAP = 1,
693691
};
694692

@@ -719,7 +717,7 @@ struct io_uring_napi {
719717
/*
720718
* io_uring_restriction->opcode values
721719
*/
722-
enum {
720+
enum io_uring_register_restriction_op {
723721
/* Allow an io_uring_register(2) opcode */
724722
IORING_RESTRICTION_REGISTER_OP = 0,
725723

@@ -775,7 +773,7 @@ struct io_uring_recvmsg_out {
775773
/*
776774
* Argument for IORING_OP_URING_CMD when file is a socket
777775
*/
778-
enum {
776+
enum io_uring_socket_op {
779777
SOCKET_URING_OP_SIOCINQ = 0,
780778
SOCKET_URING_OP_SIOCOUTQ,
781779
SOCKET_URING_OP_GETSOCKOPT,

0 commit comments

Comments
 (0)