diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-11 16:32:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-11 16:32:10 -0500 |
commit | ddf1d6238dd13a3bd948e8fcb1109798ef0af49b (patch) | |
tree | daa25447e4b791b2868a0338f872975ec480862b /fs/reiserfs | |
parent | 32fb378437a1d716e72a442237d7ead1f435ecf0 (diff) | |
parent | 764a5c6b1fa4306dd7573c1d80914254909cd036 (diff) |
Merge branch 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs xattr updates from Al Viro:
"Andreas' xattr cleanup series.
It's a followup to his xattr work that went in last cycle; -0.5KLoC"
* 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
xattr handlers: Simplify list operation
ocfs2: Replace list xattr handler operations
nfs: Move call to security_inode_listsecurity into nfs_listxattr
xfs: Change how listxattr generates synthetic attributes
tmpfs: listxattr should include POSIX ACL xattrs
tmpfs: Use xattr handler infrastructure
btrfs: Use xattr handler infrastructure
vfs: Distinguish between full xattr names and proper prefixes
posix acls: Remove duplicate xattr name definitions
gfs2: Remove gfs2_xattr_acl_chmod
vfs: Remove vfs_xattr_cmp
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/xattr.c | 16 | ||||
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/xattr_security.c | 16 | ||||
-rw-r--r-- | fs/reiserfs/xattr_trusted.c | 15 | ||||
-rw-r--r-- | fs/reiserfs/xattr_user.c | 14 |
5 files changed, 17 insertions, 52 deletions
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 66b26fdfff8d..e5ddb4e5ea94 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -756,7 +756,8 @@ find_xattr_handler_prefix(const struct xattr_handler **handlers, | |||
756 | return NULL; | 756 | return NULL; |
757 | 757 | ||
758 | for_each_xattr_handler(handlers, xah) { | 758 | for_each_xattr_handler(handlers, xah) { |
759 | if (strncmp(xah->prefix, name, strlen(xah->prefix)) == 0) | 759 | const char *prefix = xattr_prefix(xah); |
760 | if (strncmp(prefix, name, strlen(prefix)) == 0) | ||
760 | break; | 761 | break; |
761 | } | 762 | } |
762 | 763 | ||
@@ -839,19 +840,16 @@ static int listxattr_filler(struct dir_context *ctx, const char *name, | |||
839 | 840 | ||
840 | handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr, | 841 | handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr, |
841 | name); | 842 | name); |
842 | if (!handler) /* Unsupported xattr name */ | 843 | if (!handler /* Unsupported xattr name */ || |
844 | (handler->list && !handler->list(b->dentry))) | ||
843 | return 0; | 845 | return 0; |
846 | size = namelen + 1; | ||
844 | if (b->buf) { | 847 | if (b->buf) { |
845 | size = handler->list(handler, b->dentry, | ||
846 | b->buf + b->pos, b->size, name, | ||
847 | namelen); | ||
848 | if (size > b->size) | 848 | if (size > b->size) |
849 | return -ERANGE; | 849 | return -ERANGE; |
850 | } else { | 850 | memcpy(b->buf + b->pos, name, namelen); |
851 | size = handler->list(handler, b->dentry, | 851 | b->buf[b->pos + namelen] = 0; |
852 | NULL, 0, name, namelen); | ||
853 | } | 852 | } |
854 | |||
855 | b->pos += size; | 853 | b->pos += size; |
856 | } | 854 | } |
857 | return 0; | 855 | return 0; |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 4b34b9dc03dd..558a16beaacb 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -186,10 +186,10 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
186 | 186 | ||
187 | switch (type) { | 187 | switch (type) { |
188 | case ACL_TYPE_ACCESS: | 188 | case ACL_TYPE_ACCESS: |
189 | name = POSIX_ACL_XATTR_ACCESS; | 189 | name = XATTR_NAME_POSIX_ACL_ACCESS; |
190 | break; | 190 | break; |
191 | case ACL_TYPE_DEFAULT: | 191 | case ACL_TYPE_DEFAULT: |
192 | name = POSIX_ACL_XATTR_DEFAULT; | 192 | name = XATTR_NAME_POSIX_ACL_DEFAULT; |
193 | break; | 193 | break; |
194 | default: | 194 | default: |
195 | BUG(); | 195 | BUG(); |
@@ -244,7 +244,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode, | |||
244 | 244 | ||
245 | switch (type) { | 245 | switch (type) { |
246 | case ACL_TYPE_ACCESS: | 246 | case ACL_TYPE_ACCESS: |
247 | name = POSIX_ACL_XATTR_ACCESS; | 247 | name = XATTR_NAME_POSIX_ACL_ACCESS; |
248 | if (acl) { | 248 | if (acl) { |
249 | error = posix_acl_equiv_mode(acl, &inode->i_mode); | 249 | error = posix_acl_equiv_mode(acl, &inode->i_mode); |
250 | if (error < 0) | 250 | if (error < 0) |
@@ -256,7 +256,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode, | |||
256 | } | 256 | } |
257 | break; | 257 | break; |
258 | case ACL_TYPE_DEFAULT: | 258 | case ACL_TYPE_DEFAULT: |
259 | name = POSIX_ACL_XATTR_DEFAULT; | 259 | name = XATTR_NAME_POSIX_ACL_DEFAULT; |
260 | if (!S_ISDIR(inode->i_mode)) | 260 | if (!S_ISDIR(inode->i_mode)) |
261 | return acl ? -EACCES : 0; | 261 | return acl ? -EACCES : 0; |
262 | break; | 262 | break; |
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index ac659af431ae..ab0217d32039 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
@@ -34,21 +34,9 @@ security_set(const struct xattr_handler *handler, struct dentry *dentry, | |||
34 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); | 34 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
35 | } | 35 | } |
36 | 36 | ||
37 | static size_t security_list(const struct xattr_handler *handler, | 37 | static bool security_list(struct dentry *dentry) |
38 | struct dentry *dentry, char *list, size_t list_len, | ||
39 | const char *name, size_t namelen) | ||
40 | { | 38 | { |
41 | const size_t len = namelen + 1; | 39 | return !IS_PRIVATE(d_inode(dentry)); |
42 | |||
43 | if (IS_PRIVATE(d_inode(dentry))) | ||
44 | return 0; | ||
45 | |||
46 | if (list && len <= list_len) { | ||
47 | memcpy(list, name, namelen); | ||
48 | list[namelen] = '\0'; | ||
49 | } | ||
50 | |||
51 | return len; | ||
52 | } | 40 | } |
53 | 41 | ||
54 | /* Initializes the security context for a new inode and returns the number | 42 | /* Initializes the security context for a new inode and returns the number |
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index a338adf1b8b4..64b67aa643a9 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c | |||
@@ -33,20 +33,9 @@ trusted_set(const struct xattr_handler *handler, struct dentry *dentry, | |||
33 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); | 33 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
34 | } | 34 | } |
35 | 35 | ||
36 | static size_t trusted_list(const struct xattr_handler *handler, | 36 | static bool trusted_list(struct dentry *dentry) |
37 | struct dentry *dentry, char *list, size_t list_size, | ||
38 | const char *name, size_t name_len) | ||
39 | { | 37 | { |
40 | const size_t len = name_len + 1; | 38 | return capable(CAP_SYS_ADMIN) && !IS_PRIVATE(d_inode(dentry)); |
41 | |||
42 | if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) | ||
43 | return 0; | ||
44 | |||
45 | if (list && len <= list_size) { | ||
46 | memcpy(list, name, name_len); | ||
47 | list[name_len] = '\0'; | ||
48 | } | ||
49 | return len; | ||
50 | } | 39 | } |
51 | 40 | ||
52 | const struct xattr_handler reiserfs_xattr_trusted_handler = { | 41 | const struct xattr_handler reiserfs_xattr_trusted_handler = { |
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index 39c9667191c5..12e6306f562a 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c | |||
@@ -30,19 +30,9 @@ user_set(const struct xattr_handler *handler, struct dentry *dentry, | |||
30 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); | 30 | return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); |
31 | } | 31 | } |
32 | 32 | ||
33 | static size_t user_list(const struct xattr_handler *handler, | 33 | static bool user_list(struct dentry *dentry) |
34 | struct dentry *dentry, char *list, size_t list_size, | ||
35 | const char *name, size_t name_len) | ||
36 | { | 34 | { |
37 | const size_t len = name_len + 1; | 35 | return reiserfs_xattrs_user(dentry->d_sb); |
38 | |||
39 | if (!reiserfs_xattrs_user(dentry->d_sb)) | ||
40 | return 0; | ||
41 | if (list && len <= list_size) { | ||
42 | memcpy(list, name, name_len); | ||
43 | list[name_len] = '\0'; | ||
44 | } | ||
45 | return len; | ||
46 | } | 36 | } |
47 | 37 | ||
48 | const struct xattr_handler reiserfs_xattr_user_handler = { | 38 | const struct xattr_handler reiserfs_xattr_user_handler = { |