Thread (4 messages) 4 messages, 2 authors, 2021-08-25
STALE1793d

[PATCH liburing 1/2] liburing.h: add a multipoll helper

From: Pavel Begunkov <asml.silence@gmail.com>
Date: 2021-08-25 12:23:42
Subsystem: the rest · Maintainer: Linus Torvalds

Add a helper for preparing a multipoll request and use it in a test.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 src/include/liburing.h   | 7 +++++++
 test/poll-mshot-update.c | 3 +--
 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/include/liburing.h b/src/include/liburing.h
index f073e25..d20dd25 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -323,6 +323,13 @@ static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,
 	sqe->poll32_events = poll_mask;
 }
 
+static inline void io_uring_prep_poll_multishot(struct io_uring_sqe *sqe,
+						int fd, unsigned poll_mask)
+{
+	io_uring_prep_poll_add(sqe, fd, poll_mask);
+	sqe->len = IORING_POLL_ADD_MULTI;
+}
+
 static inline void io_uring_prep_poll_remove(struct io_uring_sqe *sqe,
 					     void *user_data)
 {
diff --git a/test/poll-mshot-update.c b/test/poll-mshot-update.c
index 6bf4679..75ee52f 100644
--- a/test/poll-mshot-update.c
+++ b/test/poll-mshot-update.c
@@ -70,8 +70,7 @@ static int arm_poll(struct io_uring *ring, int off)
 		return 1;
 	}
 
-	io_uring_prep_poll_add(sqe, p[off].fd[0], POLLIN);
-	sqe->len = IORING_POLL_ADD_MULTI;
+	io_uring_prep_poll_multishot(sqe, p[off].fd[0], POLLIN);
 	sqe->user_data = off;
 	return 0;
 }
-- 
2.32.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help