aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/eaops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/eaops.c')
-rw-r--r--fs/gfs2/eaops.c84
1 files changed, 6 insertions, 78 deletions
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index aa8dbf303f6d..f114ba2b3557 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -56,46 +56,6 @@ unsigned int gfs2_ea_name2type(const char *name, const char **truncated_name)
56 return type; 56 return type;
57} 57}
58 58
59static int user_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
60{
61 struct inode *inode = &ip->i_inode;
62 int error = permission(inode, MAY_READ, NULL);
63 if (error)
64 return error;
65
66 return gfs2_ea_get_i(ip, er);
67}
68
69static int user_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
70{
71 struct inode *inode = &ip->i_inode;
72
73 if (S_ISREG(inode->i_mode) ||
74 (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
75 int error = permission(inode, MAY_WRITE, NULL);
76 if (error)
77 return error;
78 } else
79 return -EPERM;
80
81 return gfs2_ea_set_i(ip, er);
82}
83
84static int user_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
85{
86 struct inode *inode = &ip->i_inode;
87
88 if (S_ISREG(inode->i_mode) ||
89 (S_ISDIR(inode->i_mode) && !(inode->i_mode & S_ISVTX))) {
90 int error = permission(inode, MAY_WRITE, NULL);
91 if (error)
92 return error;
93 } else
94 return -EPERM;
95
96 return gfs2_ea_remove_i(ip, er);
97}
98
99static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) 59static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
100{ 60{
101 if (!GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len) && 61 if (!GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len) &&
@@ -108,8 +68,6 @@ static int system_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
108 GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len))) 68 GFS2_ACL_IS_DEFAULT(er->er_name, er->er_name_len)))
109 return -EOPNOTSUPP; 69 return -EOPNOTSUPP;
110 70
111
112
113 return gfs2_ea_get_i(ip, er); 71 return gfs2_ea_get_i(ip, er);
114} 72}
115 73
@@ -170,40 +128,10 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
170 return gfs2_ea_remove_i(ip, er); 128 return gfs2_ea_remove_i(ip, er);
171} 129}
172 130
173static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er)
174{
175 struct inode *inode = &ip->i_inode;
176 int error = permission(inode, MAY_READ, NULL);
177 if (error)
178 return error;
179
180 return gfs2_ea_get_i(ip, er);
181}
182
183static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
184{
185 struct inode *inode = &ip->i_inode;
186 int error = permission(inode, MAY_WRITE, NULL);
187 if (error)
188 return error;
189
190 return gfs2_ea_set_i(ip, er);
191}
192
193static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er)
194{
195 struct inode *inode = &ip->i_inode;
196 int error = permission(inode, MAY_WRITE, NULL);
197 if (error)
198 return error;
199
200 return gfs2_ea_remove_i(ip, er);
201}
202
203static const struct gfs2_eattr_operations gfs2_user_eaops = { 131static const struct gfs2_eattr_operations gfs2_user_eaops = {
204 .eo_get = user_eo_get, 132 .eo_get = gfs2_ea_get_i,
205 .eo_set = user_eo_set, 133 .eo_set = gfs2_ea_set_i,
206 .eo_remove = user_eo_remove, 134 .eo_remove = gfs2_ea_remove_i,
207 .eo_name = "user", 135 .eo_name = "user",
208}; 136};
209 137
@@ -215,9 +143,9 @@ const struct gfs2_eattr_operations gfs2_system_eaops = {
215}; 143};
216 144
217static const struct gfs2_eattr_operations gfs2_security_eaops = { 145static const struct gfs2_eattr_operations gfs2_security_eaops = {
218 .eo_get = security_eo_get, 146 .eo_get = gfs2_ea_get_i,
219 .eo_set = security_eo_set, 147 .eo_set = gfs2_ea_set_i,
220 .eo_remove = security_eo_remove, 148 .eo_remove = gfs2_ea_remove_i,
221 .eo_name = "security", 149 .eo_name = "security",
222}; 150};
223 151