[PATCH v2 08/25] xattr: add is_fscaps_xattr() helper

Seth Forshee (DigitalOcean) posted 25 patches 1 year, 10 months ago
[PATCH v2 08/25] xattr: add is_fscaps_xattr() helper
Posted by Seth Forshee (DigitalOcean) 1 year, 10 months ago
Add a helper to determine if an xattr time is XATTR_NAME_CAPS instead of
open-coding a string comparision.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
---
 include/linux/xattr.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index d20051865800..cbacfb4d74fa 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -28,6 +28,11 @@ static inline bool is_posix_acl_xattr(const char *name)
 	       (strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT) == 0);
 }
 
+static inline bool is_fscaps_xattr(const char *name)
+{
+	return strcmp(name, XATTR_NAME_CAPS) == 0;
+}
+
 /*
  * struct xattr_handler: When @name is set, match attributes with exactly that
  * name.  When @prefix is set instead, match attributes with that prefix and

-- 
2.43.0
Re: [PATCH v2 08/25] xattr: add is_fscaps_xattr() helper
Posted by Christian Brauner 1 year, 9 months ago
On Wed, Feb 21, 2024 at 03:24:39PM -0600, Seth Forshee (DigitalOcean) wrote:
> Add a helper to determine if an xattr time is XATTR_NAME_CAPS instead of
> open-coding a string comparision.
> 
> Suggested-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
> ---

Looks good,
Reviewed-by: Christian Brauner <brauner@kernel.org>