All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, asml.silence@gmail.com
Subject: [PATCH liburing v2 2/5] alloc range helpers
Date: Thu, 30 Jun 2022 15:10:14 +0100	[thread overview]
Message-ID: <fc7d5dec683c2f989f2bf33906b22d820b4d175e.1656597976.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1656597976.git.asml.silence@gmail.com>

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 src/include/liburing.h |  3 +++
 src/liburing.map       |  1 +
 src/register.c         | 14 ++++++++++++++
 3 files changed, 18 insertions(+)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index bb2fb87..45b4da0 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -186,6 +186,9 @@ int io_uring_unregister_buf_ring(struct io_uring *ring, int bgid);
 int io_uring_register_sync_cancel(struct io_uring *ring,
 				 struct io_uring_sync_cancel_reg *reg);
 
+int io_uring_register_file_alloc_range(struct io_uring *ring,
+					unsigned off, unsigned len);
+
 /*
  * Helper for the peek/wait single cqe functions. Exported because of that,
  * but probably shouldn't be used directly in an application.
diff --git a/src/liburing.map b/src/liburing.map
index a487865..318d3d7 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -59,4 +59,5 @@ LIBURING_2.2 {
 LIBURING_2.3 {
 	global:
 		io_uring_register_sync_cancel;
+		io_uring_register_file_alloc_range;
 } LIBURING_2.2;
diff --git a/src/register.c b/src/register.c
index f2b1026..ee370d6 100644
--- a/src/register.c
+++ b/src/register.c
@@ -352,3 +352,17 @@ int io_uring_register_sync_cancel(struct io_uring *ring,
 	return ____sys_io_uring_register(ring->ring_fd,
 					 IORING_REGISTER_SYNC_CANCEL, reg, 1);
 }
+
+int io_uring_register_file_alloc_range(struct io_uring *ring,
+					unsigned off, unsigned len)
+{
+	struct io_uring_file_index_range range;
+
+	memset(&range, 0, sizeof(range));
+	range.off = off;
+	range.len = len;
+
+	return ____sys_io_uring_register(ring->ring_fd,
+					 IORING_REGISTER_FILE_ALLOC_RANGE,
+					 &range, 0);
+}
-- 
2.36.1


  parent reply	other threads:[~2022-06-30 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 14:10 [PATCH liburing v2 0/5] ranged file slot alloc Pavel Begunkov
2022-06-30 14:10 ` [PATCH liburing v2 1/5] update io_uring.h with file slot alloc ranges Pavel Begunkov
2022-06-30 14:10 ` Pavel Begunkov [this message]
2022-06-30 14:10 ` [PATCH liburing v2 3/5] file-register: fix return codes Pavel Begunkov
2022-06-30 14:10 ` [PATCH liburing v2 4/5] tests: print file-register errors to stderr Pavel Begunkov
2022-06-30 14:10 ` [PATCH liburing v2 5/5] test range file alloc Pavel Begunkov
2022-06-30 14:59 ` [PATCH liburing v2 0/5] ranged file slot alloc Jens Axboe
2022-06-30 16:47 ` 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 \
    --in-reply-to=fc7d5dec683c2f989f2bf33906b22d820b4d175e.1656597976.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.