2 * linux/fs/ext3/xattr_security.c
3 * Handler for storing security labels as extended attributes.
6 #include <linux/module.h>
7 #include <linux/string.h>
9 #include <linux/smp_lock.h>
10 #include <linux/ext3_jbd.h>
11 #include <linux/ext3_fs.h>
15 ext3_xattr_security_list(char *list, struct inode *inode,
16 const char *name, int name_len)
18 const int prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
21 memcpy(list, XATTR_SECURITY_PREFIX, prefix_len);
22 memcpy(list+prefix_len, name, name_len);
23 list[prefix_len + name_len] = '\0';
25 return prefix_len + name_len + 1;
29 ext3_xattr_security_get(struct inode *inode, const char *name,
30 void *buffer, size_t size)
32 if (strcmp(name, "") == 0)
34 return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY, name,
39 ext3_xattr_security_set(struct inode *inode, const char *name,
40 const void *value, size_t size, int flags)
42 if (strcmp(name, "") == 0)
44 return ext3_xattr_set(inode, EXT3_XATTR_INDEX_SECURITY, name,
48 struct ext3_xattr_handler ext3_xattr_security_handler = {
49 .prefix = XATTR_SECURITY_PREFIX,
50 .list = ext3_xattr_security_list,
51 .get = ext3_xattr_security_get,
52 .set = ext3_xattr_security_set,