diff mbox series

[liburing,1/5] liburing: Add helper to prepare IORING_OP_BIND command

Message ID 20240604000417.16137-2-krisman@suse.de (mailing list archive)
State New
Headers show
Series IORING_OP_BIND/LISTEN support | expand

Commit Message

Gabriel Krisman Bertazi June 4, 2024, 12:04 a.m. UTC
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 src/include/liburing.h          | 7 +++++++
 src/include/liburing/io_uring.h | 1 +
 2 files changed, 8 insertions(+)

Comments

Jens Axboe July 21, 2024, 9:18 p.m. UTC | #1
On 6/3/24 6:04 PM, Gabriel Krisman Bertazi wrote:
> Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>

Finally got around to these, as the kernel support has landed...

> diff --git a/src/include/liburing.h b/src/include/liburing.h
> index 0a02364..818e27c 100644
> --- a/src/include/liburing.h
> +++ b/src/include/liburing.h
> @@ -669,6 +669,13 @@ IOURINGINLINE void io_uring_prep_connect(struct io_uring_sqe *sqe, int fd,
>  	io_uring_prep_rw(IORING_OP_CONNECT, sqe, fd, addr, 0, addrlen);
>  }
>  
> +IOURINGINLINE void io_uring_prep_bind(struct io_uring_sqe *sqe, int fd,
> +				      struct sockaddr *addr,
> +				      socklen_t addrlen)
> +{
> +	io_uring_prep_rw(IORING_OP_BIND, sqe, fd, addr, 0, addrlen);
> +}

This needs an ffi and liburing-ffi.map entry as well. Ditto for the next
patch.
diff mbox series

Patch

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 0a02364..818e27c 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -669,6 +669,13 @@  IOURINGINLINE void io_uring_prep_connect(struct io_uring_sqe *sqe, int fd,
 	io_uring_prep_rw(IORING_OP_CONNECT, sqe, fd, addr, 0, addrlen);
 }
 
+IOURINGINLINE void io_uring_prep_bind(struct io_uring_sqe *sqe, int fd,
+				      struct sockaddr *addr,
+				      socklen_t addrlen)
+{
+	io_uring_prep_rw(IORING_OP_BIND, sqe, fd, addr, 0, addrlen);
+}
+
 IOURINGINLINE void io_uring_prep_files_update(struct io_uring_sqe *sqe,
 					      int *fds, unsigned nr_fds,
 					      int offset)
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index 9330733..177ace6 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -257,6 +257,7 @@  enum io_uring_op {
 	IORING_OP_FUTEX_WAITV,
 	IORING_OP_FIXED_FD_INSTALL,
 	IORING_OP_FTRUNCATE,
+	IORING_OP_BIND,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,