summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/include/liburing.h2
-rw-r--r--src/liburing.map1
-rw-r--r--src/register.c24
3 files changed, 27 insertions, 0 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h
index d4699eb..9ff17db 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -97,6 +97,8 @@ extern int io_uring_unregister_buffers(struct io_uring *ring);
extern int io_uring_register_files(struct io_uring *ring, const int *files,
unsigned nr_files);
extern int io_uring_unregister_files(struct io_uring *ring);
+extern int io_uring_register_files_update(struct io_uring *ring, unsigned off,
+ int *files, unsigned nr_files);
extern int io_uring_register_eventfd(struct io_uring *ring, int fd);
extern int io_uring_unregister_eventfd(struct io_uring *ring);
diff --git a/src/liburing.map b/src/liburing.map
index b944209..2c071d6 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -32,4 +32,5 @@ LIBURING_0.2 {
__io_uring_get_cqe;
io_uring_queue_init_params;
+ io_uring_register_files_update;
} LIBURING_0.1;
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)
{