summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2015-10-04 13:18:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-11-13 20:34:32 -0500
commitd9a82a04033f87bbd06efb29f78c0170a38154a8 (patch)
treeac074d813cda2a29a5f8a12a063e058ea588cb7c
parentbf781714b3e1421a0ebcd0137d081e6566a89f15 (diff)
xattr handlers: Pass handler to operations instead of flags
The xattr_handler operations are currently all passed a file system specific flags value which the operations can use to disambiguate between different handlers; some file systems use that to distinguish the xattr namespace, for example. In some oprations, it would be useful to also have access to the handler prefix. To allow that, pass a pointer to the handler to operations instead of the flags value alone. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/9p/acl.c18
-rw-r--r--fs/9p/xattr_security.c10
-rw-r--r--fs/9p/xattr_trusted.c10
-rw-r--r--fs/9p/xattr_user.c10
-rw-r--r--fs/ext2/xattr.c7
-rw-r--r--fs/ext2/xattr_security.c15
-rw-r--r--fs/ext2/xattr_trusted.c15
-rw-r--r--fs/ext2/xattr_user.c15
-rw-r--r--fs/ext4/xattr.c7
-rw-r--r--fs/ext4/xattr_security.c15
-rw-r--r--fs/ext4/xattr_trusted.c15
-rw-r--r--fs/ext4/xattr_user.c15
-rw-r--r--fs/f2fs/xattr.c47
-rw-r--r--fs/gfs2/xattr.c13
-rw-r--r--fs/hfsplus/xattr.c10
-rw-r--r--fs/hfsplus/xattr_security.c10
-rw-r--r--fs/hfsplus/xattr_trusted.c10
-rw-r--r--fs/hfsplus/xattr_user.c10
-rw-r--r--fs/jffs2/security.c16
-rw-r--r--fs/jffs2/xattr.c9
-rw-r--r--fs/jffs2/xattr_trusted.c16
-rw-r--r--fs/jffs2/xattr_user.c16
-rw-r--r--fs/nfs/nfs4proc.c34
-rw-r--r--fs/ocfs2/xattr.c45
-rw-r--r--fs/posix_acl.c28
-rw-r--r--fs/reiserfs/xattr.c16
-rw-r--r--fs/reiserfs/xattr_security.c13
-rw-r--r--fs/reiserfs/xattr_trusted.c13
-rw-r--r--fs/reiserfs/xattr_user.c13
-rw-r--r--fs/squashfs/xattr.c36
-rw-r--r--fs/xattr.c15
-rw-r--r--fs/xfs/xfs_xattr.c10
32 files changed, 306 insertions, 226 deletions
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index 31c010372660..e6fe82462043 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -230,11 +230,13 @@ static int v9fs_remote_get_acl(struct dentry *dentry, const char *name,
230 return v9fs_xattr_get(dentry, full_name, buffer, size); 230 return v9fs_xattr_get(dentry, full_name, buffer, size);
231} 231}
232 232
233static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, 233static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
234 void *buffer, size_t size, int type) 234 struct dentry *dentry, const char *name,
235 void *buffer, size_t size)
235{ 236{
236 struct v9fs_session_info *v9ses; 237 struct v9fs_session_info *v9ses;
237 struct posix_acl *acl; 238 struct posix_acl *acl;
239 int type = handler->flags;
238 int error; 240 int error;
239 241
240 if (strcmp(name, "") != 0) 242 if (strcmp(name, "") != 0)
@@ -278,9 +280,9 @@ static int v9fs_remote_set_acl(struct dentry *dentry, const char *name,
278} 280}
279 281
280 282
281static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, 283static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
282 const void *value, size_t size, 284 struct dentry *dentry, const char *name,
283 int flags, int type) 285 const void *value, size_t size, int flags)
284{ 286{
285 int retval; 287 int retval;
286 struct posix_acl *acl; 288 struct posix_acl *acl;
@@ -297,7 +299,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
297 */ 299 */
298 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) 300 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
299 return v9fs_remote_set_acl(dentry, name, 301 return v9fs_remote_set_acl(dentry, name,
300 value, size, flags, type); 302 value, size, flags, handler->flags);
301 303
302 if (S_ISLNK(inode->i_mode)) 304 if (S_ISLNK(inode->i_mode))
303 return -EOPNOTSUPP; 305 return -EOPNOTSUPP;
@@ -316,7 +318,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
316 } else 318 } else
317 acl = NULL; 319 acl = NULL;
318 320
319 switch (type) { 321 switch (handler->flags) {
320 case ACL_TYPE_ACCESS: 322 case ACL_TYPE_ACCESS:
321 name = POSIX_ACL_XATTR_ACCESS; 323 name = POSIX_ACL_XATTR_ACCESS;
322 if (acl) { 324 if (acl) {
@@ -360,7 +362,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
360 } 362 }
361 retval = v9fs_xattr_set(dentry, name, value, size, flags); 363 retval = v9fs_xattr_set(dentry, name, value, size, flags);
362 if (!retval) 364 if (!retval)
363 set_cached_acl(inode, type, acl); 365 set_cached_acl(inode, handler->flags, acl);
364err_out: 366err_out:
365 posix_acl_release(acl); 367 posix_acl_release(acl);
366 return retval; 368 return retval;
diff --git a/fs/9p/xattr_security.c b/fs/9p/xattr_security.c
index cb247a142a6e..c0a470add13c 100644
--- a/fs/9p/xattr_security.c
+++ b/fs/9p/xattr_security.c
@@ -19,8 +19,9 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "xattr.h" 20#include "xattr.h"
21 21
22static int v9fs_xattr_security_get(struct dentry *dentry, const char *name, 22static int v9fs_xattr_security_get(const struct xattr_handler *handler,
23 void *buffer, size_t size, int type) 23 struct dentry *dentry, const char *name,
24 void *buffer, size_t size)
24{ 25{
25 int retval; 26 int retval;
26 char *full_name; 27 char *full_name;
@@ -46,8 +47,9 @@ static int v9fs_xattr_security_get(struct dentry *dentry, const char *name,
46 return retval; 47 return retval;
47} 48}
48 49
49static int v9fs_xattr_security_set(struct dentry *dentry, const char *name, 50static int v9fs_xattr_security_set(const struct xattr_handler *handler,
50 const void *value, size_t size, int flags, int type) 51 struct dentry *dentry, const char *name,
52 const void *value, size_t size, int flags)
51{ 53{
52 int retval; 54 int retval;
53 char *full_name; 55 char *full_name;
diff --git a/fs/9p/xattr_trusted.c b/fs/9p/xattr_trusted.c
index e30d33b8a3fb..b888a4eecd1a 100644
--- a/fs/9p/xattr_trusted.c
+++ b/fs/9p/xattr_trusted.c
@@ -19,8 +19,9 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "xattr.h" 20#include "xattr.h"
21 21
22static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name, 22static int v9fs_xattr_trusted_get(const struct xattr_handler *handler,
23 void *buffer, size_t size, int type) 23 struct dentry *dentry, const char *name,
24 void *buffer, size_t size)
24{ 25{
25 int retval; 26 int retval;
26 char *full_name; 27 char *full_name;
@@ -46,8 +47,9 @@ static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name,
46 return retval; 47 return retval;
47} 48}
48 49
49static int v9fs_xattr_trusted_set(struct dentry *dentry, const char *name, 50static int v9fs_xattr_trusted_set(const struct xattr_handler *handler,
50 const void *value, size_t size, int flags, int type) 51 struct dentry *dentry, const char *name,
52 const void *value, size_t size, int flags)
51{ 53{
52 int retval; 54 int retval;
53 char *full_name; 55 char *full_name;
diff --git a/fs/9p/xattr_user.c b/fs/9p/xattr_user.c
index d0b701b72080..06f136cbe264 100644
--- a/fs/9p/xattr_user.c
+++ b/fs/9p/xattr_user.c
@@ -19,8 +19,9 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include "xattr.h" 20#include "xattr.h"
21 21
22static int v9fs_xattr_user_get(struct dentry *dentry, const char *name, 22static int v9fs_xattr_user_get(const struct xattr_handler *handler,
23 void *buffer, size_t size, int type) 23 struct dentry *dentry, const char *name,
24 void *buffer, size_t size)
24{ 25{
25 int retval; 26 int retval;
26 char *full_name; 27 char *full_name;
@@ -46,8 +47,9 @@ static int v9fs_xattr_user_get(struct dentry *dentry, const char *name,
46 return retval; 47 return retval;
47} 48}
48 49
49static int v9fs_xattr_user_set(struct dentry *dentry, const char *name, 50static int v9fs_xattr_user_set(const struct xattr_handler *handler,
50 const void *value, size_t size, int flags, int type) 51 struct dentry *dentry, const char *name,
52 const void *value, size_t size, int flags)
51{ 53{
52 int retval; 54 int retval;
53 char *full_name; 55 char *full_name;
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 0b6bfd3a398b..fa70848afa8f 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -293,10 +293,9 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
293 ext2_xattr_handler(entry->e_name_index); 293 ext2_xattr_handler(entry->e_name_index);
294 294
295 if (handler) { 295 if (handler) {
296 size_t size = handler->list(dentry, buffer, rest, 296 size_t size = handler->list(handler, dentry, buffer,
297 entry->e_name, 297 rest, entry->e_name,
298 entry->e_name_len, 298 entry->e_name_len);
299 handler->flags);
300 if (buffer) { 299 if (buffer) {
301 if (size > rest) { 300 if (size > rest) {
302 error = -ERANGE; 301 error = -ERANGE;
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c
index 702fc6840246..dfb08750370d 100644
--- a/fs/ext2/xattr_security.c
+++ b/fs/ext2/xattr_security.c
@@ -8,8 +8,9 @@
8#include "xattr.h" 8#include "xattr.h"
9 9
10static size_t 10static size_t
11ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, 11ext2_xattr_security_list(const struct xattr_handler *handler,
12 const char *name, size_t name_len, int type) 12 struct dentry *dentry, char *list, size_t list_size,
13 const char *name, size_t name_len)
13{ 14{
14 const int prefix_len = XATTR_SECURITY_PREFIX_LEN; 15 const int prefix_len = XATTR_SECURITY_PREFIX_LEN;
15 const size_t total_len = prefix_len + name_len + 1; 16 const size_t total_len = prefix_len + name_len + 1;
@@ -23,8 +24,9 @@ ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
23} 24}
24 25
25static int 26static int
26ext2_xattr_security_get(struct dentry *dentry, const char *name, 27ext2_xattr_security_get(const struct xattr_handler *handler,
27 void *buffer, size_t size, int type) 28 struct dentry *dentry, const char *name,
29 void *buffer, size_t size)
28{ 30{
29 if (strcmp(name, "") == 0) 31 if (strcmp(name, "") == 0)
30 return -EINVAL; 32 return -EINVAL;
@@ -33,8 +35,9 @@ ext2_xattr_security_get(struct dentry *dentry, const char *name,
33} 35}
34 36
35static int 37static int
36ext2_xattr_security_set(struct dentry *dentry, const char *name, 38ext2_xattr_security_set(const struct xattr_handler *handler,
37 const void *value, size_t size, int flags, int type) 39 struct dentry *dentry, const char *name,
40 const void *value, size_t size, int flags)
38{ 41{
39 if (strcmp(name, "") == 0) 42 if (strcmp(name, "") == 0)
40 return -EINVAL; 43 return -EINVAL;
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c
index 42b6e9874bcc..3150dd3a7859 100644
--- a/fs/ext2/xattr_trusted.c
+++ b/fs/ext2/xattr_trusted.c
@@ -9,8 +9,9 @@
9#include "xattr.h" 9#include "xattr.h"
10 10
11static size_t 11static size_t
12ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, 12ext2_xattr_trusted_list(const struct xattr_handler *handler,
13 const char *name, size_t name_len, int type) 13 struct dentry *dentry, char *list, size_t list_size,
14 const char *name, size_t name_len)
14{ 15{
15 const int prefix_len = XATTR_TRUSTED_PREFIX_LEN; 16 const int prefix_len = XATTR_TRUSTED_PREFIX_LEN;
16 const size_t total_len = prefix_len + name_len + 1; 17 const size_t total_len = prefix_len + name_len + 1;
@@ -27,8 +28,9 @@ ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
27} 28}
28 29
29static int 30static int
30ext2_xattr_trusted_get(struct dentry *dentry, const char *name, 31ext2_xattr_trusted_get(const struct xattr_handler *handler,
31 void *buffer, size_t size, int type) 32 struct dentry *dentry, const char *name,
33 void *buffer, size_t size)
32{ 34{
33 if (strcmp(name, "") == 0) 35 if (strcmp(name, "") == 0)
34 return -EINVAL; 36 return -EINVAL;
@@ -37,8 +39,9 @@ ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
37} 39}
38 40
39static int 41static int
40ext2_xattr_trusted_set(struct dentry *dentry, const char *name, 42ext2_xattr_trusted_set(const struct xattr_handler *handler,
41 const void *value, size_t size, int flags, int type) 43 struct dentry *dentry, const char *name,
44 const void *value, size_t size, int flags)
42{ 45{
43 if (strcmp(name, "") == 0) 46 if (strcmp(name, "") == 0)
44 return -EINVAL; 47 return -EINVAL;
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c
index ecdc4605192c..339a49bbb8ef 100644
--- a/fs/ext2/xattr_user.c
+++ b/fs/ext2/xattr_user.c
@@ -11,8 +11,9 @@
11#include "xattr.h" 11#include "xattr.h"
12 12
13static size_t 13static size_t
14ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, 14ext2_xattr_user_list(const struct xattr_handler *handler,
15 const char *name, size_t name_len, int type) 15 struct dentry *dentry, char *list, size_t list_size,
16 const char *name, size_t name_len)
16{ 17{
17 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 18 const size_t prefix_len = XATTR_USER_PREFIX_LEN;
18 const size_t total_len = prefix_len + name_len + 1; 19 const size_t total_len = prefix_len + name_len + 1;
@@ -29,8 +30,9 @@ ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
29} 30}
30 31
31static int 32static int
32ext2_xattr_user_get(struct dentry *dentry, const char *name, 33ext2_xattr_user_get(const struct xattr_handler *handler,
33 void *buffer, size_t size, int type) 34 struct dentry *dentry, const char *name,
35 void *buffer, size_t size)
34{ 36{
35 if (strcmp(name, "") == 0) 37 if (strcmp(name, "") == 0)
36 return -EINVAL; 38 return -EINVAL;
@@ -41,8 +43,9 @@ ext2_xattr_user_get(struct dentry *dentry, const char *name,
41} 43}
42 44
43static int 45static int
44ext2_xattr_user_set(struct dentry *dentry, const char *name, 46ext2_xattr_user_set(const struct xattr_handler *handler,
45 const void *value, size_t size, int flags, int type) 47 struct dentry *dentry, const char *name,
48 const void *value, size_t size, int flags)
46{ 49{
47 if (strcmp(name, "") == 0) 50 if (strcmp(name, "") == 0)
48 return -EINVAL; 51 return -EINVAL;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 984448c6f5f0..6b6b3e751f8c 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -405,10 +405,9 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
405 ext4_xattr_handler(entry->e_name_index); 405 ext4_xattr_handler(entry->e_name_index);
406 406
407 if (handler) { 407 if (handler) {
408 size_t size = handler->list(dentry, buffer, rest, 408 size_t size = handler->list(handler, dentry, buffer,
409 entry->e_name, 409 rest, entry->e_name,
410 entry->e_name_len, 410 entry->e_name_len);
411 handler->flags);
412 if (buffer) { 411 if (buffer) {
413 if (size > rest) 412 if (size > rest)
414 return -ERANGE; 413 return -ERANGE;
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c
index 95d90e0560f0..36f4c1a84c21 100644
--- a/fs/ext4/xattr_security.c
+++ b/fs/ext4/xattr_security.c
@@ -12,8 +12,9 @@
12#include "xattr.h" 12#include "xattr.h"
13 13
14static size_t 14static size_t
15ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, 15ext4_xattr_security_list(const struct xattr_handler *handler,
16 const char *name, size_t name_len, int type) 16 struct dentry *dentry, char *list, size_t list_size,
17 const char *name, size_t name_len)
17{ 18{
18 const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1; 19 const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
19 const size_t total_len = prefix_len + name_len + 1; 20 const size_t total_len = prefix_len + name_len + 1;
@@ -28,8 +29,9 @@ ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
28} 29}
29 30
30static int 31static int
31ext4_xattr_security_get(struct dentry *dentry, const char *name, 32ext4_xattr_security_get(const struct xattr_handler *handler,
32 void *buffer, size_t size, int type) 33 struct dentry *dentry, const char *name,
34 void *buffer, size_t size)
33{ 35{
34 if (strcmp(name, "") == 0) 36 if (strcmp(name, "") == 0)
35 return -EINVAL; 37 return -EINVAL;
@@ -38,8 +40,9 @@ ext4_xattr_security_get(struct dentry *dentry, const char *name,
38} 40}
39 41
40static int 42static int
41ext4_xattr_security_set(struct dentry *dentry, const char *name, 43ext4_xattr_security_set(const struct xattr_handler *handler,
42 const void *value, size_t size, int flags, int type) 44 struct dentry *dentry, const char *name,
45 const void *value, size_t size, int flags)
43{ 46{
44 if (strcmp(name, "") == 0) 47 if (strcmp(name, "") == 0)
45 return -EINVAL; 48 return -EINVAL;
diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c
index 891ee2ddfbd6..488089053342 100644
--- a/fs/ext4/xattr_trusted.c
+++ b/fs/ext4/xattr_trusted.c
@@ -13,8 +13,9 @@
13#include "xattr.h" 13#include "xattr.h"
14 14
15static size_t 15static size_t
16ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, 16ext4_xattr_trusted_list(const struct xattr_handler *handler,
17 const char *name, size_t name_len, int type) 17 struct dentry *dentry, char *list, size_t list_size,
18 const char *name, size_t name_len)
18{ 19{
19 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; 20 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
20 const size_t total_len = prefix_len + name_len + 1; 21 const size_t total_len = prefix_len + name_len + 1;
@@ -31,8 +32,9 @@ ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
31} 32}
32 33
33static int 34static int
34ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer, 35ext4_xattr_trusted_get(const struct xattr_handler *handler,
35 size_t size, int type) 36 struct dentry *dentry, const char *name, void *buffer,
37 size_t size)
36{ 38{
37 if (strcmp(name, "") == 0) 39 if (strcmp(name, "") == 0)
38 return -EINVAL; 40 return -EINVAL;
@@ -41,8 +43,9 @@ ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer,
41} 43}
42 44
43static int 45static int
44ext4_xattr_trusted_set(struct dentry *dentry, const char *name, 46ext4_xattr_trusted_set(const struct xattr_handler *handler,
45 const void *value, size_t size, int flags, int type) 47 struct dentry *dentry, const char *name,
48 const void *value, size_t size, int flags)
46{ 49{
47 if (strcmp(name, "") == 0) 50 if (strcmp(name, "") == 0)
48 return -EINVAL; 51 return -EINVAL;
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c
index 6ed932b3c043..d2dec3364062 100644
--- a/fs/ext4/xattr_user.c
+++ b/fs/ext4/xattr_user.c
@@ -12,8 +12,9 @@
12#include "xattr.h" 12#include "xattr.h"
13 13
14static size_t 14static size_t
15ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, 15ext4_xattr_user_list(const struct xattr_handler *handler,
16 const char *name, size_t name_len, int type) 16 struct dentry *dentry, char *list, size_t list_size,
17 const char *name, size_t name_len)
17{ 18{
18 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 19 const size_t prefix_len = XATTR_USER_PREFIX_LEN;
19 const size_t total_len = prefix_len + name_len + 1; 20 const size_t total_len = prefix_len + name_len + 1;
@@ -30,8 +31,9 @@ ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
30} 31}
31 32
32static int 33static int
33ext4_xattr_user_get(struct dentry *dentry, const char *name, 34ext4_xattr_user_get(const struct xattr_handler *handler,
34 void *buffer, size_t size, int type) 35 struct dentry *dentry, const char *name,
36 void *buffer, size_t size)
35{ 37{
36 if (strcmp(name, "") == 0) 38 if (strcmp(name, "") == 0)
37 return -EINVAL; 39 return -EINVAL;
@@ -42,8 +44,9 @@ ext4_xattr_user_get(struct dentry *dentry, const char *name,
42} 44}
43 45
44static int 46static int
45ext4_xattr_user_set(struct dentry *dentry, const char *name, 47ext4_xattr_user_set(const struct xattr_handler *handler,
46 const void *value, size_t size, int flags, int type) 48 struct dentry *dentry, const char *name,
49 const void *value, size_t size, int flags)
47{ 50{
48 if (strcmp(name, "") == 0) 51 if (strcmp(name, "") == 0)
49 return -EINVAL; 52 return -EINVAL;
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 4de2286c0e4d..e64317363deb 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -25,14 +25,15 @@
25#include "f2fs.h" 25#include "f2fs.h"
26#include "xattr.h" 26#include "xattr.h"
27 27
28static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list, 28static size_t f2fs_xattr_generic_list(const struct xattr_handler *handler,
29 size_t list_size, const char *name, size_t len, int type) 29 struct dentry *dentry, char *list, size_t list_size,
30 const char *name, size_t len)
30{ 31{
31 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 32 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
32 int total_len, prefix_len = 0; 33 int total_len, prefix_len = 0;
33 const char *prefix = NULL; 34 const char *prefix = NULL;
34 35
35 switch (type) { 36 switch (handler->flags) {
36 case F2FS_XATTR_INDEX_USER: 37 case F2FS_XATTR_INDEX_USER:
37 if (!test_opt(sbi, XATTR_USER)) 38 if (!test_opt(sbi, XATTR_USER))
38 return -EOPNOTSUPP; 39 return -EOPNOTSUPP;
@@ -62,12 +63,13 @@ static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,
62 return total_len; 63 return total_len;
63} 64}
64 65
65static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, 66static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
66 void *buffer, size_t size, int type) 67 struct dentry *dentry, const char *name, void *buffer,
68 size_t size)
67{ 69{
68 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 70 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
69 71
70 switch (type) { 72 switch (handler->flags) {
71 case F2FS_XATTR_INDEX_USER: 73 case F2FS_XATTR_INDEX_USER:
72 if (!test_opt(sbi, XATTR_USER)) 74 if (!test_opt(sbi, XATTR_USER))
73 return -EOPNOTSUPP; 75 return -EOPNOTSUPP;
@@ -83,15 +85,17 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
83 } 85 }
84 if (strcmp(name, "") == 0) 86 if (strcmp(name, "") == 0)
85 return -EINVAL; 87 return -EINVAL;
86 return f2fs_getxattr(d_inode(dentry), type, name, buffer, size, NULL); 88 return f2fs_getxattr(d_inode(dentry), handler->flags, name,
89 buffer, size, NULL);
87} 90}
88 91
89static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, 92static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
90 const void *value, size_t size, int flags, int type) 93 struct dentry *dentry, const char *name, const void *value,
94 size_t size, int flags)
91{ 95{
92 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 96 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
93 97
94 switch (type) { 98 switch (handler->flags) {
95 case F2FS_XATTR_INDEX_USER: 99 case F2FS_XATTR_INDEX_USER:
96 if (!test_opt(sbi, XATTR_USER)) 100 if (!test_opt(sbi, XATTR_USER))
97 return -EOPNOTSUPP; 101 return -EOPNOTSUPP;
@@ -108,17 +112,18 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
108 if (strcmp(name, "") == 0) 112 if (strcmp(name, "") == 0)
109 return -EINVAL; 113 return -EINVAL;
110 114
111 return f2fs_setxattr(d_inode(dentry), type, name, 115 return f2fs_setxattr(d_inode(dentry), handler->flags, name,
112 value, size, NULL, flags); 116 value, size, NULL, flags);
113} 117}
114 118
115static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list, 119static size_t f2fs_xattr_advise_list(const struct xattr_handler *handler,
116 size_t list_size, const char *name, size_t len, int type) 120 struct dentry *dentry, char *list, size_t list_size,
121 const char *name, size_t len)
117{ 122{
118 const char *xname = F2FS_SYSTEM_ADVISE_PREFIX; 123 const char *xname = F2FS_SYSTEM_ADVISE_PREFIX;
119 size_t size; 124 size_t size;
120 125
121 if (type != F2FS_XATTR_INDEX_ADVISE) 126 if (handler->flags != F2FS_XATTR_INDEX_ADVISE)
122 return 0; 127 return 0;
123 128
124 size = strlen(xname) + 1; 129 size = strlen(xname) + 1;
@@ -127,8 +132,9 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
127 return size; 132 return size;
128} 133}
129 134
130static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, 135static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
131 void *buffer, size_t size, int type) 136 struct dentry *dentry, const char *name, void *buffer,
137 size_t size)
132{ 138{
133 struct inode *inode = d_inode(dentry); 139 struct inode *inode = d_inode(dentry);
134 140
@@ -140,8 +146,9 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
140 return sizeof(char); 146 return sizeof(char);
141} 147}
142 148
143static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, 149static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
144 const void *value, size_t size, int flags, int type) 150 struct dentry *dentry, const char *name, const void *value,
151 size_t size, int flags)
145{ 152{
146 struct inode *inode = d_inode(dentry); 153 struct inode *inode = d_inode(dentry);
147 154
@@ -462,8 +469,8 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
462 if (!handler) 469 if (!handler)
463 continue; 470 continue;
464 471
465 size = handler->list(dentry, buffer, rest, entry->e_name, 472 size = handler->list(handler, dentry, buffer, rest,
466 entry->e_name_len, handler->flags); 473 entry->e_name, entry->e_name_len);
467 if (buffer && size > rest) { 474 if (buffer && size > rest) {
468 error = -ERANGE; 475 error = -ERANGE;
469 goto cleanup; 476 goto cleanup;
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 4c096fa9e2a1..53ce76a374fe 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -583,11 +583,13 @@ out:
583 * 583 *
584 * Returns: actual size of data on success, -errno on error 584 * Returns: actual size of data on success, -errno on error
585 */ 585 */
586static int gfs2_xattr_get(struct dentry *dentry, const char *name, 586static int gfs2_xattr_get(const struct xattr_handler *handler,
587 void *buffer, size_t size, int type) 587 struct dentry *dentry, const char *name,
588 void *buffer, size_t size)
588{ 589{
589 struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); 590 struct gfs2_inode *ip = GFS2_I(d_inode(dentry));
590 struct gfs2_ea_location el; 591 struct gfs2_ea_location el;
592 int type = handler->flags;
591 int error; 593 int error;
592 594
593 if (!ip->i_eattr) 595 if (!ip->i_eattr)
@@ -1227,11 +1229,12 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
1227 return error; 1229 return error;
1228} 1230}
1229 1231
1230static int gfs2_xattr_set(struct dentry *dentry, const char *name, 1232static int gfs2_xattr_set(const struct xattr_handler *handler,
1231 const void *value, size_t size, int flags, int type) 1233 struct dentry *dentry, const char *name,
1234 const void *value, size_t size, int flags)
1232{ 1235{
1233 return __gfs2_xattr_set(d_inode(dentry), name, value, 1236 return __gfs2_xattr_set(d_inode(dentry), name, value,
1234 size, flags, type); 1237 size, flags, handler->flags);
1235} 1238}
1236 1239
1237 1240
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index e8984990ee3b..e41a010cd89c 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -849,8 +849,9 @@ end_removexattr:
849 return err; 849 return err;
850} 850}
851 851
852static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, 852static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
853 void *buffer, size_t size, int type) 853 struct dentry *dentry, const char *name,
854 void *buffer, size_t size)
854{ 855{
855 if (!strcmp(name, "")) 856 if (!strcmp(name, ""))
856 return -EINVAL; 857 return -EINVAL;
@@ -871,8 +872,9 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
871 return __hfsplus_getxattr(d_inode(dentry), name, buffer, size); 872 return __hfsplus_getxattr(d_inode(dentry), name, buffer, size);
872} 873}
873 874
874static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, 875static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
875 const void *buffer, size_t size, int flags, int type) 876 struct dentry *dentry, const char *name,
877 const void *buffer, size_t size, int flags)
876{ 878{
877 if (!strcmp(name, "")) 879 if (!strcmp(name, ""))
878 return -EINVAL; 880 return -EINVAL;
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c
index 024e61cc5969..72a68a3a0c99 100644
--- a/fs/hfsplus/xattr_security.c
+++ b/fs/hfsplus/xattr_security.c
@@ -13,16 +13,18 @@
13#include "xattr.h" 13#include "xattr.h"
14#include "acl.h" 14#include "acl.h"
15 15
16static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, 16static int hfsplus_security_getxattr(const struct xattr_handler *handler,
17 void *buffer, size_t size, int type) 17 struct dentry *dentry, const char *name,
18 void *buffer, size_t size)
18{ 19{
19 return hfsplus_getxattr(dentry, name, buffer, size, 20 return hfsplus_getxattr(dentry, name, buffer, size,
20 XATTR_SECURITY_PREFIX, 21 XATTR_SECURITY_PREFIX,
21 XATTR_SECURITY_PREFIX_LEN); 22 XATTR_SECURITY_PREFIX_LEN);
22} 23}
23 24
24static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, 25static int hfsplus_security_setxattr(const struct xattr_handler *handler,
25 const void *buffer, size_t size, int flags, int type) 26 struct dentry *dentry, const char *name,
27 const void *buffer, size_t size, int flags)
26{ 28{
27 return hfsplus_setxattr(dentry, name, buffer, size, flags, 29 return hfsplus_setxattr(dentry, name, buffer, size, flags,
28 XATTR_SECURITY_PREFIX, 30 XATTR_SECURITY_PREFIX,
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c
index 61861573391b..95a7704c7abb 100644
--- a/fs/hfsplus/xattr_trusted.c
+++ b/fs/hfsplus/xattr_trusted.c
@@ -11,16 +11,18 @@
11#include "hfsplus_fs.h" 11#include "hfsplus_fs.h"
12#include "xattr.h" 12#include "xattr.h"
13 13
14static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, 14static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
15 void *buffer, size_t size, int type) 15 struct dentry *dentry, const char *name,
16 void *buffer, size_t size)
16{ 17{
17 return hfsplus_getxattr(dentry, name, buffer, size, 18 return hfsplus_getxattr(dentry, name, buffer, size,
18 XATTR_TRUSTED_PREFIX, 19 XATTR_TRUSTED_PREFIX,
19 XATTR_TRUSTED_PREFIX_LEN); 20 XATTR_TRUSTED_PREFIX_LEN);
20} 21}
21 22
22static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, 23static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
23 const void *buffer, size_t size, int flags, int type) 24 struct dentry *dentry, const char *name,
25 const void *buffer, size_t size, int flags)
24{ 26{
25 return hfsplus_setxattr(dentry, name, buffer, size, flags, 27 return hfsplus_setxattr(dentry, name, buffer, size, flags,
26 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); 28 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c
index 3b4caba0b39d..6fc269baf959 100644
--- a/fs/hfsplus/xattr_user.c
+++ b/fs/hfsplus/xattr_user.c
@@ -11,16 +11,18 @@
11#include "hfsplus_fs.h" 11#include "hfsplus_fs.h"
12#include "xattr.h" 12#include "xattr.h"
13 13
14static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, 14static int hfsplus_user_getxattr(const struct xattr_handler *handler,
15 void *buffer, size_t size, int type) 15 struct dentry *dentry, const char *name,
16 void *buffer, size_t size)
16{ 17{
17 18
18 return hfsplus_getxattr(dentry, name, buffer, size, 19 return hfsplus_getxattr(dentry, name, buffer, size,
19 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 20 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
20} 21}
21 22
22static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, 23static int hfsplus_user_setxattr(const struct xattr_handler *handler,
23 const void *buffer, size_t size, int flags, int type) 24 struct dentry *dentry, const char *name,
25 const void *buffer, size_t size, int flags)
24{ 26{
25 return hfsplus_setxattr(dentry, name, buffer, size, flags, 27 return hfsplus_setxattr(dentry, name, buffer, size, flags,
26 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 28 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
diff --git a/fs/jffs2/security.c b/fs/jffs2/security.c
index d4b43fb7adb1..bf12fe5f83d7 100644
--- a/fs/jffs2/security.c
+++ b/fs/jffs2/security.c
@@ -48,8 +48,9 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,
48} 48}
49 49
50/* ---- XATTR Handler for "security.*" ----------------- */ 50/* ---- XATTR Handler for "security.*" ----------------- */
51static int jffs2_security_getxattr(struct dentry *dentry, const char *name, 51static int jffs2_security_getxattr(const struct xattr_handler *handler,
52 void *buffer, size_t size, int type) 52 struct dentry *dentry, const char *name,
53 void *buffer, size_t size)
53{ 54{
54 if (!strcmp(name, "")) 55 if (!strcmp(name, ""))
55 return -EINVAL; 56 return -EINVAL;
@@ -58,8 +59,9 @@ static int jffs2_security_getxattr(struct dentry *dentry, const char *name,
58 name, buffer, size); 59 name, buffer, size);
59} 60}
60 61
61static int jffs2_security_setxattr(struct dentry *dentry, const char *name, 62static int jffs2_security_setxattr(const struct xattr_handler *handler,
62 const void *buffer, size_t size, int flags, int type) 63 struct dentry *dentry, const char *name,
64 const void *buffer, size_t size, int flags)
63{ 65{
64 if (!strcmp(name, "")) 66 if (!strcmp(name, ""))
65 return -EINVAL; 67 return -EINVAL;
@@ -68,8 +70,10 @@ static int jffs2_security_setxattr(struct dentry *dentry, const char *name,
68 name, buffer, size, flags); 70 name, buffer, size, flags);
69} 71}
70 72
71static size_t jffs2_security_listxattr(struct dentry *dentry, char *list, 73static size_t jffs2_security_listxattr(const struct xattr_handler *handler,
72 size_t list_size, const char *name, size_t name_len, int type) 74 struct dentry *dentry, char *list,
75 size_t list_size, const char *name,
76 size_t name_len)
73{ 77{
74 size_t retlen = XATTR_SECURITY_PREFIX_LEN + name_len + 1; 78 size_t retlen = XATTR_SECURITY_PREFIX_LEN + name_len + 1;
75 79
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index f092fee5be50..4c2c03663533 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -1001,11 +1001,12 @@ ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
1001 if (!xhandle) 1001 if (!xhandle)
1002 continue; 1002 continue;
1003 if (buffer) { 1003 if (buffer) {
1004 rc = xhandle->list(dentry, buffer+len, size-len, 1004 rc = xhandle->list(xhandle, dentry, buffer + len,
1005 xd->xname, xd->name_len, xd->flags); 1005 size - len, xd->xname,
1006 xd->name_len);
1006 } else { 1007 } else {
1007 rc = xhandle->list(dentry, NULL, 0, xd->xname, 1008 rc = xhandle->list(xhandle, dentry, NULL, 0,
1008 xd->name_len, xd->flags); 1009 xd->xname, xd->name_len);
1009 } 1010 }
1010 if (rc < 0) 1011 if (rc < 0)
1011 goto out; 1012 goto out;
diff --git a/fs/jffs2/xattr_trusted.c b/fs/jffs2/xattr_trusted.c
index bbd20c16090e..a562da0d6a26 100644
--- a/fs/jffs2/xattr_trusted.c
+++ b/fs/jffs2/xattr_trusted.c
@@ -16,8 +16,9 @@
16#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
17#include "nodelist.h" 17#include "nodelist.h"
18 18
19static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, 19static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
20 void *buffer, size_t size, int type) 20 struct dentry *dentry, const char *name,
21 void *buffer, size_t size)
21{ 22{
22 if (!strcmp(name, "")) 23 if (!strcmp(name, ""))
23 return -EINVAL; 24 return -EINVAL;
@@ -25,8 +26,9 @@ static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name,
25 name, buffer, size); 26 name, buffer, size);
26} 27}
27 28
28static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name, 29static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
29 const void *buffer, size_t size, int flags, int type) 30 struct dentry *dentry, const char *name,
31 const void *buffer, size_t size, int flags)
30{ 32{
31 if (!strcmp(name, "")) 33 if (!strcmp(name, ""))
32 return -EINVAL; 34 return -EINVAL;
@@ -34,8 +36,10 @@ static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name,
34 name, buffer, size, flags); 36 name, buffer, size, flags);
35} 37}
36 38
37static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list, 39static size_t jffs2_trusted_listxattr(const struct xattr_handler *handler,
38 size_t list_size, const char *name, size_t name_len, int type) 40 struct dentry *dentry, char *list,
41 size_t list_size, const char *name,
42 size_t name_len)
39{ 43{
40 size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1; 44 size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1;
41 45
diff --git a/fs/jffs2/xattr_user.c b/fs/jffs2/xattr_user.c
index a71391eba514..cbc0472e59a8 100644
--- a/fs/jffs2/xattr_user.c
+++ b/fs/jffs2/xattr_user.c
@@ -16,8 +16,9 @@
16#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
17#include "nodelist.h" 17#include "nodelist.h"
18 18
19static int jffs2_user_getxattr(struct dentry *dentry, const char *name, 19static int jffs2_user_getxattr(const struct xattr_handler *handler,
20 void *buffer, size_t size, int type) 20 struct dentry *dentry, const char *name,
21 void *buffer, size_t size)
21{ 22{
22 if (!strcmp(name, "")) 23 if (!strcmp(name, ""))
23 return -EINVAL; 24 return -EINVAL;
@@ -25,8 +26,9 @@ static int jffs2_user_getxattr(struct dentry *dentry, const char *name,
25 name, buffer, size); 26 name, buffer, size);
26} 27}
27 28
28static int jffs2_user_setxattr(struct dentry *dentry, const char *name, 29static int jffs2_user_setxattr(const struct xattr_handler *handler,
29 const void *buffer, size_t size, int flags, int type) 30 struct dentry *dentry, const char *name,
31 const void *buffer, size_t size, int flags)
30{ 32{
31 if (!strcmp(name, "")) 33 if (!strcmp(name, ""))
32 return -EINVAL; 34 return -EINVAL;
@@ -34,8 +36,10 @@ static int jffs2_user_setxattr(struct dentry *dentry, const char *name,
34 name, buffer, size, flags); 36 name, buffer, size, flags);
35} 37}
36 38
37static size_t jffs2_user_listxattr(struct dentry *dentry, char *list, 39static size_t jffs2_user_listxattr(const struct xattr_handler *handler,
38 size_t list_size, const char *name, size_t name_len, int type) 40 struct dentry *dentry, char *list,
41 size_t list_size, const char *name,
42 size_t name_len)
39{ 43{
40 size_t retlen = XATTR_USER_PREFIX_LEN + name_len + 1; 44 size_t retlen = XATTR_USER_PREFIX_LEN + name_len + 1;
41 45
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0e5ff69455c7..ab84c4d15148 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6249,9 +6249,10 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
6249 6249
6250#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" 6250#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
6251 6251
6252static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key, 6252static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler,
6253 struct dentry *dentry, const char *key,
6253 const void *buf, size_t buflen, 6254 const void *buf, size_t buflen,
6254 int flags, int type) 6255 int flags)
6255{ 6256{
6256 if (strcmp(key, "") != 0) 6257 if (strcmp(key, "") != 0)
6257 return -EINVAL; 6258 return -EINVAL;
@@ -6259,8 +6260,9 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
6259 return nfs4_proc_set_acl(d_inode(dentry), buf, buflen); 6260 return nfs4_proc_set_acl(d_inode(dentry), buf, buflen);
6260} 6261}
6261 6262
6262static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, 6263static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
6263 void *buf, size_t buflen, int type) 6264 struct dentry *dentry, const char *key,
6265 void *buf, size_t buflen)
6264{ 6266{
6265 if (strcmp(key, "") != 0) 6267 if (strcmp(key, "") != 0)
6266 return -EINVAL; 6268 return -EINVAL;
@@ -6268,9 +6270,10 @@ static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key,
6268 return nfs4_proc_get_acl(d_inode(dentry), buf, buflen); 6270 return nfs4_proc_get_acl(d_inode(dentry), buf, buflen);
6269} 6271}
6270 6272
6271static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, 6273static size_t nfs4_xattr_list_nfs4_acl(const struct xattr_handler *handler,
6274 struct dentry *dentry, char *list,
6272 size_t list_len, const char *name, 6275 size_t list_len, const char *name,
6273 size_t name_len, int type) 6276 size_t name_len)
6274{ 6277{
6275 size_t len = sizeof(XATTR_NAME_NFSV4_ACL); 6278 size_t len = sizeof(XATTR_NAME_NFSV4_ACL);
6276 6279
@@ -6288,9 +6291,10 @@ static inline int nfs4_server_supports_labels(struct nfs_server *server)
6288 return server->caps & NFS_CAP_SECURITY_LABEL; 6291 return server->caps & NFS_CAP_SECURITY_LABEL;
6289} 6292}
6290 6293
6291static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key, 6294static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
6292 const void *buf, size_t buflen, 6295 struct dentry *dentry, const char *key,
6293 int flags, int type) 6296 const void *buf, size_t buflen,
6297 int flags)
6294{ 6298{
6295 if (security_ismaclabel(key)) 6299 if (security_ismaclabel(key))
6296 return nfs4_set_security_label(dentry, buf, buflen); 6300 return nfs4_set_security_label(dentry, buf, buflen);
@@ -6298,17 +6302,19 @@ static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key,
6298 return -EOPNOTSUPP; 6302 return -EOPNOTSUPP;
6299} 6303}
6300 6304
6301static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key, 6305static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler,
6302 void *buf, size_t buflen, int type) 6306 struct dentry *dentry, const char *key,
6307 void *buf, size_t buflen)
6303{ 6308{
6304 if (security_ismaclabel(key)) 6309 if (security_ismaclabel(key))
6305 return nfs4_get_security_label(d_inode(dentry), buf, buflen); 6310 return nfs4_get_security_label(d_inode(dentry), buf, buflen);
6306 return -EOPNOTSUPP; 6311 return -EOPNOTSUPP;
6307} 6312}
6308 6313
6309static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list, 6314static size_t nfs4_xattr_list_nfs4_label(const struct xattr_handler *handler,
6310 size_t list_len, const char *name, 6315 struct dentry *dentry, char *list,
6311 size_t name_len, int type) 6316 size_t list_len, const char *name,
6317 size_t name_len)
6312{ 6318{
6313 size_t len = 0; 6319 size_t len = 0;
6314 6320
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index ebfdea78659b..e9164f09841b 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -7229,9 +7229,10 @@ leave:
7229/* 7229/*
7230 * 'security' attributes support 7230 * 'security' attributes support
7231 */ 7231 */
7232static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list, 7232static size_t ocfs2_xattr_security_list(const struct xattr_handler *handler,
7233 struct dentry *dentry, char *list,
7233 size_t list_size, const char *name, 7234 size_t list_size, const char *name,
7234 size_t name_len, int type) 7235 size_t name_len)
7235{ 7236{
7236 const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; 7237 const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
7237 const size_t total_len = prefix_len + name_len + 1; 7238 const size_t total_len = prefix_len + name_len + 1;
@@ -7244,8 +7245,9 @@ static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
7244 return total_len; 7245 return total_len;
7245} 7246}
7246 7247
7247static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name, 7248static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
7248 void *buffer, size_t size, int type) 7249 struct dentry *dentry, const char *name,
7250 void *buffer, size_t size)
7249{ 7251{
7250 if (strcmp(name, "") == 0) 7252 if (strcmp(name, "") == 0)
7251 return -EINVAL; 7253 return -EINVAL;
@@ -7253,8 +7255,9 @@ static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
7253 name, buffer, size); 7255 name, buffer, size);
7254} 7256}
7255 7257
7256static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name, 7258static int ocfs2_xattr_security_set(const struct xattr_handler *handler,
7257 const void *value, size_t size, int flags, int type) 7259 struct dentry *dentry, const char *name,
7260 const void *value, size_t size, int flags)
7258{ 7261{
7259 if (strcmp(name, "") == 0) 7262 if (strcmp(name, "") == 0)
7260 return -EINVAL; 7263 return -EINVAL;
@@ -7319,9 +7322,10 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
7319/* 7322/*
7320 * 'trusted' attributes support 7323 * 'trusted' attributes support
7321 */ 7324 */
7322static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list, 7325static size_t ocfs2_xattr_trusted_list(const struct xattr_handler *handler,
7326 struct dentry *dentry, char *list,
7323 size_t list_size, const char *name, 7327 size_t list_size, const char *name,
7324 size_t name_len, int type) 7328 size_t name_len)
7325{ 7329{
7326 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; 7330 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
7327 const size_t total_len = prefix_len + name_len + 1; 7331 const size_t total_len = prefix_len + name_len + 1;
@@ -7337,8 +7341,9 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
7337 return total_len; 7341 return total_len;
7338} 7342}
7339 7343
7340static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name, 7344static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
7341 void *buffer, size_t size, int type) 7345 struct dentry *dentry, const char *name,
7346 void *buffer, size_t size)
7342{ 7347{
7343 if (strcmp(name, "") == 0) 7348 if (strcmp(name, "") == 0)
7344 return -EINVAL; 7349 return -EINVAL;
@@ -7346,8 +7351,9 @@ static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
7346 name, buffer, size); 7351 name, buffer, size);
7347} 7352}
7348 7353
7349static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name, 7354static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler,
7350 const void *value, size_t size, int flags, int type) 7355 struct dentry *dentry, const char *name,
7356 const void *value, size_t size, int flags)
7351{ 7357{
7352 if (strcmp(name, "") == 0) 7358 if (strcmp(name, "") == 0)
7353 return -EINVAL; 7359 return -EINVAL;
@@ -7366,9 +7372,10 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
7366/* 7372/*
7367 * 'user' attributes support 7373 * 'user' attributes support
7368 */ 7374 */
7369static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list, 7375static size_t ocfs2_xattr_user_list(const struct xattr_handler *handler,
7376 struct dentry *dentry, char *list,
7370 size_t list_size, const char *name, 7377 size_t list_size, const char *name,
7371 size_t name_len, int type) 7378 size_t name_len)
7372{ 7379{
7373 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 7380 const size_t prefix_len = XATTR_USER_PREFIX_LEN;
7374 const size_t total_len = prefix_len + name_len + 1; 7381 const size_t total_len = prefix_len + name_len + 1;
@@ -7385,8 +7392,9 @@ static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
7385 return total_len; 7392 return total_len;
7386} 7393}
7387 7394
7388static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name, 7395static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
7389 void *buffer, size_t size, int type) 7396 struct dentry *dentry, const char *name,
7397 void *buffer, size_t size)
7390{ 7398{
7391 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 7399 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
7392 7400
@@ -7398,8 +7406,9 @@ static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
7398 buffer, size); 7406 buffer, size);
7399} 7407}
7400 7408
7401static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name, 7409static int ocfs2_xattr_user_set(const struct xattr_handler *handler,
7402 const void *value, size_t size, int flags, int type) 7410 struct dentry *dentry, const char *name,
7411 const void *value, size_t size, int flags)
7403{ 7412{
7404 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 7413 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
7405 7414
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 2fdca614ded3..4adde1e2cbec 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -762,8 +762,9 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
762EXPORT_SYMBOL (posix_acl_to_xattr); 762EXPORT_SYMBOL (posix_acl_to_xattr);
763 763
764static int 764static int
765posix_acl_xattr_get(struct dentry *dentry, const char *name, 765posix_acl_xattr_get(const struct xattr_handler *handler,
766 void *value, size_t size, int type) 766 struct dentry *dentry, const char *name,
767 void *value, size_t size)
767{ 768{
768 struct posix_acl *acl; 769 struct posix_acl *acl;
769 int error; 770 int error;
@@ -775,7 +776,7 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
775 if (d_is_symlink(dentry)) 776 if (d_is_symlink(dentry))
776 return -EOPNOTSUPP; 777 return -EOPNOTSUPP;
777 778
778 acl = get_acl(d_backing_inode(dentry), type); 779 acl = get_acl(d_backing_inode(dentry), handler->flags);
779 if (IS_ERR(acl)) 780 if (IS_ERR(acl))
780 return PTR_ERR(acl); 781 return PTR_ERR(acl);
781 if (acl == NULL) 782 if (acl == NULL)
@@ -788,8 +789,9 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
788} 789}
789 790
790static int 791static int
791posix_acl_xattr_set(struct dentry *dentry, const char *name, 792posix_acl_xattr_set(const struct xattr_handler *handler,
792 const void *value, size_t size, int flags, int type) 793 struct dentry *dentry, const char *name,
794 const void *value, size_t size, int flags)
793{ 795{
794 struct inode *inode = d_backing_inode(dentry); 796 struct inode *inode = d_backing_inode(dentry);
795 struct posix_acl *acl = NULL; 797 struct posix_acl *acl = NULL;
@@ -802,7 +804,7 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
802 if (!inode->i_op->set_acl) 804 if (!inode->i_op->set_acl)
803 return -EOPNOTSUPP; 805 return -EOPNOTSUPP;
804 806
805 if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) 807 if (handler->flags == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
806 return value ? -EACCES : 0; 808 return value ? -EACCES : 0;
807 if (!inode_owner_or_capable(inode)) 809 if (!inode_owner_or_capable(inode))
808 return -EPERM; 810 return -EPERM;
@@ -819,27 +821,23 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
819 } 821 }
820 } 822 }
821 823
822 ret = inode->i_op->set_acl(inode, acl, type); 824 ret = inode->i_op->set_acl(inode, acl, handler->flags);
823out: 825out:
824 posix_acl_release(acl); 826 posix_acl_release(acl);
825 return ret; 827 return ret;
826} 828}
827 829
828static size_t 830static size_t
829posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size, 831posix_acl_xattr_list(const struct xattr_handler *handler,
830 const char *name, size_t name_len, int type) 832 struct dentry *dentry, char *list, size_t list_size,
833 const char *name, size_t name_len)
831{ 834{
832 const char *xname; 835 const char *xname = handler->prefix;
833 size_t size; 836 size_t size;
834 837
835 if (!IS_POSIXACL(d_backing_inode(dentry))) 838 if (!IS_POSIXACL(d_backing_inode(dentry)))
836 return 0; 839 return 0;
837 840
838 if (type == ACL_TYPE_ACCESS)
839 xname = POSIX_ACL_XATTR_ACCESS;
840 else
841 xname = POSIX_ACL_XATTR_DEFAULT;
842
843 size = strlen(xname) + 1; 841 size = strlen(xname) + 1;
844 if (list && size <= list_size) 842 if (list && size <= list_size)
845 memcpy(list, xname, size); 843 memcpy(list, xname, size);
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index e87f9b52bf06..66b26fdfff8d 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -778,7 +778,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
778 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) 778 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
779 return -EOPNOTSUPP; 779 return -EOPNOTSUPP;
780 780
781 return handler->get(dentry, name, buffer, size, handler->flags); 781 return handler->get(handler, dentry, name, buffer, size);
782} 782}
783 783
784/* 784/*
@@ -797,7 +797,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
797 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) 797 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
798 return -EOPNOTSUPP; 798 return -EOPNOTSUPP;
799 799
800 return handler->set(dentry, name, value, size, flags, handler->flags); 800 return handler->set(handler, dentry, name, value, size, flags);
801} 801}
802 802
803/* 803/*
@@ -814,7 +814,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name)
814 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) 814 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
815 return -EOPNOTSUPP; 815 return -EOPNOTSUPP;
816 816
817 return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags); 817 return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE);
818} 818}
819 819
820struct listxattr_buf { 820struct listxattr_buf {
@@ -842,14 +842,14 @@ static int listxattr_filler(struct dir_context *ctx, const char *name,
842 if (!handler) /* Unsupported xattr name */ 842 if (!handler) /* Unsupported xattr name */
843 return 0; 843 return 0;
844 if (b->buf) { 844 if (b->buf) {
845 size = handler->list(b->dentry, b->buf + b->pos, 845 size = handler->list(handler, b->dentry,
846 b->size, name, namelen, 846 b->buf + b->pos, b->size, name,
847 handler->flags); 847 namelen);
848 if (size > b->size) 848 if (size > b->size)
849 return -ERANGE; 849 return -ERANGE;
850 } else { 850 } else {
851 size = handler->list(b->dentry, NULL, 0, name, 851 size = handler->list(handler, b->dentry,
852 namelen, handler->flags); 852 NULL, 0, name, namelen);
853 } 853 }
854 854
855 b->pos += size; 855 b->pos += size;
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c
index 9a3b0616f283..ac659af431ae 100644
--- a/fs/reiserfs/xattr_security.c
+++ b/fs/reiserfs/xattr_security.c
@@ -9,8 +9,8 @@
9#include <linux/uaccess.h> 9#include <linux/uaccess.h>
10 10
11static int 11static int
12security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, 12security_get(const struct xattr_handler *handler, struct dentry *dentry,
13 int handler_flags) 13 const char *name, void *buffer, size_t size)
14{ 14{
15 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 15 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
16 return -EINVAL; 16 return -EINVAL;
@@ -22,8 +22,8 @@ security_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
22} 22}
23 23
24static int 24static int
25security_set(struct dentry *dentry, const char *name, const void *buffer, 25security_set(const struct xattr_handler *handler, struct dentry *dentry,
26 size_t size, int flags, int handler_flags) 26 const char *name, const void *buffer, size_t size, int flags)
27{ 27{
28 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 28 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
29 return -EINVAL; 29 return -EINVAL;
@@ -34,8 +34,9 @@ security_set(struct dentry *dentry, const char *name, const void *buffer,
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
37static size_t security_list(struct dentry *dentry, char *list, size_t list_len, 37static size_t security_list(const struct xattr_handler *handler,
38 const char *name, size_t namelen, int handler_flags) 38 struct dentry *dentry, char *list, size_t list_len,
39 const char *name, size_t namelen)
39{ 40{
40 const size_t len = namelen + 1; 41 const size_t len = namelen + 1;
41 42
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c
index e4f1343714e0..a338adf1b8b4 100644
--- a/fs/reiserfs/xattr_trusted.c
+++ b/fs/reiserfs/xattr_trusted.c
@@ -8,8 +8,8 @@
8#include <linux/uaccess.h> 8#include <linux/uaccess.h>
9 9
10static int 10static int
11trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size, 11trusted_get(const struct xattr_handler *handler, struct dentry *dentry,
12 int handler_flags) 12 const char *name, void *buffer, size_t size)
13{ 13{
14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
15 return -EINVAL; 15 return -EINVAL;
@@ -21,8 +21,8 @@ trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
21} 21}
22 22
23static int 23static int
24trusted_set(struct dentry *dentry, const char *name, const void *buffer, 24trusted_set(const struct xattr_handler *handler, struct dentry *dentry,
25 size_t size, int flags, int handler_flags) 25 const char *name, const void *buffer, size_t size, int flags)
26{ 26{
27 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 27 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
28 return -EINVAL; 28 return -EINVAL;
@@ -33,8 +33,9 @@ trusted_set(struct dentry *dentry, const char *name, const void *buffer,
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
36static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, 36static size_t trusted_list(const struct xattr_handler *handler,
37 const char *name, size_t name_len, int handler_flags) 37 struct dentry *dentry, char *list, size_t list_size,
38 const char *name, size_t name_len)
38{ 39{
39 const size_t len = name_len + 1; 40 const size_t len = name_len + 1;
40 41
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index d0b08d3e5689..39c9667191c5 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -7,8 +7,8 @@
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8 8
9static int 9static int
10user_get(struct dentry *dentry, const char *name, void *buffer, size_t size, 10user_get(const struct xattr_handler *handler, struct dentry *dentry,
11 int handler_flags) 11 const char *name, void *buffer, size_t size)
12{ 12{
13 13
14 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 14 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
@@ -19,8 +19,8 @@ user_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
19} 19}
20 20
21static int 21static int
22user_set(struct dentry *dentry, const char *name, const void *buffer, 22user_set(const struct xattr_handler *handler, struct dentry *dentry,
23 size_t size, int flags, int handler_flags) 23 const char *name, const void *buffer, size_t size, int flags)
24{ 24{
25 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 25 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
26 return -EINVAL; 26 return -EINVAL;
@@ -30,8 +30,9 @@ user_set(struct dentry *dentry, const char *name, const void *buffer,
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
33static size_t user_list(struct dentry *dentry, char *list, size_t list_size, 33static size_t user_list(const struct xattr_handler *handler,
34 const char *name, size_t name_len, int handler_flags) 34 struct dentry *dentry, char *list, size_t list_size,
35 const char *name, size_t name_len)
35{ 36{
36 const size_t len = name_len + 1; 37 const size_t len = name_len + 1;
37 38
diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c
index e5e0ddf5b143..4ae1e4ffd200 100644
--- a/fs/squashfs/xattr.c
+++ b/fs/squashfs/xattr.c
@@ -68,8 +68,8 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
68 name_size = le16_to_cpu(entry.size); 68 name_size = le16_to_cpu(entry.size);
69 handler = squashfs_xattr_handler(le16_to_cpu(entry.type)); 69 handler = squashfs_xattr_handler(le16_to_cpu(entry.type));
70 if (handler) 70 if (handler)
71 prefix_size = handler->list(d, buffer, rest, NULL, 71 prefix_size = handler->list(handler, d, buffer, rest,
72 name_size, handler->flags); 72 NULL, name_size);
73 if (prefix_size) { 73 if (prefix_size) {
74 if (buffer) { 74 if (buffer) {
75 if (prefix_size + name_size + 1 > rest) { 75 if (prefix_size + name_size + 1 > rest) {
@@ -215,16 +215,18 @@ failed:
215/* 215/*
216 * User namespace support 216 * User namespace support
217 */ 217 */
218static size_t squashfs_user_list(struct dentry *d, char *list, size_t list_size, 218static size_t squashfs_user_list(const struct xattr_handler *handler,
219 const char *name, size_t name_len, int type) 219 struct dentry *d, char *list, size_t list_size,
220 const char *name, size_t name_len)
220{ 221{
221 if (list && XATTR_USER_PREFIX_LEN <= list_size) 222 if (list && XATTR_USER_PREFIX_LEN <= list_size)
222 memcpy(list, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 223 memcpy(list, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
223 return XATTR_USER_PREFIX_LEN; 224 return XATTR_USER_PREFIX_LEN;
224} 225}
225 226
226static int squashfs_user_get(struct dentry *d, const char *name, void *buffer, 227static int squashfs_user_get(const struct xattr_handler *handler,
227 size_t size, int type) 228 struct dentry *d, const char *name, void *buffer,
229 size_t size)
228{ 230{
229 if (name[0] == '\0') 231 if (name[0] == '\0')
230 return -EINVAL; 232 return -EINVAL;
@@ -242,8 +244,10 @@ static const struct xattr_handler squashfs_xattr_user_handler = {
242/* 244/*
243 * Trusted namespace support 245 * Trusted namespace support
244 */ 246 */
245static size_t squashfs_trusted_list(struct dentry *d, char *list, 247static size_t squashfs_trusted_list(const struct xattr_handler *handler,
246 size_t list_size, const char *name, size_t name_len, int type) 248 struct dentry *d, char *list,
249 size_t list_size, const char *name,
250 size_t name_len)
247{ 251{
248 if (!capable(CAP_SYS_ADMIN)) 252 if (!capable(CAP_SYS_ADMIN))
249 return 0; 253 return 0;
@@ -253,8 +257,9 @@ static size_t squashfs_trusted_list(struct dentry *d, char *list,
253 return XATTR_TRUSTED_PREFIX_LEN; 257 return XATTR_TRUSTED_PREFIX_LEN;
254} 258}
255 259
256static int squashfs_trusted_get(struct dentry *d, const char *name, 260static int squashfs_trusted_get(const struct xattr_handler *handler,
257 void *buffer, size_t size, int type) 261 struct dentry *d, const char *name,
262 void *buffer, size_t size)
258{ 263{
259 if (name[0] == '\0') 264 if (name[0] == '\0')
260 return -EINVAL; 265 return -EINVAL;
@@ -272,16 +277,19 @@ static const struct xattr_handler squashfs_xattr_trusted_handler = {
272/* 277/*
273 * Security namespace support 278 * Security namespace support
274 */ 279 */
275static size_t squashfs_security_list(struct dentry *d, char *list, 280static size_t squashfs_security_list(const struct xattr_handler *handler,
276 size_t list_size, const char *name, size_t name_len, int type) 281 struct dentry *d, char *list,
282 size_t list_size, const char *name,
283 size_t name_len)
277{ 284{
278 if (list && XATTR_SECURITY_PREFIX_LEN <= list_size) 285 if (list && XATTR_SECURITY_PREFIX_LEN <= list_size)
279 memcpy(list, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN); 286 memcpy(list, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN);
280 return XATTR_SECURITY_PREFIX_LEN; 287 return XATTR_SECURITY_PREFIX_LEN;
281} 288}
282 289
283static int squashfs_security_get(struct dentry *d, const char *name, 290static int squashfs_security_get(const struct xattr_handler *handler,
284 void *buffer, size_t size, int type) 291 struct dentry *d, const char *name,
292 void *buffer, size_t size)
285{ 293{
286 if (name[0] == '\0') 294 if (name[0] == '\0')
287 return -EINVAL; 295 return -EINVAL;
diff --git a/fs/xattr.c b/fs/xattr.c
index 072fee1258dd..44377b6f6001 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -720,7 +720,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s
720 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 720 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
721 if (!handler) 721 if (!handler)
722 return -EOPNOTSUPP; 722 return -EOPNOTSUPP;
723 return handler->get(dentry, name, buffer, size, handler->flags); 723 return handler->get(handler, dentry, name, buffer, size);
724} 724}
725 725
726/* 726/*
@@ -735,15 +735,15 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
735 735
736 if (!buffer) { 736 if (!buffer) {
737 for_each_xattr_handler(handlers, handler) { 737 for_each_xattr_handler(handlers, handler) {
738 size += handler->list(dentry, NULL, 0, NULL, 0, 738 size += handler->list(handler, dentry, NULL, 0,
739 handler->flags); 739 NULL, 0);
740 } 740 }
741 } else { 741 } else {
742 char *buf = buffer; 742 char *buf = buffer;
743 743
744 for_each_xattr_handler(handlers, handler) { 744 for_each_xattr_handler(handlers, handler) {
745 size = handler->list(dentry, buf, buffer_size, 745 size = handler->list(handler, dentry, buf, buffer_size,
746 NULL, 0, handler->flags); 746 NULL, 0);
747 if (size > buffer_size) 747 if (size > buffer_size)
748 return -ERANGE; 748 return -ERANGE;
749 buf += size; 749 buf += size;
@@ -767,7 +767,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
767 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 767 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
768 if (!handler) 768 if (!handler)
769 return -EOPNOTSUPP; 769 return -EOPNOTSUPP;
770 return handler->set(dentry, name, value, size, flags, handler->flags); 770 return handler->set(handler, dentry, name, value, size, flags);
771} 771}
772 772
773/* 773/*
@@ -782,8 +782,7 @@ generic_removexattr(struct dentry *dentry, const char *name)
782 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 782 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
783 if (!handler) 783 if (!handler)
784 return -EOPNOTSUPP; 784 return -EOPNOTSUPP;
785 return handler->set(dentry, name, NULL, 0, 785 return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE);
786 XATTR_REPLACE, handler->flags);
787} 786}
788 787
789EXPORT_SYMBOL(generic_getxattr); 788EXPORT_SYMBOL(generic_getxattr);
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index c036815183cb..b1850e1489ef 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -32,9 +32,10 @@
32 32
33 33
34static int 34static int
35xfs_xattr_get(struct dentry *dentry, const char *name, 35xfs_xattr_get(const struct xattr_handler *handler, struct dentry *dentry,
36 void *value, size_t size, int xflags) 36 const char *name, void *value, size_t size)
37{ 37{
38 int xflags = handler->flags;
38 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 39 struct xfs_inode *ip = XFS_I(d_inode(dentry));
39 int error, asize = size; 40 int error, asize = size;
40 41
@@ -54,9 +55,10 @@ xfs_xattr_get(struct dentry *dentry, const char *name,
54} 55}
55 56
56static int 57static int
57xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, 58xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry,
58 size_t size, int flags, int xflags) 59 const char *name, const void *value, size_t size, int flags)
59{ 60{
61 int xflags = handler->flags;
60 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 62 struct xfs_inode *ip = XFS_I(d_inode(dentry));
61 63
62 if (strcmp(name, "") == 0) 64 if (strcmp(name, "") == 0)