All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roesch <shr@fb.com>
To: <io-uring@vger.kernel.org>, <kernel-team@fb.com>
Cc: <shr@fb.com>
Subject: [PATCH v1 2/4] liburing: add helper functions for setxattr and fsetxattr
Date: Mon, 29 Nov 2021 14:14:56 -0800	[thread overview]
Message-ID: <20211129221458.2546542-3-shr@fb.com> (raw)
In-Reply-To: <20211129221458.2546542-1-shr@fb.com>

Summary:

This adds the helper functions for:
- fsetxattr
- setxattr

Signed-off-by: Stefan Roesch <shr@fb.com>
---
 src/include/liburing.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 1c978db..38fcc53 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -673,6 +673,29 @@ static inline void io_uring_prep_linkat(struct io_uring_sqe *sqe, int olddfd,
 	sqe->hardlink_flags = (__u32) flags;
 }
 
+static inline void io_uring_prep_setxattr(struct io_uring_sqe *sqe,
+					  const char *name,
+					  const char *value,
+					  const char *path,
+					  int flags,
+					  size_t len)
+{
+	io_uring_prep_rw(IORING_OP_SETXATTR, sqe, 0, name, len, (__u64) value);
+	sqe->addr3 = (__u64) path;
+	sqe->xattr_flags = flags;
+}
+
+static inline void io_uring_prep_fsetxattr(struct io_uring_sqe *sqe,
+					   int         fd,
+					   const char *name,
+					   const char *value,
+					   int         flags,
+					   size_t      len)
+{
+	io_uring_prep_rw(IORING_OP_FSETXATTR, sqe, fd, name, len, (__u64) value);
+	sqe->xattr_flags = flags;
+}
+
 /*
  * Returns number of unconsumed (if SQPOLL) or unsubmitted entries exist in
  * the SQ ring
-- 
2.30.2


  parent reply	other threads:[~2021-11-29 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 22:14 [PATCH v1 0/4] liburing: support xattr functions Stefan Roesch
2021-11-29 22:14 ` [PATCH v1 1/4] liburing: Update io_uring in liburing Stefan Roesch
2021-11-29 22:14 ` Stefan Roesch [this message]
2021-11-29 22:14 ` [PATCH v1 3/4] liburing: Add helper functions for fgetxattr and getxattr Stefan Roesch
2021-11-29 22:14 ` [PATCH v1 4/4] liburing: Add new test program to verify xattr support Stefan Roesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211129221458.2546542-3-shr@fb.com \
    --to=shr@fb.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kernel-team@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.