summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-01-28 12:53:48 -0700
committerJens Axboe <axboe@kernel.dk>2020-01-28 12:53:48 -0700
commitdd08a9e22393c8ff3b69904ee283f74f7e5c903d (patch)
treef216a7973fea644df81937e5bfed8ccdabe4935f
parent76d3eda2be46b0a6ee41e8cbe0e259a820773f07 (diff)
downloadliburing-dd08a9e22393c8ff3b69904ee283f74f7e5c903d.tar.gz
liburing-dd08a9e22393c8ff3b69904ee283f74f7e5c903d.tar.bz2
Add io_uring_{register,unregister}_personality() helpers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/include/liburing.h2
-rw-r--r--src/include/liburing/io_uring.h2
-rw-r--r--src/liburing.map2
-rw-r--r--src/register.c24
4 files changed, 30 insertions, 0 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h
index b0909b2..83d11dd 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -104,6 +104,8 @@ extern int io_uring_register_eventfd(struct io_uring *ring, int fd);
extern int io_uring_unregister_eventfd(struct io_uring *ring);
extern int io_uring_register_probe(struct io_uring *ring,
struct io_uring_probe *p, unsigned nr);
+extern int io_uring_register_personality(struct io_uring *ring);
+extern int io_uring_unregister_personality(struct io_uring *ring, int id);
/*
* Helper for the peek/wait single cqe functions. Exported because of that,
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index bca5568..79c75a4 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -210,6 +210,8 @@ struct io_uring_params {
#define IORING_REGISTER_FILES_UPDATE 6
#define IORING_REGISTER_EVENTFD_ASYNC 7
#define IORING_REGISTER_PROBE 8
+#define IORING_REGISTER_PERSONALITY 9
+#define IORING_UNREGISTER_PERSONALITY 10
struct io_uring_files_update {
__u32 offset;
diff --git a/src/liburing.map b/src/liburing.map
index 0c17c1f..b45f373 100644
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -70,4 +70,6 @@ LIBURING_0.4 {
global:
io_uring_ring_dontfork;
io_uring_register_probe;
+ io_uring_register_personality;
+ io_uring_unregister_personality;
} LIBURING_0.3;
diff --git a/src/register.c b/src/register.c
index 73daaf8..c179b8a 100644
--- a/src/register.c
+++ b/src/register.c
@@ -110,3 +110,27 @@ int io_uring_register_probe(struct io_uring *ring, struct io_uring_probe *p,
return 0;
}
+
+int io_uring_register_personality(struct io_uring *ring)
+{
+ int ret;
+
+ ret = __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_PERSONALITY,
+ NULL, 0);
+ if (ret < 0)
+ return -errno;
+
+ return ret;
+}
+
+int io_uring_unregister_personality(struct io_uring *ring, int id)
+{
+ int ret;
+
+ ret = __sys_io_uring_register(ring->ring_fd, IORING_UNREGISTER_PERSONALITY,
+ NULL, id);
+ if (ret < 0)
+ return -errno;
+
+ return ret;
+}