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.c89
1 files changed, 44 insertions, 45 deletions
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index 0772806466a8..51458048ca66 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -13,81 +13,80 @@
13#define XATTR_USER_PREFIX "user." 13#define XATTR_USER_PREFIX "user."
14 14
15static int 15static 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; 19 int error;
20 20
21 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 21 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
22 return -EINVAL; 22 return -EINVAL;
23 23
24 if (!reiserfs_xattrs_user (inode->i_sb)) 24 if (!reiserfs_xattrs_user(inode->i_sb))
25 return -EOPNOTSUPP; 25 return -EOPNOTSUPP;
26 26
27 error = reiserfs_permission_locked (inode, MAY_READ, NULL); 27 error = reiserfs_permission_locked(inode, MAY_READ, NULL);
28 if (error) 28 if (error)
29 return error; 29 return error;
30 30
31 return reiserfs_xattr_get (inode, name, buffer, size); 31 return reiserfs_xattr_get(inode, name, buffer, size);
32} 32}
33 33
34static int 34static int
35user_set (struct inode *inode, const char *name, const void *buffer, 35user_set(struct inode *inode, const char *name, const void *buffer,
36 size_t size, int flags) 36 size_t size, int flags)
37{ 37{
38 38
39 int error; 39 int error;
40 40
41 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 41 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
42 return -EINVAL; 42 return -EINVAL;
43 43
44 if (!reiserfs_xattrs_user (inode->i_sb)) 44 if (!reiserfs_xattrs_user(inode->i_sb))
45 return -EOPNOTSUPP; 45 return -EOPNOTSUPP;
46 46
47 if (!S_ISREG (inode->i_mode) && 47 if (!S_ISREG(inode->i_mode) &&
48 (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX)) 48 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
49 return -EPERM; 49 return -EPERM;
50 50
51 error = reiserfs_permission_locked (inode, MAY_WRITE, NULL); 51 error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
52 if (error) 52 if (error)
53 return error; 53 return error;
54 54
55 return reiserfs_xattr_set (inode, name, buffer, size, flags); 55 return reiserfs_xattr_set(inode, name, buffer, size, flags);
56} 56}
57 57
58static int 58static int user_del(struct inode *inode, const char *name)
59user_del (struct inode *inode, const char *name)
60{ 59{
61 int error; 60 int error;
62 61
63 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 62 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
64 return -EINVAL; 63 return -EINVAL;
65 64
66 if (!reiserfs_xattrs_user (inode->i_sb)) 65 if (!reiserfs_xattrs_user(inode->i_sb))
67 return -EOPNOTSUPP; 66 return -EOPNOTSUPP;
68 67
69 if (!S_ISREG (inode->i_mode) && 68 if (!S_ISREG(inode->i_mode) &&
70 (!S_ISDIR (inode->i_mode) || inode->i_mode & S_ISVTX)) 69 (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
71 return -EPERM; 70 return -EPERM;
72 71
73 error = reiserfs_permission_locked (inode, MAY_WRITE, NULL); 72 error = reiserfs_permission_locked(inode, MAY_WRITE, NULL);
74 if (error) 73 if (error)
75 return error; 74 return error;
76 75
77 return 0; 76 return 0;
78} 77}
79 78
80static int 79static int
81user_list (struct inode *inode, const char *name, int namelen, char *out) 80user_list(struct inode *inode, const char *name, int namelen, char *out)
82{ 81{
83 int len = namelen; 82 int len = namelen;
84 if (!reiserfs_xattrs_user (inode->i_sb)) 83 if (!reiserfs_xattrs_user(inode->i_sb))
85 return 0; 84 return 0;
86 85
87 if (out) 86 if (out)
88 memcpy (out, name, len); 87 memcpy(out, name, len);
89 88
90 return len; 89 return len;
91} 90}
92 91
93struct reiserfs_xattr_handler user_handler = { 92struct reiserfs_xattr_handler user_handler = {