diff options
Diffstat (limited to 'fs/gfs2/eaops.c')
-rw-r--r-- | fs/gfs2/eaops.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c index 85c1dbace88b..2243b44ecb07 100644 --- a/fs/gfs2/eaops.c +++ b/fs/gfs2/eaops.c | |||
@@ -43,6 +43,10 @@ unsigned int gfs2_ea_name2type(const char *name, char **truncated_name) | |||
43 | type = GFS2_EATYPE_USR; | 43 | type = GFS2_EATYPE_USR; |
44 | if (truncated_name) | 44 | if (truncated_name) |
45 | *truncated_name = strchr(name, '.') + 1; | 45 | *truncated_name = strchr(name, '.') + 1; |
46 | } else if (strncmp(name, "security.", 9) == 0) { | ||
47 | type = GFS2_EATYPE_SECURITY; | ||
48 | if (truncated_name) | ||
49 | *truncated_name = strchr(name, '.') + 1; | ||
46 | } else { | 50 | } else { |
47 | type = GFS2_EATYPE_UNUSED; | 51 | type = GFS2_EATYPE_UNUSED; |
48 | if (truncated_name) | 52 | if (truncated_name) |
@@ -166,6 +170,36 @@ static int system_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er) | |||
166 | return gfs2_ea_remove_i(ip, er); | 170 | return gfs2_ea_remove_i(ip, er); |
167 | } | 171 | } |
168 | 172 | ||
173 | static int security_eo_get(struct gfs2_inode *ip, struct gfs2_ea_request *er) | ||
174 | { | ||
175 | struct inode *inode = ip->i_vnode; | ||
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 | |||
183 | static int security_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) | ||
184 | { | ||
185 | struct inode *inode = ip->i_vnode; | ||
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 | |||
193 | static int security_eo_remove(struct gfs2_inode *ip, struct gfs2_ea_request *er) | ||
194 | { | ||
195 | struct inode *inode = ip->i_vnode; | ||
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 | |||
169 | static struct gfs2_eattr_operations gfs2_user_eaops = { | 203 | static struct gfs2_eattr_operations gfs2_user_eaops = { |
170 | .eo_get = user_eo_get, | 204 | .eo_get = user_eo_get, |
171 | .eo_set = user_eo_set, | 205 | .eo_set = user_eo_set, |
@@ -180,6 +214,13 @@ struct gfs2_eattr_operations gfs2_system_eaops = { | |||
180 | .eo_name = "system", | 214 | .eo_name = "system", |
181 | }; | 215 | }; |
182 | 216 | ||
217 | struct gfs2_eattr_operations gfs2_security_eaops = { | ||
218 | .eo_get = security_eo_get, | ||
219 | .eo_set = security_eo_set, | ||
220 | .eo_remove = security_eo_remove, | ||
221 | .eo_name = "security", | ||
222 | }; | ||
223 | |||
183 | struct gfs2_eattr_operations *gfs2_ea_ops[] = { | 224 | struct gfs2_eattr_operations *gfs2_ea_ops[] = { |
184 | NULL, | 225 | NULL, |
185 | &gfs2_user_eaops, | 226 | &gfs2_user_eaops, |