public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH v2] change poll_events to 32 bits to cover EPOLLEXCLUSIVE
@ 2020-06-17 10:13 Jiufei Xue
  2020-06-17 15:23 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jiufei Xue @ 2020-06-17 10:13 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, joseph.qi

Signed-off-by: Jiufei Xue <[email protected]>
---
 man/io_uring_enter.2            | 3 ++-
 src/include/liburing.h          | 8 ++++++--
 src/include/liburing/io_uring.h | 4 +++-
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/man/io_uring_enter.2 b/man/io_uring_enter.2
index 188398b..e327671 100644
--- a/man/io_uring_enter.2
+++ b/man/io_uring_enter.2
@@ -125,7 +125,8 @@ struct io_uring_sqe {
     union {
         __kernel_rwf_t  rw_flags;
         __u32    fsync_flags;
-        __u16    poll_events;
+        __u16    poll_events;   /* compatibility */
+        __u32    poll32_events; /* word-reversed for BE */
         __u32    sync_range_flags;
         __u32    msg_flags;
         __u32    timeout_flags;
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 0192b47..c9034fc 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -14,6 +14,7 @@ extern "C" {
 #include <stdbool.h>
 #include <inttypes.h>
 #include <time.h>
+#include <linux/swab.h>
 #include "liburing/compat.h"
 #include "liburing/io_uring.h"
 #include "liburing/barrier.h"
@@ -253,10 +254,13 @@ static inline void io_uring_prep_sendmsg(struct io_uring_sqe *sqe, int fd,
 }
 
 static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,
-					  short poll_mask)
+					  unsigned poll_mask)
 {
 	io_uring_prep_rw(IORING_OP_POLL_ADD, sqe, fd, NULL, 0, 0);
-	sqe->poll_events = poll_mask;
+#if __BYTE_ORDER == __BIG_ENDIAN
+	poll_mask = __swahw32(poll_mask);
+#endif
+	sqe->poll32_events = poll_mask;
 }
 
 static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index 92c2269..785a6a4 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -31,7 +31,8 @@ struct io_uring_sqe {
 	union {
 		__kernel_rwf_t	rw_flags;
 		__u32		fsync_flags;
-		__u16		poll_events;
+		__u16 		poll_events;	/* compatibility */
+		__u32		poll32_events;	/* word-reversed for BE */
 		__u32		sync_range_flags;
 		__u32		msg_flags;
 		__u32		timeout_flags;
@@ -248,6 +249,7 @@ struct io_uring_params {
 #define IORING_FEAT_RW_CUR_POS		(1U << 3)
 #define IORING_FEAT_CUR_PERSONALITY	(1U << 4)
 #define IORING_FEAT_FAST_POLL		(1U << 5)
+#define IORING_FEAT_POLL_32BITS		(1U << 6)
 
 /*
  * io_uring_register(2) opcodes and arguments
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-17 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17 10:13 [PATCH v2] change poll_events to 32 bits to cover EPOLLEXCLUSIVE Jiufei Xue
2020-06-17 15:23 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox