diff mbox series

[liburing,1/2] Add io_uring_prep_msg_ring_fd_alloc() helper

Message ID 9237f9399e4d8fcc9c8c1996905168138f99d2b3.1678968783.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series fd msg-ring slot allocation tests | expand

Commit Message

Pavel Begunkov March 16, 2023, 1:09 p.m. UTC
Add a helper initialising msg-ring requests transferring files and
allocating a target file index.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 src/include/liburing.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Jens Axboe March 16, 2023, 3:01 p.m. UTC | #1
On 3/16/23 7:09 AM, Pavel Begunkov wrote:
> Add a helper initialising msg-ring requests transferring files and
> allocating a target file index.

This needs an ffi map entry too, I added it.
diff mbox series

Patch

diff --git a/src/include/liburing.h b/src/include/liburing.h
index bf48141..0848cf0 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1015,6 +1015,15 @@  IOURINGINLINE void io_uring_prep_msg_ring_fd(struct io_uring_sqe *sqe, int fd,
 	sqe->msg_ring_flags = flags;
 }
 
+IOURINGINLINE void io_uring_prep_msg_ring_fd_alloc(struct io_uring_sqe *sqe,
+						   int fd, int source_fd,
+						   __u64 data, unsigned int flags)
+{
+	io_uring_prep_msg_ring_fd(sqe, fd, source_fd,
+				  IORING_FILE_INDEX_ALLOC - 1,
+				  data, flags);
+}
+
 IOURINGINLINE void io_uring_prep_getxattr(struct io_uring_sqe *sqe,
 					  const char *name, char *value,
 					  const char *path, unsigned int len)