xattr handlers: Pass handler to operations instead of flags
authorAndreas Gruenbacher <agruenba@redhat.com>
Sun, 4 Oct 2015 17:18:51 +0000 (19:18 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 14 Nov 2015 01:34:32 +0000 (20:34 -0500)
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>
32 files changed:
fs/9p/acl.c
fs/9p/xattr_security.c
fs/9p/xattr_trusted.c
fs/9p/xattr_user.c
fs/ext2/xattr.c
fs/ext2/xattr_security.c
fs/ext2/xattr_trusted.c
fs/ext2/xattr_user.c
fs/ext4/xattr.c
fs/ext4/xattr_security.c
fs/ext4/xattr_trusted.c
fs/ext4/xattr_user.c
fs/f2fs/xattr.c
fs/gfs2/xattr.c
fs/hfsplus/xattr.c
fs/hfsplus/xattr_security.c
fs/hfsplus/xattr_trusted.c
fs/hfsplus/xattr_user.c
fs/jffs2/security.c
fs/jffs2/xattr.c
fs/jffs2/xattr_trusted.c
fs/jffs2/xattr_user.c
fs/nfs/nfs4proc.c
fs/ocfs2/xattr.c
fs/posix_acl.c
fs/reiserfs/xattr.c
fs/reiserfs/xattr_security.c
fs/reiserfs/xattr_trusted.c
fs/reiserfs/xattr_user.c
fs/squashfs/xattr.c
fs/xattr.c
fs/xfs/xfs_xattr.c

index 31c010372660154f6665782e89cea669b8457d29..e6fe824620439e1717547d32499f8ec06b725e31 100644 (file)
@@ -230,11 +230,13 @@ static int v9fs_remote_get_acl(struct dentry *dentry, const char *name,
        return v9fs_xattr_get(dentry, full_name, buffer, size);
 }
 
-static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name,
-                             void *buffer, size_t size, int type)
+static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
+                             struct dentry *dentry, const char *name,
+                             void *buffer, size_t size)
 {
        struct v9fs_session_info *v9ses;
        struct posix_acl *acl;
+       int type = handler->flags;
        int error;
 
        if (strcmp(name, "") != 0)
@@ -278,9 +280,9 @@ static int v9fs_remote_set_acl(struct dentry *dentry, const char *name,
 }
 
 
-static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
-                             const void *value, size_t size,
-                             int flags, int type)
+static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
+                             struct dentry *dentry, const char *name,
+                             const void *value, size_t size, int flags)
 {
        int retval;
        struct posix_acl *acl;
@@ -297,7 +299,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
         */
        if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
                return v9fs_remote_set_acl(dentry, name,
-                                          value, size, flags, type);
+                                          value, size, flags, handler->flags);
 
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
@@ -316,7 +318,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
        } else
                acl = NULL;
 
-       switch (type) {
+       switch (handler->flags) {
        case ACL_TYPE_ACCESS:
                name = POSIX_ACL_XATTR_ACCESS;
                if (acl) {
@@ -360,7 +362,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
        }
        retval = v9fs_xattr_set(dentry, name, value, size, flags);
        if (!retval)
-               set_cached_acl(inode, type, acl);
+               set_cached_acl(inode, handler->flags, acl);
 err_out:
        posix_acl_release(acl);
        return retval;
index cb247a142a6ecb9c553d55989bba43069e4ef457..c0a470add13c120c03a1760936e6bc199eb01140 100644 (file)
@@ -19,8 +19,9 @@
 #include <linux/slab.h>
 #include "xattr.h"
 
-static int v9fs_xattr_security_get(struct dentry *dentry, const char *name,
-                       void *buffer, size_t size, int type)
+static int v9fs_xattr_security_get(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       void *buffer, size_t size)
 {
        int retval;
        char *full_name;
@@ -46,8 +47,9 @@ static int v9fs_xattr_security_get(struct dentry *dentry, const char *name,
        return retval;
 }
 
-static int v9fs_xattr_security_set(struct dentry *dentry, const char *name,
-                       const void *value, size_t size, int flags, int type)
+static int v9fs_xattr_security_set(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       const void *value, size_t size, int flags)
 {
        int retval;
        char *full_name;
index e30d33b8a3fb29cbdbd9e00cd5fa46029e57bc59..b888a4eecd1ae5d2edd81e51ca8592b5bee45824 100644 (file)
@@ -19,8 +19,9 @@
 #include <linux/slab.h>
 #include "xattr.h"
 
-static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name,
-                       void *buffer, size_t size, int type)
+static int v9fs_xattr_trusted_get(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       void *buffer, size_t size)
 {
        int retval;
        char *full_name;
@@ -46,8 +47,9 @@ static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name,
        return retval;
 }
 
-static int v9fs_xattr_trusted_set(struct dentry *dentry, const char *name,
-                       const void *value, size_t size, int flags, int type)
+static int v9fs_xattr_trusted_set(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       const void *value, size_t size, int flags)
 {
        int retval;
        char *full_name;
index d0b701b720801f2ff739eedbe6556f0b43f1ea36..06f136cbe2645f0547ee757245cb581be96b6403 100644 (file)
@@ -19,8 +19,9 @@
 #include <linux/slab.h>
 #include "xattr.h"
 
-static int v9fs_xattr_user_get(struct dentry *dentry, const char *name,
-                       void *buffer, size_t size, int type)
+static int v9fs_xattr_user_get(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       void *buffer, size_t size)
 {
        int retval;
        char *full_name;
@@ -46,8 +47,9 @@ static int v9fs_xattr_user_get(struct dentry *dentry, const char *name,
        return retval;
 }
 
-static int v9fs_xattr_user_set(struct dentry *dentry, const char *name,
-                       const void *value, size_t size, int flags, int type)
+static int v9fs_xattr_user_set(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       const void *value, size_t size, int flags)
 {
        int retval;
        char *full_name;
index 0b6bfd3a398bd320cf8bbbbe81745f364decd765..fa70848afa8f4c403e988d058966db0b6af456b6 100644 (file)
@@ -293,10 +293,9 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
                        ext2_xattr_handler(entry->e_name_index);
 
                if (handler) {
-                       size_t size = handler->list(dentry, buffer, rest,
-                                                   entry->e_name,
-                                                   entry->e_name_len,
-                                                   handler->flags);
+                       size_t size = handler->list(handler, dentry, buffer,
+                                                   rest, entry->e_name,
+                                                   entry->e_name_len);
                        if (buffer) {
                                if (size > rest) {
                                        error = -ERANGE;
index 702fc6840246e7484e5cc3d4c553c9dd2fa5d37e..dfb08750370d85d71a7fc89bef68345229b7740d 100644 (file)
@@ -8,8 +8,9 @@
 #include "xattr.h"
 
 static size_t
-ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
-                        const char *name, size_t name_len, int type)
+ext2_xattr_security_list(const struct xattr_handler *handler,
+                        struct dentry *dentry, char *list, size_t list_size,
+                        const char *name, size_t name_len)
 {
        const int prefix_len = XATTR_SECURITY_PREFIX_LEN;
        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,
 }
 
 static int
-ext2_xattr_security_get(struct dentry *dentry, const char *name,
-                      void *buffer, size_t size, int type)
+ext2_xattr_security_get(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -33,8 +35,9 @@ ext2_xattr_security_get(struct dentry *dentry, const char *name,
 }
 
 static int
-ext2_xattr_security_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+ext2_xattr_security_set(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
index 42b6e9874bccf5501737ac53e62228ce22a6e3dd..3150dd3a78595084d0a6bfd5916f86272e68303a 100644 (file)
@@ -9,8 +9,9 @@
 #include "xattr.h"
 
 static size_t
-ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
-               const char *name, size_t name_len, int type)
+ext2_xattr_trusted_list(const struct xattr_handler *handler,
+                       struct dentry *dentry, char *list, size_t list_size,
+                       const char *name, size_t name_len)
 {
        const int prefix_len = XATTR_TRUSTED_PREFIX_LEN;
        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,
 }
 
 static int
-ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+ext2_xattr_trusted_get(const struct xattr_handler *handler,
+                      struct dentry *dentry, const char *name,
+                      void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -37,8 +39,9 @@ ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
 }
 
 static int
-ext2_xattr_trusted_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+ext2_xattr_trusted_set(const struct xattr_handler *handler,
+                      struct dentry *dentry, const char *name,
+                      const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
index ecdc4605192cef4d502e6633e5537b5d06117a45..339a49bbb8efbee752138fc600399c712d1b98a7 100644 (file)
@@ -11,8 +11,9 @@
 #include "xattr.h"
 
 static size_t
-ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
-               const char *name, size_t name_len, int type)
+ext2_xattr_user_list(const struct xattr_handler *handler,
+                    struct dentry *dentry, char *list, size_t list_size,
+                    const char *name, size_t name_len)
 {
        const size_t prefix_len = XATTR_USER_PREFIX_LEN;
        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,
 }
 
 static int
-ext2_xattr_user_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+ext2_xattr_user_get(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+                   void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -41,8 +43,9 @@ ext2_xattr_user_get(struct dentry *dentry, const char *name,
 }
 
 static int
-ext2_xattr_user_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+ext2_xattr_user_set(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+                   const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
index 984448c6f5f0af1d429a982cce28f7ab26b3b093..6b6b3e751f8c77ebc9089c412f9019b4774a4301 100644 (file)
@@ -405,10 +405,9 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
                        ext4_xattr_handler(entry->e_name_index);
 
                if (handler) {
-                       size_t size = handler->list(dentry, buffer, rest,
-                                                   entry->e_name,
-                                                   entry->e_name_len,
-                                                   handler->flags);
+                       size_t size = handler->list(handler, dentry, buffer,
+                                                   rest, entry->e_name,
+                                                   entry->e_name_len);
                        if (buffer) {
                                if (size > rest)
                                        return -ERANGE;
index 95d90e0560f05677279db254936a4fa086ad67d2..36f4c1a84c218307a1ae5c7e5c9805747025cf38 100644 (file)
@@ -12,8 +12,9 @@
 #include "xattr.h"
 
 static size_t
-ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
-               const char *name, size_t name_len, int type)
+ext4_xattr_security_list(const struct xattr_handler *handler,
+                        struct dentry *dentry, char *list, size_t list_size,
+                        const char *name, size_t name_len)
 {
        const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1;
        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,
 }
 
 static int
-ext4_xattr_security_get(struct dentry *dentry, const char *name,
-                      void *buffer, size_t size, int type)
+ext4_xattr_security_get(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -38,8 +40,9 @@ ext4_xattr_security_get(struct dentry *dentry, const char *name,
 }
 
 static int
-ext4_xattr_security_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+ext4_xattr_security_set(const struct xattr_handler *handler,
+                       struct dentry *dentry, const char *name,
+                       const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
index 891ee2ddfbd64a7b5f5201f6252edaafb3550b97..4880890533424ca63e67fc8ce0536254ce669028 100644 (file)
@@ -13,8 +13,9 @@
 #include "xattr.h"
 
 static size_t
-ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
-               const char *name, size_t name_len, int type)
+ext4_xattr_trusted_list(const struct xattr_handler *handler,
+                       struct dentry *dentry, char *list, size_t list_size,
+                       const char *name, size_t name_len)
 {
        const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
        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,
 }
 
 static int
-ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer,
-               size_t size, int type)
+ext4_xattr_trusted_get(const struct xattr_handler *handler,
+                      struct dentry *dentry, const char *name, void *buffer,
+                      size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -41,8 +43,9 @@ ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer,
 }
 
 static int
-ext4_xattr_trusted_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+ext4_xattr_trusted_set(const struct xattr_handler *handler,
+                      struct dentry *dentry, const char *name,
+                      const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
index 6ed932b3c04359b0817698ebcfcaf4a2d007b03f..d2dec33640620024aae408cdb394f4689d23dd87 100644 (file)
@@ -12,8 +12,9 @@
 #include "xattr.h"
 
 static size_t
-ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
-                    const char *name, size_t name_len, int type)
+ext4_xattr_user_list(const struct xattr_handler *handler,
+                    struct dentry *dentry, char *list, size_t list_size,
+                    const char *name, size_t name_len)
 {
        const size_t prefix_len = XATTR_USER_PREFIX_LEN;
        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,
 }
 
 static int
-ext4_xattr_user_get(struct dentry *dentry, const char *name,
-                   void *buffer, size_t size, int type)
+ext4_xattr_user_get(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+                   void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -42,8 +44,9 @@ ext4_xattr_user_get(struct dentry *dentry, const char *name,
 }
 
 static int
-ext4_xattr_user_set(struct dentry *dentry, const char *name,
-                   const void *value, size_t size, int flags, int type)
+ext4_xattr_user_set(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+                   const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
index 4de2286c0e4df6e226922b181e92929dc81bb7ca..e64317363debac7582db130db7c7d9d71094f7e9 100644 (file)
 #include "f2fs.h"
 #include "xattr.h"
 
-static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,
-               size_t list_size, const char *name, size_t len, int type)
+static size_t f2fs_xattr_generic_list(const struct xattr_handler *handler,
+               struct dentry *dentry, char *list, size_t list_size,
+               const char *name, size_t len)
 {
        struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
        int total_len, prefix_len = 0;
        const char *prefix = NULL;
 
-       switch (type) {
+       switch (handler->flags) {
        case F2FS_XATTR_INDEX_USER:
                if (!test_opt(sbi, XATTR_USER))
                        return -EOPNOTSUPP;
@@ -62,12 +63,13 @@ static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,
        return total_len;
 }
 
-static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
+               struct dentry *dentry, const char *name, void *buffer,
+               size_t size)
 {
        struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
 
-       switch (type) {
+       switch (handler->flags) {
        case F2FS_XATTR_INDEX_USER:
                if (!test_opt(sbi, XATTR_USER))
                        return -EOPNOTSUPP;
@@ -83,15 +85,17 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
        }
        if (strcmp(name, "") == 0)
                return -EINVAL;
-       return f2fs_getxattr(d_inode(dentry), type, name, buffer, size, NULL);
+       return f2fs_getxattr(d_inode(dentry), handler->flags, name,
+                            buffer, size, NULL);
 }
 
-static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
+               struct dentry *dentry, const char *name, const void *value,
+               size_t size, int flags)
 {
        struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
 
-       switch (type) {
+       switch (handler->flags) {
        case F2FS_XATTR_INDEX_USER:
                if (!test_opt(sbi, XATTR_USER))
                        return -EOPNOTSUPP;
@@ -108,17 +112,18 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
        if (strcmp(name, "") == 0)
                return -EINVAL;
 
-       return f2fs_setxattr(d_inode(dentry), type, name,
+       return f2fs_setxattr(d_inode(dentry), handler->flags, name,
                                        value, size, NULL, flags);
 }
 
-static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
-               size_t list_size, const char *name, size_t len, int type)
+static size_t f2fs_xattr_advise_list(const struct xattr_handler *handler,
+               struct dentry *dentry, char *list, size_t list_size,
+               const char *name, size_t len)
 {
        const char *xname = F2FS_SYSTEM_ADVISE_PREFIX;
        size_t size;
 
-       if (type != F2FS_XATTR_INDEX_ADVISE)
+       if (handler->flags != F2FS_XATTR_INDEX_ADVISE)
                return 0;
 
        size = strlen(xname) + 1;
@@ -127,8 +132,9 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
        return size;
 }
 
-static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
+               struct dentry *dentry, const char *name, void *buffer,
+               size_t size)
 {
        struct inode *inode = d_inode(dentry);
 
@@ -140,8 +146,9 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
        return sizeof(char);
 }
 
-static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
+               struct dentry *dentry, const char *name, const void *value,
+               size_t size, int flags)
 {
        struct inode *inode = d_inode(dentry);
 
@@ -462,8 +469,8 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
                if (!handler)
                        continue;
 
-               size = handler->list(dentry, buffer, rest, entry->e_name,
-                               entry->e_name_len, handler->flags);
+               size = handler->list(handler, dentry, buffer, rest,
+                                    entry->e_name, entry->e_name_len);
                if (buffer && size > rest) {
                        error = -ERANGE;
                        goto cleanup;
index 4c096fa9e2a18c4c52ef528c96198d9a08ef9b6a..53ce76a374fe7313314eafd274b8a58db81b52d0 100644 (file)
@@ -583,11 +583,13 @@ out:
  *
  * Returns: actual size of data on success, -errno on error
  */
-static int gfs2_xattr_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int gfs2_xattr_get(const struct xattr_handler *handler,
+                         struct dentry *dentry, const char *name,
+                         void *buffer, size_t size)
 {
        struct gfs2_inode *ip = GFS2_I(d_inode(dentry));
        struct gfs2_ea_location el;
+       int type = handler->flags;
        int error;
 
        if (!ip->i_eattr)
@@ -1227,11 +1229,12 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
        return error;
 }
 
-static int gfs2_xattr_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int gfs2_xattr_set(const struct xattr_handler *handler,
+                         struct dentry *dentry, const char *name,
+                         const void *value, size_t size, int flags)
 {
        return __gfs2_xattr_set(d_inode(dentry), name, value,
-                               size, flags, type);
+                               size, flags, handler->flags);
 }
 
 
index e8984990ee3b5d557b8b83c20822e2deca907a81..e41a010cd89ca6ca8e76dec51d2d8914782e1db6 100644 (file)
@@ -849,8 +849,9 @@ end_removexattr:
        return err;
 }
 
-static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
-                                       void *buffer, size_t size, int type)
+static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
+                               struct dentry *dentry, const char *name,
+                               void *buffer, size_t size)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -871,8 +872,9 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
        return __hfsplus_getxattr(d_inode(dentry), name, buffer, size);
 }
 
-static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
+                               struct dentry *dentry, const char *name,
+                               const void *buffer, size_t size, int flags)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
index 024e61cc5969d5d729c96ffdc07435d0f2063560..72a68a3a0c996e1ca73fb2ec462c30f19b56f247 100644 (file)
 #include "xattr.h"
 #include "acl.h"
 
-static int hfsplus_security_getxattr(struct dentry *dentry, const char *name,
-                                       void *buffer, size_t size, int type)
+static int hfsplus_security_getxattr(const struct xattr_handler *handler,
+                                    struct dentry *dentry, const char *name,
+                                    void *buffer, size_t size)
 {
        return hfsplus_getxattr(dentry, name, buffer, size,
                                XATTR_SECURITY_PREFIX,
                                XATTR_SECURITY_PREFIX_LEN);
 }
 
-static int hfsplus_security_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int hfsplus_security_setxattr(const struct xattr_handler *handler,
+                                    struct dentry *dentry, const char *name,
+                                    const void *buffer, size_t size, int flags)
 {
        return hfsplus_setxattr(dentry, name, buffer, size, flags,
                                XATTR_SECURITY_PREFIX,
index 61861573391b33eb89f99b90a8d7a1c6214cd5a1..95a7704c7abb7b82358d5516c366ead6091d4fda 100644 (file)
 #include "hfsplus_fs.h"
 #include "xattr.h"
 
-static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name,
-                                       void *buffer, size_t size, int type)
+static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
+                                   struct dentry *dentry, const char *name,
+                                   void *buffer, size_t size)
 {
        return hfsplus_getxattr(dentry, name, buffer, size,
                                XATTR_TRUSTED_PREFIX,
                                XATTR_TRUSTED_PREFIX_LEN);
 }
 
-static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
+                                   struct dentry *dentry, const char *name,
+                                   const void *buffer, size_t size, int flags)
 {
        return hfsplus_setxattr(dentry, name, buffer, size, flags,
                                XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
index 3b4caba0b39df376f0739d61e05a94ac58809d36..6fc269baf959a34bb9889b2be5c8a0711e895c94 100644 (file)
 #include "hfsplus_fs.h"
 #include "xattr.h"
 
-static int hfsplus_user_getxattr(struct dentry *dentry, const char *name,
-                                       void *buffer, size_t size, int type)
+static int hfsplus_user_getxattr(const struct xattr_handler *handler,
+                                struct dentry *dentry, const char *name,
+                                void *buffer, size_t size)
 {
 
        return hfsplus_getxattr(dentry, name, buffer, size,
                                XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
 }
 
-static int hfsplus_user_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int hfsplus_user_setxattr(const struct xattr_handler *handler,
+                                struct dentry *dentry, const char *name,
+                                const void *buffer, size_t size, int flags)
 {
        return hfsplus_setxattr(dentry, name, buffer, size, flags,
                                XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
index d4b43fb7adb18db678fc6bacf9cf9a0f3432af19..bf12fe5f83d7e66fa1cf34883539126f12cadfe0 100644 (file)
@@ -48,8 +48,9 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,
 }
 
 /* ---- XATTR Handler for "security.*" ----------------- */
-static int jffs2_security_getxattr(struct dentry *dentry, const char *name,
-                                  void *buffer, size_t size, int type)
+static int jffs2_security_getxattr(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *name,
+                                  void *buffer, size_t size)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -58,8 +59,9 @@ static int jffs2_security_getxattr(struct dentry *dentry, const char *name,
                                 name, buffer, size);
 }
 
-static int jffs2_security_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int jffs2_security_setxattr(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *name,
+                                  const void *buffer, size_t size, int flags)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -68,8 +70,10 @@ static int jffs2_security_setxattr(struct dentry *dentry, const char *name,
                                 name, buffer, size, flags);
 }
 
-static size_t jffs2_security_listxattr(struct dentry *dentry, char *list,
-               size_t list_size, const char *name, size_t name_len, int type)
+static size_t jffs2_security_listxattr(const struct xattr_handler *handler,
+                                      struct dentry *dentry, char *list,
+                                      size_t list_size, const char *name,
+                                      size_t name_len)
 {
        size_t retlen = XATTR_SECURITY_PREFIX_LEN + name_len + 1;
 
index f092fee5be50511f643e9fac79c03d393cef18f2..4c2c03663533dc2fbf1e0c24dc5b08dec6ea943f 100644 (file)
@@ -1001,11 +1001,12 @@ ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
                if (!xhandle)
                        continue;
                if (buffer) {
-                       rc = xhandle->list(dentry, buffer+len, size-len,
-                                          xd->xname, xd->name_len, xd->flags);
+                       rc = xhandle->list(xhandle, dentry, buffer + len,
+                                          size - len, xd->xname,
+                                          xd->name_len);
                } else {
-                       rc = xhandle->list(dentry, NULL, 0, xd->xname,
-                                          xd->name_len, xd->flags);
+                       rc = xhandle->list(xhandle, dentry, NULL, 0,
+                                          xd->xname, xd->name_len);
                }
                if (rc < 0)
                        goto out;
index bbd20c16090ee9074e4dfa71540a17f71f02bd2a..a562da0d6a26186dc2116d6b8a05795903a46897 100644 (file)
@@ -16,8 +16,9 @@
 #include <linux/mtd/mtd.h>
 #include "nodelist.h"
 
-static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
+                                 struct dentry *dentry, const char *name,
+                                 void *buffer, size_t size)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -25,8 +26,9 @@ static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name,
                                 name, buffer, size);
 }
 
-static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
+                                 struct dentry *dentry, const char *name,
+                                 const void *buffer, size_t size, int flags)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -34,8 +36,10 @@ static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name,
                                 name, buffer, size, flags);
 }
 
-static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list,
-               size_t list_size, const char *name, size_t name_len, int type)
+static size_t jffs2_trusted_listxattr(const struct xattr_handler *handler,
+                                     struct dentry *dentry, char *list,
+                                     size_t list_size, const char *name,
+                                     size_t name_len)
 {
        size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1;
 
index a71391eba51497bf7902f10ee44955e67b623e5e..cbc0472e59a8b01b81ea142f35d29c88c3a12c00 100644 (file)
@@ -16,8 +16,9 @@
 #include <linux/mtd/mtd.h>
 #include "nodelist.h"
 
-static int jffs2_user_getxattr(struct dentry *dentry, const char *name,
-                              void *buffer, size_t size, int type)
+static int jffs2_user_getxattr(const struct xattr_handler *handler,
+                              struct dentry *dentry, const char *name,
+                              void *buffer, size_t size)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -25,8 +26,9 @@ static int jffs2_user_getxattr(struct dentry *dentry, const char *name,
                                 name, buffer, size);
 }
 
-static int jffs2_user_setxattr(struct dentry *dentry, const char *name,
-               const void *buffer, size_t size, int flags, int type)
+static int jffs2_user_setxattr(const struct xattr_handler *handler,
+                              struct dentry *dentry, const char *name,
+                              const void *buffer, size_t size, int flags)
 {
        if (!strcmp(name, ""))
                return -EINVAL;
@@ -34,8 +36,10 @@ static int jffs2_user_setxattr(struct dentry *dentry, const char *name,
                                 name, buffer, size, flags);
 }
 
-static size_t jffs2_user_listxattr(struct dentry *dentry, char *list,
-               size_t list_size, const char *name, size_t name_len, int type)
+static size_t jffs2_user_listxattr(const struct xattr_handler *handler,
+                                  struct dentry *dentry, char *list,
+                                  size_t list_size, const char *name,
+                                  size_t name_len)
 {
        size_t retlen = XATTR_USER_PREFIX_LEN + name_len + 1;
 
index 0e5ff69455c7beba96df05104594bcb3dee336a7..ab84c4d151480e1824c68f0dfae8df39ae8875cb 100644 (file)
@@ -6249,9 +6249,10 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
 
 #define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
 
-static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
+static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *key,
                                   const void *buf, size_t buflen,
-                                  int flags, int type)
+                                  int flags)
 {
        if (strcmp(key, "") != 0)
                return -EINVAL;
@@ -6259,8 +6260,9 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
        return nfs4_proc_set_acl(d_inode(dentry), buf, buflen);
 }
 
-static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key,
-                                  void *buf, size_t buflen, int type)
+static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *key,
+                                  void *buf, size_t buflen)
 {
        if (strcmp(key, "") != 0)
                return -EINVAL;
@@ -6268,9 +6270,10 @@ static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key,
        return nfs4_proc_get_acl(d_inode(dentry), buf, buflen);
 }
 
-static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
+static size_t nfs4_xattr_list_nfs4_acl(const struct xattr_handler *handler,
+                                      struct dentry *dentry, char *list,
                                       size_t list_len, const char *name,
-                                      size_t name_len, int type)
+                                      size_t name_len)
 {
        size_t len = sizeof(XATTR_NAME_NFSV4_ACL);
 
@@ -6288,9 +6291,10 @@ static inline int nfs4_server_supports_labels(struct nfs_server *server)
        return server->caps & NFS_CAP_SECURITY_LABEL;
 }
 
-static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key,
-                                  const void *buf, size_t buflen,
-                                  int flags, int type)
+static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
+                                    struct dentry *dentry, const char *key,
+                                    const void *buf, size_t buflen,
+                                    int flags)
 {
        if (security_ismaclabel(key))
                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,
        return -EOPNOTSUPP;
 }
 
-static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key,
-                                  void *buf, size_t buflen, int type)
+static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler,
+                                    struct dentry *dentry, const char *key,
+                                    void *buf, size_t buflen)
 {
        if (security_ismaclabel(key))
                return nfs4_get_security_label(d_inode(dentry), buf, buflen);
        return -EOPNOTSUPP;
 }
 
-static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list,
-                                      size_t list_len, const char *name,
-                                      size_t name_len, int type)
+static size_t nfs4_xattr_list_nfs4_label(const struct xattr_handler *handler,
+                                        struct dentry *dentry, char *list,
+                                        size_t list_len, const char *name,
+                                        size_t name_len)
 {
        size_t len = 0;
 
index ebfdea78659b1bda5a93674837e8f818c2503d44..e9164f09841bfd6bc3f5baf439b91f8dfe5345f2 100644 (file)
@@ -7229,9 +7229,10 @@ leave:
 /*
  * 'security' attributes support
  */
-static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_security_list(const struct xattr_handler *handler,
+                                       struct dentry *dentry, char *list,
                                        size_t list_size, const char *name,
-                                       size_t name_len, int type)
+                                       size_t name_len)
 {
        const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
        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,
        return total_len;
 }
 
-static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
-                                   void *buffer, size_t size, int type)
+static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
+                                   struct dentry *dentry, const char *name,
+                                   void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7253,8 +7255,9 @@ static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
                               name, buffer, size);
 }
 
-static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int ocfs2_xattr_security_set(const struct xattr_handler *handler,
+                                   struct dentry *dentry, const char *name,
+                                   const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7319,9 +7322,10 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
 /*
  * 'trusted' attributes support
  */
-static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_trusted_list(const struct xattr_handler *handler,
+                                      struct dentry *dentry, char *list,
                                       size_t list_size, const char *name,
-                                      size_t name_len, int type)
+                                      size_t name_len)
 {
        const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
        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,
        return total_len;
 }
 
-static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *name,
+                                  void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7346,8 +7351,9 @@ static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
                               name, buffer, size);
 }
 
-static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *name,
+                                  const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7366,9 +7372,10 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
 /*
  * 'user' attributes support
  */
-static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_user_list(const struct xattr_handler *handler,
+                                   struct dentry *dentry, char *list,
                                    size_t list_size, const char *name,
-                                   size_t name_len, int type)
+                                   size_t name_len)
 {
        const size_t prefix_len = XATTR_USER_PREFIX_LEN;
        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,
        return total_len;
 }
 
-static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
+                               struct dentry *dentry, const char *name,
+                               void *buffer, size_t size)
 {
        struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
 
@@ -7398,8 +7406,9 @@ static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
                               buffer, size);
 }
 
-static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int ocfs2_xattr_user_set(const struct xattr_handler *handler,
+                               struct dentry *dentry, const char *name,
+                               const void *value, size_t size, int flags)
 {
        struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
 
index 2fdca614ded360fd4fccb3012133be7729940a70..4adde1e2cbece693ebab67527a555e3a33e6fbfa 100644 (file)
@@ -762,8 +762,9 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
 EXPORT_SYMBOL (posix_acl_to_xattr);
 
 static int
-posix_acl_xattr_get(struct dentry *dentry, const char *name,
-               void *value, size_t size, int type)
+posix_acl_xattr_get(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+                   void *value, size_t size)
 {
        struct posix_acl *acl;
        int error;
@@ -775,7 +776,7 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
        if (d_is_symlink(dentry))
                return -EOPNOTSUPP;
 
-       acl = get_acl(d_backing_inode(dentry), type);
+       acl = get_acl(d_backing_inode(dentry), handler->flags);
        if (IS_ERR(acl))
                return PTR_ERR(acl);
        if (acl == NULL)
@@ -788,8 +789,9 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
 }
 
 static int
-posix_acl_xattr_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+posix_acl_xattr_set(const struct xattr_handler *handler,
+                   struct dentry *dentry, const char *name,
+                   const void *value, size_t size, int flags)
 {
        struct inode *inode = d_backing_inode(dentry);
        struct posix_acl *acl = NULL;
@@ -802,7 +804,7 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
        if (!inode->i_op->set_acl)
                return -EOPNOTSUPP;
 
-       if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
+       if (handler->flags == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode))
                return value ? -EACCES : 0;
        if (!inode_owner_or_capable(inode))
                return -EPERM;
@@ -819,27 +821,23 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name,
                }
        }
 
-       ret = inode->i_op->set_acl(inode, acl, type);
+       ret = inode->i_op->set_acl(inode, acl, handler->flags);
 out:
        posix_acl_release(acl);
        return ret;
 }
 
 static size_t
-posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size,
-               const char *name, size_t name_len, int type)
+posix_acl_xattr_list(const struct xattr_handler *handler,
+                    struct dentry *dentry, char *list, size_t list_size,
+                    const char *name, size_t name_len)
 {
-       const char *xname;
+       const char *xname = handler->prefix;
        size_t size;
 
        if (!IS_POSIXACL(d_backing_inode(dentry)))
                return 0;
 
-       if (type == ACL_TYPE_ACCESS)
-               xname = POSIX_ACL_XATTR_ACCESS;
-       else
-               xname = POSIX_ACL_XATTR_DEFAULT;
-
        size = strlen(xname) + 1;
        if (list && size <= list_size)
                memcpy(list, xname, size);
index e87f9b52bf069af087979782767b6c3471689fd5..66b26fdfff8d6de51082b48b0f9a61fba9567466 100644 (file)
@@ -778,7 +778,7 @@ reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
        if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
                return -EOPNOTSUPP;
 
-       return handler->get(dentry, name, buffer, size, handler->flags);
+       return handler->get(handler, dentry, name, buffer, size);
 }
 
 /*
@@ -797,7 +797,7 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
        if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
                return -EOPNOTSUPP;
 
-       return handler->set(dentry, name, value, size, flags, handler->flags);
+       return handler->set(handler, dentry, name, value, size, flags);
 }
 
 /*
@@ -814,7 +814,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name)
        if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
                return -EOPNOTSUPP;
 
-       return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler->flags);
+       return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE);
 }
 
 struct listxattr_buf {
@@ -842,14 +842,14 @@ static int listxattr_filler(struct dir_context *ctx, const char *name,
                if (!handler)   /* Unsupported xattr name */
                        return 0;
                if (b->buf) {
-                       size = handler->list(b->dentry, b->buf + b->pos,
-                                        b->size, name, namelen,
-                                        handler->flags);
+                       size = handler->list(handler, b->dentry,
+                                            b->buf + b->pos, b->size, name,
+                                            namelen);
                        if (size > b->size)
                                return -ERANGE;
                } else {
-                       size = handler->list(b->dentry, NULL, 0, name,
-                                            namelen, handler->flags);
+                       size = handler->list(handler, b->dentry,
+                                            NULL, 0, name, namelen);
                }
 
                b->pos += size;
index 9a3b0616f2838848c88dbf90497ebb9af0a68e2a..ac659af431aec83d5ba7b85e7b69c1ac49e7b4c0 100644 (file)
@@ -9,8 +9,8 @@
 #include <linux/uaccess.h>
 
 static int
-security_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
-               int handler_flags)
+security_get(const struct xattr_handler *handler, struct dentry *dentry,
+            const char *name, void *buffer, size_t size)
 {
        if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
                return -EINVAL;
@@ -22,8 +22,8 @@ security_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
 }
 
 static int
-security_set(struct dentry *dentry, const char *name, const void *buffer,
-            size_t size, int flags, int handler_flags)
+security_set(const struct xattr_handler *handler, struct dentry *dentry,
+            const char *name, const void *buffer, size_t size, int flags)
 {
        if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
                return -EINVAL;
@@ -34,8 +34,9 @@ security_set(struct dentry *dentry, const char *name, const void *buffer,
        return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
 }
 
-static size_t security_list(struct dentry *dentry, char *list, size_t list_len,
-                           const char *name, size_t namelen, int handler_flags)
+static size_t security_list(const struct xattr_handler *handler,
+                           struct dentry *dentry, char *list, size_t list_len,
+                           const char *name, size_t namelen)
 {
        const size_t len = namelen + 1;
 
index e4f1343714e0ea8a89598bb776dc8a3f6b42c67d..a338adf1b8b4816c19ca84557a0142179f93b9a7 100644 (file)
@@ -8,8 +8,8 @@
 #include <linux/uaccess.h>
 
 static int
-trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
-           int handler_flags)
+trusted_get(const struct xattr_handler *handler, struct dentry *dentry,
+           const char *name, void *buffer, size_t size)
 {
        if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
                return -EINVAL;
@@ -21,8 +21,8 @@ trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
 }
 
 static int
-trusted_set(struct dentry *dentry, const char *name, const void *buffer,
-           size_t size, int flags, int handler_flags)
+trusted_set(const struct xattr_handler *handler, struct dentry *dentry,
+           const char *name, const void *buffer, size_t size, int flags)
 {
        if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
                return -EINVAL;
@@ -33,8 +33,9 @@ trusted_set(struct dentry *dentry, const char *name, const void *buffer,
        return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
 }
 
-static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size,
-                          const char *name, size_t name_len, int handler_flags)
+static size_t trusted_list(const struct xattr_handler *handler,
+                          struct dentry *dentry, char *list, size_t list_size,
+                          const char *name, size_t name_len)
 {
        const size_t len = name_len + 1;
 
index d0b08d3e5689d39aeffbd1d86e13711b50e56f22..39c9667191c5db5b3c930e538d81799b96bea6fb 100644 (file)
@@ -7,8 +7,8 @@
 #include <linux/uaccess.h>
 
 static int
-user_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
-        int handler_flags)
+user_get(const struct xattr_handler *handler, struct dentry *dentry,
+        const char *name, void *buffer, size_t size)
 {
 
        if (strlen(name) < sizeof(XATTR_USER_PREFIX))
@@ -19,8 +19,8 @@ user_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
 }
 
 static int
-user_set(struct dentry *dentry, const char *name, const void *buffer,
-        size_t size, int flags, int handler_flags)
+user_set(const struct xattr_handler *handler, struct dentry *dentry,
+        const char *name, const void *buffer, size_t size, int flags)
 {
        if (strlen(name) < sizeof(XATTR_USER_PREFIX))
                return -EINVAL;
@@ -30,8 +30,9 @@ user_set(struct dentry *dentry, const char *name, const void *buffer,
        return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
 }
 
-static size_t user_list(struct dentry *dentry, char *list, size_t list_size,
-                       const char *name, size_t name_len, int handler_flags)
+static size_t user_list(const struct xattr_handler *handler,
+                       struct dentry *dentry, char *list, size_t list_size,
+                       const char *name, size_t name_len)
 {
        const size_t len = name_len + 1;
 
index e5e0ddf5b1430d335075220824897c2e38d1b289..4ae1e4ffd200ec844d667bc3a8e3a8852169b9d2 100644 (file)
@@ -68,8 +68,8 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
                name_size = le16_to_cpu(entry.size);
                handler = squashfs_xattr_handler(le16_to_cpu(entry.type));
                if (handler)
-                       prefix_size = handler->list(d, buffer, rest, NULL,
-                               name_size, handler->flags);
+                       prefix_size = handler->list(handler, d, buffer, rest,
+                                                   NULL, name_size);
                if (prefix_size) {
                        if (buffer) {
                                if (prefix_size + name_size + 1 > rest) {
@@ -215,16 +215,18 @@ failed:
 /*
  * User namespace support
  */
-static size_t squashfs_user_list(struct dentry *d, char *list, size_t list_size,
-       const char *name, size_t name_len, int type)
+static size_t squashfs_user_list(const struct xattr_handler *handler,
+                                struct dentry *d, char *list, size_t list_size,
+                                const char *name, size_t name_len)
 {
        if (list && XATTR_USER_PREFIX_LEN <= list_size)
                memcpy(list, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
        return XATTR_USER_PREFIX_LEN;
 }
 
-static int squashfs_user_get(struct dentry *d, const char *name, void *buffer,
-       size_t size, int type)
+static int squashfs_user_get(const struct xattr_handler *handler,
+                            struct dentry *d, const char *name, void *buffer,
+                            size_t size)
 {
        if (name[0] == '\0')
                return  -EINVAL;
@@ -242,8 +244,10 @@ static const struct xattr_handler squashfs_xattr_user_handler = {
 /*
  * Trusted namespace support
  */
-static size_t squashfs_trusted_list(struct dentry *d, char *list,
-       size_t list_size, const char *name, size_t name_len, int type)
+static size_t squashfs_trusted_list(const struct xattr_handler *handler,
+                                   struct dentry *d, char *list,
+                                   size_t list_size, const char *name,
+                                   size_t name_len)
 {
        if (!capable(CAP_SYS_ADMIN))
                return 0;
@@ -253,8 +257,9 @@ static size_t squashfs_trusted_list(struct dentry *d, char *list,
        return XATTR_TRUSTED_PREFIX_LEN;
 }
 
-static int squashfs_trusted_get(struct dentry *d, const char *name,
-       void *buffer, size_t size, int type)
+static int squashfs_trusted_get(const struct xattr_handler *handler,
+                               struct dentry *d, const char *name,
+                               void *buffer, size_t size)
 {
        if (name[0] == '\0')
                return  -EINVAL;
@@ -272,16 +277,19 @@ static const struct xattr_handler squashfs_xattr_trusted_handler = {
 /*
  * Security namespace support
  */
-static size_t squashfs_security_list(struct dentry *d, char *list,
-       size_t list_size, const char *name, size_t name_len, int type)
+static size_t squashfs_security_list(const struct xattr_handler *handler,
+                                    struct dentry *d, char *list,
+                                    size_t list_size, const char *name,
+                                    size_t name_len)
 {
        if (list && XATTR_SECURITY_PREFIX_LEN <= list_size)
                memcpy(list, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN);
        return XATTR_SECURITY_PREFIX_LEN;
 }
 
-static int squashfs_security_get(struct dentry *d, const char *name,
-       void *buffer, size_t size, int type)
+static int squashfs_security_get(const struct xattr_handler *handler,
+                                struct dentry *d, const char *name,
+                                void *buffer, size_t size)
 {
        if (name[0] == '\0')
                return  -EINVAL;
index 072fee1258dd87e58d44ab3263909bab4f3a2e89..44377b6f60012d60dc4424049161008a4705c0ee 100644 (file)
@@ -720,7 +720,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s
        handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
        if (!handler)
                return -EOPNOTSUPP;
-       return handler->get(dentry, name, buffer, size, handler->flags);
+       return handler->get(handler, dentry, name, buffer, size);
 }
 
 /*
@@ -735,15 +735,15 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
 
        if (!buffer) {
                for_each_xattr_handler(handlers, handler) {
-                       size += handler->list(dentry, NULL, 0, NULL, 0,
-                                             handler->flags);
+                       size += handler->list(handler, dentry, NULL, 0,
+                                             NULL, 0);
                }
        } else {
                char *buf = buffer;
 
                for_each_xattr_handler(handlers, handler) {
-                       size = handler->list(dentry, buf, buffer_size,
-                                            NULL, 0, handler->flags);
+                       size = handler->list(handler, dentry, buf, buffer_size,
+                                            NULL, 0);
                        if (size > buffer_size)
                                return -ERANGE;
                        buf += size;
@@ -767,7 +767,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
        handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
        if (!handler)
                return -EOPNOTSUPP;
-       return handler->set(dentry, name, value, size, flags, handler->flags);
+       return handler->set(handler, dentry, name, value, size, flags);
 }
 
 /*
@@ -782,8 +782,7 @@ generic_removexattr(struct dentry *dentry, const char *name)
        handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
        if (!handler)
                return -EOPNOTSUPP;
-       return handler->set(dentry, name, NULL, 0,
-                           XATTR_REPLACE, handler->flags);
+       return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE);
 }
 
 EXPORT_SYMBOL(generic_getxattr);
index c036815183cb69bd82c58a0300c243e7e7ca7f32..b1850e1489ef6e2c17b8bc3eef905cfc741178c1 100644 (file)
 
 
 static int
-xfs_xattr_get(struct dentry *dentry, const char *name,
-               void *value, size_t size, int xflags)
+xfs_xattr_get(const struct xattr_handler *handler, struct dentry *dentry,
+               const char *name, void *value, size_t size)
 {
+       int xflags = handler->flags;
        struct xfs_inode *ip = XFS_I(d_inode(dentry));
        int error, asize = size;
 
@@ -54,9 +55,10 @@ xfs_xattr_get(struct dentry *dentry, const char *name,
 }
 
 static int
-xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
-               size_t size, int flags, int xflags)
+xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry,
+               const char *name, const void *value, size_t size, int flags)
 {
+       int xflags = handler->flags;
        struct xfs_inode *ip = XFS_I(d_inode(dentry));
 
        if (strcmp(name, "") == 0)