diff mbox series

[v3,liburing,3/7] add io_uring_prep_(recv|recvmsg)_multishot

Message ID 20220630164918.3958710-4-dylany@fb.com (mailing list archive)
State New
Headers show
Series liburing: multishot receive | expand

Commit Message

Dylan Yudaken June 30, 2022, 4:49 p.m. UTC
Add a nice API for multishot recv and recvmsg.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
---
 src/include/liburing.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/src/include/liburing.h b/src/include/liburing.h
index bb2fb87..b11d90e 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -416,6 +416,14 @@  static inline void io_uring_prep_recvmsg(struct io_uring_sqe *sqe, int fd,
 	sqe->msg_flags = flags;
 }
 
+static inline void io_uring_prep_recvmsg_multishot(struct io_uring_sqe *sqe,
+						   int fd, struct msghdr *msg,
+						   unsigned flags)
+{
+	io_uring_prep_recvmsg(sqe, fd, msg, flags);
+	sqe->ioprio |= IORING_RECV_MULTISHOT;
+}
+
 static inline void io_uring_prep_sendmsg(struct io_uring_sqe *sqe, int fd,
 					 const struct msghdr *msg,
 					 unsigned flags)
@@ -674,6 +682,14 @@  static inline void io_uring_prep_recv(struct io_uring_sqe *sqe, int sockfd,
 	sqe->msg_flags = (__u32) flags;
 }
 
+static inline void io_uring_prep_recv_multishot(struct io_uring_sqe *sqe,
+						int sockfd, void *buf,
+						size_t len, int flags)
+{
+	io_uring_prep_recv(sqe, sockfd, buf, len, flags);
+	sqe->ioprio |= IORING_RECV_MULTISHOT;
+}
+
 static inline void io_uring_prep_openat2(struct io_uring_sqe *sqe, int dfd,
 					const char *path, struct open_how *how)
 {