aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/xattr_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/xattr_user.c')
-rw-r--r--fs/reiserfs/xattr_user.c30
1 files changed, 0 insertions, 30 deletions
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index 51458048ca6..073f39364b1 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -16,18 +16,10 @@ static int
16user_get(struct inode *inode, const char *name, void *buffer, size_t size) 16user_get(struct inode *inode, const char *name, void *buffer, size_t size)
17{ 17{
18 18
19 int error;
20
21 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 19 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
22 return -EINVAL; 20 return -EINVAL;
23
24 if (!reiserfs_xattrs_user(inode->i_sb)) 21 if (!reiserfs_xattrs_user(inode->i_sb))
25 return -EOPNOTSUPP; 22 return -EOPNOTSUPP;
26
27 error = reiserfs_permission_locked(inode, MAY_READ, NULL);
28 if (error)
29 return error;
30
31 return reiserfs_xattr_get(inode, name, buffer, size); 23 return reiserfs_xattr_get(inode, name, buffer, size);
32} 24}
33 25
@@ -36,43 +28,21 @@ user_set(struct inode *inode, const char *name, const void *buffer,
36 size_t size, int flags) 28 size_t size, int flags)
37{ 29{
38 30
39 int error;
40
41 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 31 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
42 return -EINVAL; 32 return -EINVAL;
43 33
44 if (!reiserfs_xattrs_user(inode->i_sb)) 34 if (!reiserfs_xattrs_user(inode->i_sb))
45 return -EOPNOTSUPP; 35 return -EOPNOTSUPP;
46
47 if (!S_ISREG(inode->i_mode) &&
48 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
49 return -EPERM;
50
51 error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
52 if (error)
53 return error;
54
55 return reiserfs_xattr_set(inode, name, buffer, size, flags); 36 return reiserfs_xattr_set(inode, name, buffer, size, flags);
56} 37}
57 38
58static int user_del(struct inode *inode, const char *name) 39static int user_del(struct inode *inode, const char *name)
59{ 40{
60 int error;
61
62 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 41 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
63 return -EINVAL; 42 return -EINVAL;
64 43
65 if (!reiserfs_xattrs_user(inode->i_sb)) 44 if (!reiserfs_xattrs_user(inode->i_sb))
66 return -EOPNOTSUPP; 45 return -EOPNOTSUPP;
67
68 if (!S_ISREG(inode->i_mode) &&
69 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
70 return -EPERM;
71
72 error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
73 if (error)
74 return error;
75
76 return 0; 46 return 0;
77} 47}
78 48