Skip to contentSkip to conversation

liburing: add fremovexattr and flistxattr support

PATCH New Aditya Prakash Srivastava 1 participant 1 message Jul 21 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 liburing: add fremovexattr and flistxattr support

This adds support for the new IORING_OP_FREMOVEXATTR and IORING_OP_FLISTXATTR opcodes:
- Add opcodes to src/include/liburing/io_uring.h
- Register sanitizers in src/sanitize.c (updating static assert)
- Implement inline prep functions in src/include/liburing.h:
- io_uring_prep_fremovexattr()
- io_uring_prep_flistxattr()
- Add full functional and negative failure tests in test/xattr.c

---
 src/include/liburing.h          |  17 ++++
 src/include/liburing/io_uring.h |   2 +
 src/sanitize.c                  |   4 +-
 test/xattr.c                    | 173 ++++++++++++++++++++++++++++++++
 4 files changed, 195 insertions(+), 1 deletion(-)
src/include/liburing.h +17 -0
index 0188937b..f99f51fe 100644
@@ -1513,6 +1513,23 @@ IOURINGINLINE void io_uring_prep_fsetxattr(struct io_uring_sqe *sqe, int fd,
 	sqe->xattr_flags = flags;
 }
 
+IOURINGINLINE void io_uring_prep_fremovexattr(struct io_uring_sqe *sqe, int fd,
+					      const char *name)
+	LIBURING_NOEXCEPT
+{
+	io_uring_prep_rw(IORING_OP_FREMOVEXATTR, sqe, fd, name, 0, 0);
+	sqe->xattr_flags = 0;
+}
+
+IOURINGINLINE void io_uring_prep_flistxattr(struct io_uring_sqe *sqe, int fd,
+					    char *list, unsigned int len)
+	LIBURING_NOEXCEPT
+{
+	io_uring_prep_rw(IORING_OP_FLISTXATTR, sqe, fd, NULL, len,
+				(__u64) (uintptr_t) list);
+	sqe->xattr_flags = 0;
+}
+
 IOURINGINLINE void io_uring_prep_socket(struct io_uring_sqe *sqe, int domain,
 					int type, int protocol,
 					unsigned int flags)
src/include/liburing/io_uring.h +2 -0
index b9ec1ebf..89480960 100644
@@ -312,6 +312,8 @@ enum io_uring_op {
 	IORING_OP_PIPE,
 	IORING_OP_NOP128,
 	IORING_OP_URING_CMD128,
+	IORING_OP_FREMOVEXATTR,
+	IORING_OP_FLISTXATTR,
 
 	/* this goes last, obviously */
 	IORING_OP_LAST,
src/sanitize.c +3 -1
index 37fb63e6..45f6f60c 100644
@@ -121,8 +121,10 @@ static const sanitize_sqe_handler sanitize_handlers[IORING_OP_LAST] = {
 	[IORING_OP_PIPE] = sanitize_sqe_addr,
 	[IORING_OP_NOP128] = sanitize_sqe_nop,
 	[IORING_OP_URING_CMD128] = sanitize_sqe_optval,
+	[IORING_OP_FREMOVEXATTR] = sanitize_sqe_addr,
+	[IORING_OP_FLISTXATTR] = sanitize_sqe_addr2,
 };
-_Static_assert(IORING_OP_URING_CMD128 + 1 == IORING_OP_LAST,
+_Static_assert(IORING_OP_FLISTXATTR + 1 == IORING_OP_LAST,
 	       "Need an implementation for all IORING_OP_* codes");
 
 void liburing_sanitize_ring(struct io_uring *ring)
test/xattr.c +173 -0

191 lines not on this page · raw message

Signature · 1 line
2.47.3