Skip to contentSkip to conversation

add mkdirat support

PATCH Superseded Dmitry Kadashev 1 participant 4 messages Nov 16, 2020 io_uring

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover add mkdirat support

This series adds support for mkdirat opcode along with a testcase for it to liburing. Heavily based on a series that added unlinkat support (commit: 44db0f437a2b ("io_uring.h: add renameat and unlinkat opcodes") and a couple of subsequent ones).

The kernel side of the change:
https://lore.kernel.org/io-uring/[email protected]/T/

Dmitry Kadashev (3):
io_uring.h: add mkdirat opcode
liburing.h: add mkdirat prep helpers
Add mkdirat test case

 .gitignore                      |   1 +
 src/include/liburing.h          |   6 ++
 src/include/liburing/io_uring.h |   1 +
 test/Makefile                   |   2 +
 test/mkdir.c                    | 106 ++++++++++++++++++++++++++++++++
 5 files changed, 116 insertions(+)
 create mode 100644 test/mkdir.c
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/3 io_uring.h: add mkdirat opcode

---
 src/include/liburing/io_uring.h | 1 +
 1 file changed, 1 insertion(+)
src/include/liburing/io_uring.h +1 -0
index e52ad2d..23a699c 100644
@@ -141,6 +141,7 @@ enum {
 	IORING_OP_SHUTDOWN,
 	IORING_OP_RENAMEAT,
 	IORING_OP_UNLINKAT,
+	IORING_OP_MKDIRAT,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,
Signature · 1 line
2.29.2
#2 lore raw

PATCH 2/3 liburing.h: add mkdirat prep helpers

In reply to Dmitry Kadashev
---
 src/include/liburing.h | 6 ++++++
 1 file changed, 6 insertions(+)
src/include/liburing.h +6 -0
index cc32232..f1b16dc 100644
@@ -486,6 +486,12 @@ static inline void io_uring_prep_renameat(struct io_uring_sqe *sqe, int olddfd,
 	sqe->rename_flags = flags;
 }
 
+static inline void io_uring_prep_mkdirat(struct io_uring_sqe *sqe, int dfd,
+					const char *path, mode_t mode)
+{
+	io_uring_prep_rw(IORING_OP_MKDIRAT, sqe, dfd, path, mode, 0);
+}
+
 /*
  * Returns number of unconsumed (if SQPOLL) or unsubmitted entries exist in
  * the SQ ring
Signature · 1 line
2.29.2
#3 lore raw

PATCH 3/3 Add mkdirat test case

In reply to Dmitry Kadashev

The test is relative basic: tests only success, EEXISTS, ENOENT (no parent dir).

---
 .gitignore    |   1 +
 test/Makefile |   2 +
 test/mkdir.c  | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)
 create mode 100644 test/mkdir.c
.gitignore +1 -0
index 53c076f..0a49dad 100644
@@ -68,6 +68,7 @@
 /test/link-timeout
 /test/link_drain
 /test/madvise
+/test/mkdir
 /test/nop
 /test/nop-all-sizes
 /test/open-close
test/Makefile +2 -0
index f457ac7..718bca9 100644
@@ -66,6 +66,7 @@ test_targets += \
 	link-timeout \
 	link_drain \
 	madvise \
+	mkdir \
 	nop \
 	nop-all-sizes \
 	open-close \
@@ -186,6 +187,7 @@ test_srcs := \
 	link.c \
 	link_drain.c \
 	madvise.c \
+	mkdir.c \
 	nop-all-sizes.c \
 	nop.c \
 	open-close.c \
test/mkdir.c new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.29.2