0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/init.h>
0010 #include <linux/string.h>
0011 #include "ext2.h"
0012 #include "xattr.h"
0013
0014 static bool
0015 ext2_xattr_user_list(struct dentry *dentry)
0016 {
0017 return test_opt(dentry->d_sb, XATTR_USER);
0018 }
0019
0020 static int
0021 ext2_xattr_user_get(const struct xattr_handler *handler,
0022 struct dentry *unused, struct inode *inode,
0023 const char *name, void *buffer, size_t size)
0024 {
0025 if (!test_opt(inode->i_sb, XATTR_USER))
0026 return -EOPNOTSUPP;
0027 return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER,
0028 name, buffer, size);
0029 }
0030
0031 static int
0032 ext2_xattr_user_set(const struct xattr_handler *handler,
0033 struct user_namespace *mnt_userns,
0034 struct dentry *unused, struct inode *inode,
0035 const char *name, const void *value,
0036 size_t size, int flags)
0037 {
0038 if (!test_opt(inode->i_sb, XATTR_USER))
0039 return -EOPNOTSUPP;
0040
0041 return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER,
0042 name, value, size, flags);
0043 }
0044
0045 const struct xattr_handler ext2_xattr_user_handler = {
0046 .prefix = XATTR_USER_PREFIX,
0047 .list = ext2_xattr_user_list,
0048 .get = ext2_xattr_user_get,
0049 .set = ext2_xattr_user_set,
0050 };