]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/linux/xattr.h
vfs: Distinguish between full xattr names and proper prefixes
[mirror_ubuntu-bionic-kernel.git] / include / linux / xattr.h
index 89474b9d260cf44151b21e26ce5d64aecf62b6cb..03c847fb6cc1c21189b924c0e27ecffb013a4d91 100644 (file)
 struct inode;
 struct dentry;
 
+/*
+ * struct xattr_handler: When @name is set, match attributes with exactly that
+ * name.  When @prefix is set instead, match attributes with that prefix and
+ * with a non-empty suffix.
+ */
 struct xattr_handler {
+       const char *name;
        const char *prefix;
        int flags;      /* fs private flags */
        size_t (*list)(const struct xattr_handler *, struct dentry *dentry,
@@ -53,8 +59,11 @@ int generic_setxattr(struct dentry *dentry, const char *name, const void *value,
 int generic_removexattr(struct dentry *dentry, const char *name);
 ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
                           char **xattr_value, size_t size, gfp_t flags);
-int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
-                 const char *value, size_t size, gfp_t flags);
+
+static inline const char *xattr_prefix(const struct xattr_handler *handler)
+{
+       return handler->prefix ?: handler->name;
+}
 
 struct simple_xattrs {
        struct list_head head;