summaryrefslogtreecommitdiff
path: root/src/register.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-10-08 07:25:55 -0600
committerJens Axboe <axboe@kernel.dk>2019-10-08 07:25:55 -0600
commit13cbe093c04211757e4ad85a1b9ba0291af519a7 (patch)
treee56518b78560231b144a9ae4d8dd078a3cf49a6f /src/register.c
parent1053680d22ae1e047c65b49527e784ba6b4b7171 (diff)
downloadliburing-13cbe093c04211757e4ad85a1b9ba0291af519a7.tar.gz
liburing-13cbe093c04211757e4ad85a1b9ba0291af519a7.tar.bz2
Add io_uring_register_files_update()
Interface to the new file set update functionality. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'src/register.c')
-rw-r--r--src/register.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/register.c b/src/register.c
index f5fc196..858f787 100644
--- a/src/register.c
+++ b/src/register.c
@@ -34,6 +34,30 @@ int io_uring_unregister_buffers(struct io_uring *ring)
return 0;
}
+/*
+ * Register an update for an existing file set. The updates will start at
+ * 'off' in the original array, and 'nr_files' is the number of files we'll
+ * update.
+ *
+ * Returns number of files updated on success, -ERROR on failure.
+ */
+int io_uring_register_files_update(struct io_uring *ring, unsigned off,
+ int *files, unsigned nr_files)
+{
+ struct io_uring_files_update up = {
+ .offset = off,
+ .fds = files,
+ };
+ int ret;
+
+ ret = io_uring_register(ring->ring_fd, IORING_REGISTER_FILES_UPDATE,
+ &up, nr_files);
+ if (ret < 0)
+ return -errno;
+
+ return ret;
+}
+
int io_uring_register_files(struct io_uring *ring, const int *files,
unsigned nr_files)
{