diff options
author | Christian Brauner <brauner@kernel.org> | 2023-02-01 14:14:53 +0100 |
---|---|---|
committer | Christian Brauner (Microsoft) <brauner@kernel.org> | 2023-03-06 09:57:11 +0100 |
commit | 2db8a948046cab3a2f707561592906a3d096972f (patch) | |
tree | 303451077f517d8bdd1aa4a24b6006d6c99a9f86 /include/linux/xattr.h | |
parent | f2620f166e2a4db08f016b7b30b904ab28c265e4 (diff) | |
download | lwn-2db8a948046cab3a2f707561592906a3d096972f.tar.gz lwn-2db8a948046cab3a2f707561592906a3d096972f.zip |
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.h | 16 |
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 { |