[PATCH 2/5] liburing.h: Populate SQE for {s,g} etsockopt

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

 



The current io_uring_prep_cmd_sock() liburing function is not populating
the SQE will all the fields because the kernel implementation was not
ready.

With the integration of the kernel part[1], populate the SQE with the
missing fields (optlen, optval, level and optname). This enables
the usage of this function to prepare commands that executes setsockopt
and getsockopt operations.

[1] Link:  https://lore.kernel.org/all/20231016134750.1381153-1-leitao@xxxxxxxxxx/
Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
 CHANGELOG              |  4 ++++
 src/include/liburing.h | 11 ++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 42a7fc1..61199e2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+liburing-2.5 release
+
+- Add getsockopt and setsockopt socket commands
+
 liburing-2.4 release
 
 - Add io_uring_{major,minor,check}_version() functions.
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 1008544..84400ea 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1129,8 +1129,6 @@ IOURINGINLINE void io_uring_prep_socket_direct_alloc(struct io_uring_sqe *sqe,
 }
 
 
-#define UNUSED(x) (void)(x)
-
 /*
  * Prepare commands for sockets
  */
@@ -1142,13 +1140,12 @@ IOURINGINLINE void io_uring_prep_cmd_sock(struct io_uring_sqe *sqe,
 					  void *optval,
 					  int optlen)
 {
-	/* This will be removed once the get/setsockopt() patches land */
-	UNUSED(optlen);
-	UNUSED(optval);
-	UNUSED(level);
-	UNUSED(optname);
 	io_uring_prep_rw(IORING_OP_URING_CMD, sqe, fd, NULL, 0, 0);
+	sqe->optval = (long long unsigned int)optval;
+	sqe->optname = optname;
+	sqe->optlen = optlen;
 	sqe->cmd_op = cmd_op;
+	sqe->level = level;
 }
 
 /*
-- 
2.34.1




[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