public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com
Subject: [PATCH liburing v4 2/3] register: expose a query helper
Date: Tue, 14 Oct 2025 16:02:56 +0100	[thread overview]
Message-ID: <00b81f907a11d467bb51995f0b59fdb1bd85c1d4.1760453798.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1760453798.git.asml.silence@gmail.com>

Expose a simple wrapper around IORING_REGISTER_QUERY to users.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 src/include/liburing.h | 2 ++
 src/liburing-ffi.map   | 3 ++-
 src/liburing.map       | 3 ++-
 src/register.c         | 7 +++++++
 test/ring-query.c      | 7 -------
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 3d4c6422..7eab7e42 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -359,6 +359,8 @@ int io_uring_register_clock(struct io_uring *ring,
 int io_uring_get_events(struct io_uring *ring) LIBURING_NOEXCEPT;
 int io_uring_submit_and_get_events(struct io_uring *ring) LIBURING_NOEXCEPT;
 
+int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg);
+
 /*
  * io_uring syscalls.
  */
diff --git a/src/liburing-ffi.map b/src/liburing-ffi.map
index 4bf4fd51..6eed3f9f 100644
--- a/src/liburing-ffi.map
+++ b/src/liburing-ffi.map
@@ -253,5 +253,6 @@ LIBURING_2.12 {
 } LIBURING_2.11;
 
 LIBURING_2.13 {
-
+	global:
+		io_uring_query;
 } LIBURING_2.12;
diff --git a/src/liburing.map b/src/liburing.map
index 0c4888e1..92c2af7b 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -132,5 +132,6 @@ LIBURING_2.12 {
 } LIBURING_2.11;
 
 LIBURING_2.13 {
-
+	global:
+		io_uring_query;
 } LIBURING_2.12;
diff --git a/src/register.c b/src/register.c
index 93eda3fc..7265dcca 100644
--- a/src/register.c
+++ b/src/register.c
@@ -513,3 +513,10 @@ int io_uring_set_iowait(struct io_uring *ring, bool enable_iowait)
 		ring->int_flags |= INT_FLAG_NO_IOWAIT;
 	return 0;
 }
+
+int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg)
+{
+	int fd = ring ? ring->ring_fd : -1;
+
+	return io_uring_register(fd, IORING_REGISTER_QUERY, arg, 0);
+}
diff --git a/test/ring-query.c b/test/ring-query.c
index d0aa396c..e266b4a9 100644
--- a/test/ring-query.c
+++ b/test/ring-query.c
@@ -27,13 +27,6 @@ struct io_uring_query_opcode_large {
 
 static struct io_uring_query_opcode sys_ops;
 
-static int io_uring_query(struct io_uring *ring, struct io_uring_query_hdr *arg)
-{
-	int fd = ring ? ring->ring_fd : -1;
-
-	return io_uring_register(fd, IORING_REGISTER_QUERY, arg, 0);
-}
-
 static int test_basic_query(void)
 {
 	struct io_uring_query_opcode op = {};
-- 
2.49.0


  parent reply	other threads:[~2025-10-14 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 15:02 [PATCH liburing v4 0/3] some query related updates Pavel Begunkov
2025-10-14 15:02 ` [PATCH liburing v4 1/3] tests/query: get rid of uninit struct warnings Pavel Begunkov
2025-10-14 15:02 ` Pavel Begunkov [this message]
2025-10-14 15:02 ` [PATCH liburing v4 3/3] test/query: signal query loop Pavel Begunkov

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 \
    --in-reply-to=00b81f907a11d467bb51995f0b59fdb1bd85c1d4.1760453798.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /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