4 Extended attributes handling.
6 Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
7 Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
8 Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
10 #ifndef _LINUX_XATTR_H
11 #define _LINUX_XATTR_H
14 #include <linux/slab.h>
15 #include <linux/types.h>
16 #include <linux/spinlock.h>
17 #include <uapi/linux/xattr.h>
20 #define XATTR_CREATE 0x1
24 #define XATTR_REPLACE 0x2
29 struct user_namespace;
32 * struct xattr_handler: When @name is set, match attributes with exactly that
33 * name. When @prefix is set instead, match attributes with that prefix and
34 * with a non-empty suffix.
36 struct xattr_handler {
39 int flags; /* fs private flags */
40 bool (*list)(struct dentry *dentry);
41 int (*get)(const struct xattr_handler *, struct dentry *dentry,
42 struct inode *inode, const char *name, void *buffer,
44 int (*set)(const struct xattr_handler *,
45 struct user_namespace *mnt_userns, struct dentry *dentry,
46 struct inode *inode, const char *name, const void *buffer,
47 size_t size, int flags);
50 const char *xattr_full_name(const struct xattr_handler *, const char *);
58 ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
59 ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
60 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
61 int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int);
62 int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
63 int vfs_removexattr(struct dentry *, const char *);
65 ssize_t generic_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size);
66 ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
67 int generic_setxattr(struct dentry *dentry, struct inode *inode,
68 const char *name, const void *value, size_t size, int flags);
69 int generic_removexattr(struct dentry *dentry, const char *name);
70 ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
71 char **xattr_value, size_t size, gfp_t flags);
73 static inline const char *xattr_prefix(const struct xattr_handler *handler)
75 return handler->prefix ?: handler->name;
78 #endif /* _LINUX_XATTR_H */