diff options
Diffstat (limited to 'include/linux/xattr.h')
-rw-r--r-- | include/linux/xattr.h | 51 |
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 | ||
64 | struct inode; | 69 | struct inode; |
65 | struct dentry; | 70 | struct 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); |
97 | int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name, | 102 | int 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 | |||
105 | struct simple_xattrs { | ||
106 | struct list_head head; | ||
107 | spinlock_t lock; | ||
108 | }; | ||
109 | |||
110 | struct 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 | */ | ||
120 | static 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 | */ | ||
129 | static 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 | |||
139 | struct simple_xattr *simple_xattr_alloc(const void *value, size_t size); | ||
140 | int simple_xattr_get(struct simple_xattrs *xattrs, const char *name, | ||
141 | void *buffer, size_t size); | ||
142 | int simple_xattr_set(struct simple_xattrs *xattrs, const char *name, | ||
143 | const void *value, size_t size, int flags); | ||
144 | int simple_xattr_remove(struct simple_xattrs *xattrs, const char *name); | ||
145 | ssize_t simple_xattr_list(struct simple_xattrs *xattrs, char *buffer, | ||
146 | size_t size); | ||
147 | void 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 */ |