summaryrefslogtreecommitdiff
path: root/include/linux/xattr.h
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2023-02-01 14:14:53 +0100
committerChristian Brauner (Microsoft) <brauner@kernel.org>2023-03-06 09:57:11 +0100
commit2db8a948046cab3a2f707561592906a3d096972f (patch)
tree303451077f517d8bdd1aa4a24b6006d6c99a9f86 /include/linux/xattr.h
parentf2620f166e2a4db08f016b7b30b904ab28c265e4 (diff)
xattr: add listxattr helper
Add a tiny helper to determine whether an xattr handler given a specific dentry supports listing the requested xattr. We will use this helper in various filesystems in later commits. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Diffstat (limited to 'include/linux/xattr.h')
-rw-r--r--include/linux/xattr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index ce8fb0bd56c6..7adf768d4396 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -47,6 +47,22 @@ struct xattr_handler {
size_t size, int flags);
};
+/**
+ * xattr_handler_can_list - check whether xattr can be listed
+ * @handler: handler for this type of xattr
+ * @dentry: dentry whose inode xattr to list
+ *
+ * Determine whether the xattr associated with @dentry can be listed given
+ * @handler.
+ *
+ * Return: true if xattr can be listed, false if not.
+ */
+static inline bool xattr_handler_can_list(const struct xattr_handler *handler,
+ struct dentry *dentry)
+{
+ return handler && (!handler->list || handler->list(dentry));
+}
+
const char *xattr_full_name(const struct xattr_handler *, const char *);
struct xattr {