aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/xattr.c')
-rw-r--r--fs/9p/xattr.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index 0cf44b6cccd6..e3d026ac382e 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -137,6 +137,48 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
137 return v9fs_xattr_get(dentry, NULL, buffer, buffer_size); 137 return v9fs_xattr_get(dentry, NULL, buffer, buffer_size);
138} 138}
139 139
140static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
141 struct dentry *dentry, const char *name,
142 void *buffer, size_t size)
143{
144 const char *full_name = xattr_full_name(handler, name);
145
146 if (strcmp(name, "") == 0)
147 return -EINVAL;
148 return v9fs_xattr_get(dentry, full_name, buffer, size);
149}
150
151static int v9fs_xattr_handler_set(const struct xattr_handler *handler,
152 struct dentry *dentry, const char *name,
153 const void *value, size_t size, int flags)
154{
155 const char *full_name = xattr_full_name(handler, name);
156
157 if (strcmp(name, "") == 0)
158 return -EINVAL;
159 return v9fs_xattr_set(dentry, full_name, value, size, flags);
160}
161
162static struct xattr_handler v9fs_xattr_user_handler = {
163 .prefix = XATTR_USER_PREFIX,
164 .get = v9fs_xattr_handler_get,
165 .set = v9fs_xattr_handler_set,
166};
167
168static struct xattr_handler v9fs_xattr_trusted_handler = {
169 .prefix = XATTR_TRUSTED_PREFIX,
170 .get = v9fs_xattr_handler_get,
171 .set = v9fs_xattr_handler_set,
172};
173
174#ifdef CONFIG_9P_FS_SECURITY
175static struct xattr_handler v9fs_xattr_security_handler = {
176 .prefix = XATTR_SECURITY_PREFIX,
177 .get = v9fs_xattr_handler_get,
178 .set = v9fs_xattr_handler_set,
179};
180#endif
181
140const struct xattr_handler *v9fs_xattr_handlers[] = { 182const struct xattr_handler *v9fs_xattr_handlers[] = {
141 &v9fs_xattr_user_handler, 183 &v9fs_xattr_user_handler,
142 &v9fs_xattr_trusted_handler, 184 &v9fs_xattr_trusted_handler,