Message ID | 218118e4343c04010e9142e14627a7f580f7bca5.1656580293.git.asml.silence@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | ranged file slot alloc | expand |
On 6/30/22 3:13 AM, Pavel Begunkov wrote: > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> > --- > src/include/liburing.h | 3 +++ > src/register.c | 14 ++++++++++++++ > 2 files changed, 17 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); This should go into liburing.map as well.
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/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); +}
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- src/include/liburing.h | 3 +++ src/register.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+)