summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-01-08 18:52:39 -0700
committerJens Axboe <axboe@kernel.dk>2020-01-08 18:52:39 -0700
commit0ed392ec025a902207f802c6957ec927abbcd36d (patch)
tree3bcd8a4776ba191471c6c041cd3fafee6e9cfaeb
parent46f92335793e70363c296b4c997da7a808959a49 (diff)
downloadliburing-0ed392ec025a902207f802c6957ec927abbcd36d.tar.gz
liburing-0ed392ec025a902207f802c6957ec927abbcd36d.tar.bz2
Add support for IORING_OP_OPENAT2
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rwxr-xr-xconfigure26
-rw-r--r--src/include/liburing.h16
-rw-r--r--src/include/liburing/io_uring.h6
3 files changed, 48 insertions, 0 deletions
diff --git a/configure b/configure
index 7393cb4..54cf5f6 100755
--- a/configure
+++ b/configure
@@ -209,6 +209,29 @@ if compile_prog "" "" "__kernel_timespec"; then
fi
print_config "__kernel_timespec" "$__kernel_timespec"
+##########################################
+# check for open_how
+open_how="no"
+cat > $TMPC << EOF
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+int main(int argc, char **argv)
+{
+ struct open_how how;
+ how.flags = 0;
+ how.mode = 0;
+ how.resolve = 0;
+ return 0;
+}
+EOF
+if compile_prog "" "" "open_how"; then
+ open_how="yes"
+fi
+print_config "open_how" "$open_how"
+
+
#############################################################################
if test "$__kernel_rwf_t" = "yes"; then
@@ -217,5 +240,8 @@ fi
if test "$__kernel_timespec" = "yes"; then
output_sym "CONFIG_HAVE_KERNEL_TIMESPEC"
fi
+if test "$open_how" = "yes"; then
+ output_sym "CONFIG_HAVE_OPEN_HOW"
+fi
echo "CC=$cc" >> $config_host_mak
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 6f76c99..c47c7c6 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -21,6 +21,15 @@ struct __kernel_timespec {
};
#endif
+#ifndef CONFIG_HAVE_OPEN_HOW
+struct open_how {
+ uint64_t flags;
+ uint16_t mode;
+ uint16_t __padding[3];
+ uint64_t resolve;
+};
+#endif
+
/*
* Library interface to io_uring
*/
@@ -355,6 +364,13 @@ static inline void io_uring_prep_madvise(struct io_uring_sqe *sqe, void *addr,
sqe->fadvise_advice = advice;
}
+static inline void io_uring_prep_openat2(struct io_uring_sqe *sqe, int dfd,
+ const char *path, struct open_how *how)
+{
+ io_uring_prep_rw(IORING_OP_OPENAT2, sqe, dfd, path, sizeof(*how),
+ (uint64_t) how);
+}
+
static inline unsigned io_uring_sq_ready(struct io_uring *ring)
{
return ring->sq.sqe_tail - ring->sq.sqe_head;
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index 7cb6fe0..fb53240 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -61,6 +61,7 @@ struct io_uring_sqe {
#define IORING_SETUP_SQPOLL (1U << 1) /* SQ poll thread */
#define IORING_SETUP_SQ_AFF (1U << 2) /* sq_thread_cpu is valid */
#define IORING_SETUP_CQSIZE (1U << 3) /* app defines CQ size */
+#define IORING_SETUP_CLAMP (1U << 4) /* clamp SQ/CQ ring sizes */
enum {
IORING_OP_NOP,
@@ -89,6 +90,10 @@ enum {
IORING_OP_WRITE,
IORING_OP_FADVISE,
IORING_OP_MADVISE,
+ IORING_OP_SEND,
+ IORING_OP_RECV,
+ IORING_OP_EPOLL_CTL,
+ IORING_OP_OPENAT2,
/* this goes last, obviously */
IORING_OP_LAST,
@@ -189,6 +194,7 @@ struct io_uring_params {
#define IORING_REGISTER_EVENTFD 4
#define IORING_UNREGISTER_EVENTFD 5
#define IORING_REGISTER_FILES_UPDATE 6
+#define IORING_REGISTER_EVENTFD_ASYNC 7
struct io_uring_files_update {
__u32 offset;