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, bpf@vger.kernel.org, axboe@kernel.dk,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: [PATCH v9 07/10] io_uring/mini_liburing: add io_uring_register()
Date: Mon, 23 Feb 2026 14:10:18 +0000	[thread overview]
Message-ID: <a03081e83292f7ce106613be2bcefba385881b4d.1771855761.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1771855760.git.asml.silence@gmail.com>

Add a helper for io_uring registration syscall, which will later be used
for region creation. Keep it generic, it's good enough for now. Later it
can be turned into a separate region API, but I'd rather have liburing
introducing it first and copy from there, than the other way around.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 tools/include/io_uring/mini_liburing.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/include/io_uring/mini_liburing.h b/tools/include/io_uring/mini_liburing.h
index 81513b82433a..ee75cfc24d84 100644
--- a/tools/include/io_uring/mini_liburing.h
+++ b/tools/include/io_uring/mini_liburing.h
@@ -70,6 +70,15 @@ struct io_uring {
 #define write_barrier()	__sync_synchronize()
 #endif
 
+static inline int io_uring_register(unsigned int fd, unsigned int opcode,
+				    const void *arg, unsigned int nr_args)
+{
+	int ret;
+
+	ret = syscall(__NR_io_uring_register, fd, opcode, arg, nr_args);
+	return (ret < 0) ? -errno : ret;
+}
+
 static inline int io_uring_mmap(int fd, struct io_uring_params *p,
 				struct io_uring_sq *sq, struct io_uring_cq *cq)
 {
@@ -280,11 +289,8 @@ static inline int io_uring_register_buffers(struct io_uring *ring,
 					    const struct iovec *iovecs,
 					    unsigned int nr_iovecs)
 {
-	int ret;
-
-	ret = syscall(__NR_io_uring_register, ring->ring_fd,
-		      IORING_REGISTER_BUFFERS, iovecs, nr_iovecs);
-	return (ret < 0) ? -errno : ret;
+	return io_uring_register(ring->ring_fd, IORING_REGISTER_BUFFERS,
+				 iovecs, nr_iovecs);
 }
 
 static inline void io_uring_prep_send(struct io_uring_sqe *sqe, int sockfd,
-- 
2.53.0


  parent reply	other threads:[~2026-02-23 14:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 14:10 [PATCH v9 00/10] BPF controlled io_uring Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 01/10] io_uring: introduce callback driven main loop Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 02/10] io_uring/bpf-ops: implement loop_step with BPF struct_ops Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 03/10] io_uring/bpf-ops: add kfunc helpers Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 04/10] io_uring/bpf-ops: implement bpf ops registration Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 05/10] io_uring: update tools uapi headers Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 06/10] io_uring/mini_liburing: add include guards Pavel Begunkov
2026-02-23 14:10 ` Pavel Begunkov [this message]
2026-02-23 14:10 ` [PATCH v9 08/10] selftests/io_uring: add BPF event loop example Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 09/10] io_uring/selftests: check loop CQ overflow handling Pavel Begunkov
2026-02-23 14:10 ` [PATCH v9 10/10] io_uring/selftests: test BPF [un]registration 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=a03081e83292f7ce106613be2bcefba385881b4d.1771855761.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bpf@vger.kernel.org \
    --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