[PATCH liburing] tests/poll: poll update as a part of poll remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix up poll-mshot-update test doing poll updates as we moved poll
updates under IORING_OP_POLL_REMOVE. And add a helper for updates.

Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx>
---
 src/include/liburing.h   | 13 +++++++++++++
 test/poll-mshot-update.c |  7 +++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 5b96e02..5bda635 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -329,6 +329,19 @@ static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
 	io_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, -1, user_data, 0, 0);
 }
 
+static inline void io_uring_prep_poll_update(struct io_uring_sqe *sqe,
+					     void *old_user_data,
+					     void *new_user_data,
+					     unsigned poll_mask, unsigned flags)
+{
+	io_uring_prep_rw(IORING_OP_POLL_REMOVE, sqe, -1, old_user_data, flags,
+			 (__u64)new_user_data);
+#if __BYTE_ORDER == __BIG_ENDIAN
+	poll_mask = __swahw32(poll_mask);
+#endif
+	sqe->poll32_events = poll_mask;
+}
+
 static inline void io_uring_prep_fsync(struct io_uring_sqe *sqe, int fd,
 				       unsigned fsync_flags)
 {
diff --git a/test/poll-mshot-update.c b/test/poll-mshot-update.c
index bfe96c8..1a9ea0a 100644
--- a/test/poll-mshot-update.c
+++ b/test/poll-mshot-update.c
@@ -56,11 +56,10 @@ static int reap_polls(struct io_uring *ring)
 		struct io_uring_sqe *sqe;
 
 		sqe = io_uring_get_sqe(ring);
-		io_uring_prep_poll_add(sqe, p[i].fd[0], POLLIN);
+		/* update event */
+		io_uring_prep_poll_update(sqe, (void *)(unsigned long)i, NULL,
+					  POLLIN, 2);
 		sqe->user_data = 0x12345678;
-		sqe->addr = i;
-		sqe->off = POLLIN;
-		sqe->len = 2;
 	}
 
 	ret = io_uring_submit(ring);
-- 
2.24.0




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux