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 /mm/shmem.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 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index adf8033afd52..3cd32c2ea0a0 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2042,27 +2042,28 @@ static const struct inode_operations shmem_symlink_inode_operations = { | |||
2042 | * filesystem level, though. | 2042 | * filesystem level, though. |
2043 | */ | 2043 | */ |
2044 | 2044 | ||
2045 | static size_t shmem_xattr_security_list(struct inode *inode, char *list, | 2045 | static size_t shmem_xattr_security_list(struct dentry *dentry, char *list, |
2046 | size_t list_len, const char *name, | 2046 | size_t list_len, const char *name, |
2047 | size_t name_len) | 2047 | size_t name_len, int handler_flags) |
2048 | { | 2048 | { |
2049 | return security_inode_listsecurity(inode, list, list_len); | 2049 | return security_inode_listsecurity(dentry->d_inode, list, list_len); |
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | static int shmem_xattr_security_get(struct inode *inode, const char *name, | 2052 | static int shmem_xattr_security_get(struct dentry *dentry, const char *name, |
2053 | void *buffer, size_t size) | 2053 | void *buffer, size_t size, int handler_flags) |
2054 | { | 2054 | { |
2055 | if (strcmp(name, "") == 0) | 2055 | if (strcmp(name, "") == 0) |
2056 | return -EINVAL; | 2056 | return -EINVAL; |
2057 | return xattr_getsecurity(inode, name, buffer, size); | 2057 | return xattr_getsecurity(dentry->d_inode, name, buffer, size); |
2058 | } | 2058 | } |
2059 | 2059 | ||
2060 | static int shmem_xattr_security_set(struct inode *inode, const char *name, | 2060 | static int shmem_xattr_security_set(struct dentry *dentry, const char *name, |
2061 | const void *value, size_t size, int flags) | 2061 | const void *value, size_t size, int flags, int handler_flags) |
2062 | { | 2062 | { |
2063 | if (strcmp(name, "") == 0) | 2063 | if (strcmp(name, "") == 0) |
2064 | return -EINVAL; | 2064 | return -EINVAL; |
2065 | return security_inode_setsecurity(inode, name, value, size, flags); | 2065 | return security_inode_setsecurity(dentry->d_inode, name, value, |
2066 | size, flags); | ||
2066 | } | 2067 | } |
2067 | 2068 | ||
2068 | static struct xattr_handler shmem_xattr_security_handler = { | 2069 | static struct xattr_handler shmem_xattr_security_handler = { |