1 #include <linux/reiserfs_fs.h>
2 #include <linux/errno.h>
4 #include <linux/pagemap.h>
5 #include <linux/xattr.h>
6 #include <linux/reiserfs_xattr.h>
7 #include <asm/uaccess.h>
9 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
10 # include <linux/reiserfs_acl.h>
13 #define XATTR_USER_PREFIX "user."
16 user_get(struct inode *inode, const char *name, void *buffer, size_t size)
21 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
24 if (!reiserfs_xattrs_user(inode->i_sb))
27 error = reiserfs_permission_locked(inode, MAY_READ, NULL);
31 return reiserfs_xattr_get(inode, name, buffer, size);
35 user_set(struct inode *inode, const char *name, const void *buffer,
36 size_t size, int flags)
41 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
44 if (!reiserfs_xattrs_user(inode->i_sb))
47 if (!S_ISREG(inode->i_mode) &&
48 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
51 error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
55 return reiserfs_xattr_set(inode, name, buffer, size, flags);
58 static int user_del(struct inode *inode, const char *name)
62 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
65 if (!reiserfs_xattrs_user(inode->i_sb))
68 if (!S_ISREG(inode->i_mode) &&
69 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
72 error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
80 user_list(struct inode *inode, const char *name, int namelen, char *out)
83 if (!reiserfs_xattrs_user(inode->i_sb))
87 memcpy(out, name, len);
92 struct reiserfs_xattr_handler user_handler = {
93 .prefix = XATTR_USER_PREFIX,