public inbox for [email protected]
 help / color / mirror / Atom feed
From: Breno Leitao <[email protected]>
To: [email protected], [email protected]
Cc: [email protected]
Subject: [PATCH 2/5] liburing.h: Populate SQE for {s,g} etsockopt
Date: Fri, 20 Oct 2023 06:39:14 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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/[email protected]/
Signed-off-by: Breno Leitao <[email protected]>
---
 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


  parent reply	other threads:[~2023-10-20 13:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 13:39 [PATCH 0/5] liburing: Add {g,s}etsockopt command support Breno Leitao
2023-10-20 13:39 ` [PATCH 1/5] io_uring: uapi: Sync the {g,s}etsockopt fields Breno Leitao
2023-10-20 13:39 ` Breno Leitao [this message]
2023-10-20 13:39 ` [PATCH 3/5] tests/socket-getsetsock-cmd: New test for {g,s}etsockopt Breno Leitao
2023-10-20 13:39 ` [PATCH 4/5] man/io_uring_prep_cmd: Fix argument name Breno Leitao
2023-10-20 13:39 ` [PATCH 5/5] man/io_uring_prep_cmd: Add the new sockopt commands Breno Leitao
2023-10-20 15:06 ` [PATCH 0/5] liburing: Add {g,s}etsockopt command support Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox