diff options
author | Christoph Hellwig <hch@lst.de> | 2009-11-13 04:52:56 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-16 12:16:49 -0500 |
commit | 431547b3c4533b8c7fd150ab36980b9a3147797b (patch) | |
tree | 807ff2790f3c13c7c91ed2afd6d833032899482d /fs/gfs2/acl.c | |
parent | ef26ca97e83052790940cbc444b01b0d17a813c1 (diff) |
sanitize xattr handler prototypes
Add a flags argument to struct xattr_handler and pass it to all xattr
handler methods. This allows using the same methods for multiple
handlers, e.g. for the ACL methods which perform exactly the same action
for the access and default ACLs, just using a different underlying
attribute. With a little more groundwork it'll also allow sharing the
methods for the regular user/trusted/secure handlers in extN, ocfs2 and
jffs2 like it's already done for xfs in this patch.
Also change the inode argument to the handlers to a dentry to allow
using the handlers mechnism for filesystems that require it later,
e.g. cifs.
[with GFS2 bits updated by Steven Whitehouse <swhiteho@redhat.com>]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2/acl.c')
-rw-r--r-- | fs/gfs2/acl.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index 3eb1ea846173..87ee309d4c24 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c | |||
@@ -126,7 +126,7 @@ static int gfs2_acl_set(struct inode *inode, int type, struct posix_acl *acl) | |||
126 | error = posix_acl_to_xattr(acl, data, len); | 126 | error = posix_acl_to_xattr(acl, data, len); |
127 | if (error < 0) | 127 | if (error < 0) |
128 | goto out; | 128 | goto out; |
129 | error = gfs2_xattr_set(inode, GFS2_EATYPE_SYS, name, data, len, 0); | 129 | error = __gfs2_xattr_set(inode, name, data, len, 0, GFS2_EATYPE_SYS); |
130 | if (!error) | 130 | if (!error) |
131 | set_cached_acl(inode, type, acl); | 131 | set_cached_acl(inode, type, acl); |
132 | out: | 132 | out: |
@@ -232,9 +232,10 @@ static int gfs2_acl_type(const char *name) | |||
232 | return -EINVAL; | 232 | return -EINVAL; |
233 | } | 233 | } |
234 | 234 | ||
235 | static int gfs2_xattr_system_get(struct inode *inode, const char *name, | 235 | static int gfs2_xattr_system_get(struct dentry *dentry, const char *name, |
236 | void *buffer, size_t size) | 236 | void *buffer, size_t size, int xtype) |
237 | { | 237 | { |
238 | struct inode *inode = dentry->d_inode; | ||
238 | struct posix_acl *acl; | 239 | struct posix_acl *acl; |
239 | int type; | 240 | int type; |
240 | int error; | 241 | int error; |
@@ -255,9 +256,11 @@ static int gfs2_xattr_system_get(struct inode *inode, const char *name, | |||
255 | return error; | 256 | return error; |
256 | } | 257 | } |
257 | 258 | ||
258 | static int gfs2_xattr_system_set(struct inode *inode, const char *name, | 259 | static int gfs2_xattr_system_set(struct dentry *dentry, const char *name, |
259 | const void *value, size_t size, int flags) | 260 | const void *value, size_t size, int flags, |
261 | int xtype) | ||
260 | { | 262 | { |
263 | struct inode *inode = dentry->d_inode; | ||
261 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 264 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
262 | struct posix_acl *acl = NULL; | 265 | struct posix_acl *acl = NULL; |
263 | int error = 0, type; | 266 | int error = 0, type; |
@@ -319,7 +322,7 @@ static int gfs2_xattr_system_set(struct inode *inode, const char *name, | |||
319 | } | 322 | } |
320 | 323 | ||
321 | set_acl: | 324 | set_acl: |
322 | error = gfs2_xattr_set(inode, GFS2_EATYPE_SYS, name, value, size, 0); | 325 | error = __gfs2_xattr_set(inode, name, value, size, 0, GFS2_EATYPE_SYS); |
323 | if (!error) { | 326 | if (!error) { |
324 | if (acl) | 327 | if (acl) |
325 | set_cached_acl(inode, type, acl); | 328 | set_cached_acl(inode, type, acl); |
@@ -334,6 +337,7 @@ out: | |||
334 | 337 | ||
335 | struct xattr_handler gfs2_xattr_system_handler = { | 338 | struct xattr_handler gfs2_xattr_system_handler = { |
336 | .prefix = XATTR_SYSTEM_PREFIX, | 339 | .prefix = XATTR_SYSTEM_PREFIX, |
340 | .flags = GFS2_EATYPE_SYS, | ||
337 | .get = gfs2_xattr_system_get, | 341 | .get = gfs2_xattr_system_get, |
338 | .set = gfs2_xattr_system_set, | 342 | .set = gfs2_xattr_system_set, |
339 | }; | 343 | }; |