aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/xattr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/xattr.h')
-rw-r--r--include/linux/xattr.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index e5d122031542..cc13e1115970 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -33,6 +33,9 @@
33#define XATTR_EVM_SUFFIX "evm" 33#define XATTR_EVM_SUFFIX "evm"
34#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX 34#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX
35 35
36#define XATTR_IMA_SUFFIX "ima"
37#define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX
38
36#define XATTR_SELINUX_SUFFIX "selinux" 39#define XATTR_SELINUX_SUFFIX "selinux"
37#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX 40#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
38 41
@@ -59,7 +62,9 @@
59 62
60#ifdef __KERNEL__ 63#ifdef __KERNEL__
61 64
65#include <linux/slab.h>
62#include <linux/types.h> 66#include <linux/types.h>
67#include <linux/spinlock.h>
63 68
64struct inode; 69struct inode;
65struct dentry; 70struct dentry;
@@ -96,6 +101,52 @@ ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
96 char **xattr_value, size_t size, gfp_t flags); 101 char **xattr_value, size_t size, gfp_t flags);
97int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name, 102int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
98 const char *value, size_t size, gfp_t flags); 103 const char *value, size_t size, gfp_t flags);
104
105struct simple_xattrs {
106 struct list_head head;
107 spinlock_t lock;
108};
109
110struct simple_xattr {
111 struct list_head list;
112 char *name;
113 size_t size;
114 char value[0];
115};
116
117/*
118 * initialize the simple_xattrs structure
119 */
120static inline void simple_xattrs_init(struct simple_xattrs *xattrs)
121{
122 INIT_LIST_HEAD(&xattrs->head);
123 spin_lock_init(&xattrs->lock);
124}
125
126/*
127 * free all the xattrs
128 */
129static inline void simple_xattrs_free(struct simple_xattrs *xattrs)
130{
131 struct simple_xattr *xattr, *node;
132
133 list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
134 kfree(xattr->name);
135 kfree(xattr);
136 }
137}
138
139struct simple_xattr *simple_xattr_alloc(const void *value, size_t size);
140int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
141 void *buffer, size_t size);
142int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
143 const void *value, size_t size, int flags);
144int simple_xattr_remove(struct simple_xattrs *xattrs, const char *name);
145ssize_t simple_xattr_list(struct simple_xattrs *xattrs, char *buffer,
146 size_t size);
147void simple_xattr_list_add(struct simple_xattrs *xattrs,
148 struct simple_xattr *new_xattr);
149
99#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
100 151
101#endif /* _LINUX_XATTR_H */ 152#endif /* _LINUX_XATTR_H */