Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andreas Gruenbacher and committed by
Al Viro
d9a82a04 bf781714

+306 -226
+10 -8
fs/9p/acl.c
··· 230 230 return v9fs_xattr_get(dentry, full_name, buffer, size); 231 231 } 232 232 233 - static int v9fs_xattr_get_acl(struct dentry *dentry, const char *name, 234 - void *buffer, size_t size, int type) 233 + static int v9fs_xattr_get_acl(const struct xattr_handler *handler, 234 + struct dentry *dentry, const char *name, 235 + void *buffer, size_t size) 235 236 { 236 237 struct v9fs_session_info *v9ses; 237 238 struct posix_acl *acl; 239 + int type = handler->flags; 238 240 int error; 239 241 240 242 if (strcmp(name, "") != 0) ··· 280 278 } 281 279 282 280 283 - static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name, 284 - const void *value, size_t size, 285 - int flags, int type) 281 + static int v9fs_xattr_set_acl(const struct xattr_handler *handler, 282 + struct dentry *dentry, const char *name, 283 + const void *value, size_t size, int flags) 286 284 { 287 285 int retval; 288 286 struct posix_acl *acl; ··· 299 297 */ 300 298 if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) 301 299 return v9fs_remote_set_acl(dentry, name, 302 - value, size, flags, type); 300 + value, size, flags, handler->flags); 303 301 304 302 if (S_ISLNK(inode->i_mode)) 305 303 return -EOPNOTSUPP; ··· 318 316 } else 319 317 acl = NULL; 320 318 321 - switch (type) { 319 + switch (handler->flags) { 322 320 case ACL_TYPE_ACCESS: 323 321 name = POSIX_ACL_XATTR_ACCESS; 324 322 if (acl) { ··· 362 360 } 363 361 retval = v9fs_xattr_set(dentry, name, value, size, flags); 364 362 if (!retval) 365 - set_cached_acl(inode, type, acl); 363 + set_cached_acl(inode, handler->flags, acl); 366 364 err_out: 367 365 posix_acl_release(acl); 368 366 return retval;
+6 -4
fs/9p/xattr_security.c
··· 19 19 #include <linux/slab.h> 20 20 #include "xattr.h" 21 21 22 - static int v9fs_xattr_security_get(struct dentry *dentry, const char *name, 23 - void *buffer, size_t size, int type) 22 + static int v9fs_xattr_security_get(const struct xattr_handler *handler, 23 + struct dentry *dentry, const char *name, 24 + void *buffer, size_t size) 24 25 { 25 26 int retval; 26 27 char *full_name; ··· 47 46 return retval; 48 47 } 49 48 50 - static int v9fs_xattr_security_set(struct dentry *dentry, const char *name, 51 - const void *value, size_t size, int flags, int type) 49 + static int v9fs_xattr_security_set(const struct xattr_handler *handler, 50 + struct dentry *dentry, const char *name, 51 + const void *value, size_t size, int flags) 52 52 { 53 53 int retval; 54 54 char *full_name;
+6 -4
fs/9p/xattr_trusted.c
··· 19 19 #include <linux/slab.h> 20 20 #include "xattr.h" 21 21 22 - static int v9fs_xattr_trusted_get(struct dentry *dentry, const char *name, 23 - void *buffer, size_t size, int type) 22 + static int v9fs_xattr_trusted_get(const struct xattr_handler *handler, 23 + struct dentry *dentry, const char *name, 24 + void *buffer, size_t size) 24 25 { 25 26 int retval; 26 27 char *full_name; ··· 47 46 return retval; 48 47 } 49 48 50 - static int v9fs_xattr_trusted_set(struct dentry *dentry, const char *name, 51 - const void *value, size_t size, int flags, int type) 49 + static int v9fs_xattr_trusted_set(const struct xattr_handler *handler, 50 + struct dentry *dentry, const char *name, 51 + const void *value, size_t size, int flags) 52 52 { 53 53 int retval; 54 54 char *full_name;
+6 -4
fs/9p/xattr_user.c
··· 19 19 #include <linux/slab.h> 20 20 #include "xattr.h" 21 21 22 - static int v9fs_xattr_user_get(struct dentry *dentry, const char *name, 23 - void *buffer, size_t size, int type) 22 + static int v9fs_xattr_user_get(const struct xattr_handler *handler, 23 + struct dentry *dentry, const char *name, 24 + void *buffer, size_t size) 24 25 { 25 26 int retval; 26 27 char *full_name; ··· 47 46 return retval; 48 47 } 49 48 50 - static int v9fs_xattr_user_set(struct dentry *dentry, const char *name, 51 - const void *value, size_t size, int flags, int type) 49 + static int v9fs_xattr_user_set(const struct xattr_handler *handler, 50 + struct dentry *dentry, const char *name, 51 + const void *value, size_t size, int flags) 52 52 { 53 53 int retval; 54 54 char *full_name;
+3 -4
fs/ext2/xattr.c
··· 293 293 ext2_xattr_handler(entry->e_name_index); 294 294 295 295 if (handler) { 296 - size_t size = handler->list(dentry, buffer, rest, 297 - entry->e_name, 298 - entry->e_name_len, 299 - handler->flags); 296 + size_t size = handler->list(handler, dentry, buffer, 297 + rest, entry->e_name, 298 + entry->e_name_len); 300 299 if (buffer) { 301 300 if (size > rest) { 302 301 error = -ERANGE;
+9 -6
fs/ext2/xattr_security.c
··· 8 8 #include "xattr.h" 9 9 10 10 static size_t 11 - ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, 12 - const char *name, size_t name_len, int type) 11 + ext2_xattr_security_list(const struct xattr_handler *handler, 12 + struct dentry *dentry, char *list, size_t list_size, 13 + const char *name, size_t name_len) 13 14 { 14 15 const int prefix_len = XATTR_SECURITY_PREFIX_LEN; 15 16 const size_t total_len = prefix_len + name_len + 1; ··· 24 23 } 25 24 26 25 static int 27 - ext2_xattr_security_get(struct dentry *dentry, const char *name, 28 - void *buffer, size_t size, int type) 26 + ext2_xattr_security_get(const struct xattr_handler *handler, 27 + struct dentry *dentry, const char *name, 28 + void *buffer, size_t size) 29 29 { 30 30 if (strcmp(name, "") == 0) 31 31 return -EINVAL; ··· 35 33 } 36 34 37 35 static int 38 - ext2_xattr_security_set(struct dentry *dentry, const char *name, 39 - const void *value, size_t size, int flags, int type) 36 + ext2_xattr_security_set(const struct xattr_handler *handler, 37 + struct dentry *dentry, const char *name, 38 + const void *value, size_t size, int flags) 40 39 { 41 40 if (strcmp(name, "") == 0) 42 41 return -EINVAL;
+9 -6
fs/ext2/xattr_trusted.c
··· 9 9 #include "xattr.h" 10 10 11 11 static size_t 12 - ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, 13 - const char *name, size_t name_len, int type) 12 + ext2_xattr_trusted_list(const struct xattr_handler *handler, 13 + struct dentry *dentry, char *list, size_t list_size, 14 + const char *name, size_t name_len) 14 15 { 15 16 const int prefix_len = XATTR_TRUSTED_PREFIX_LEN; 16 17 const size_t total_len = prefix_len + name_len + 1; ··· 28 27 } 29 28 30 29 static int 31 - ext2_xattr_trusted_get(struct dentry *dentry, const char *name, 32 - void *buffer, size_t size, int type) 30 + ext2_xattr_trusted_get(const struct xattr_handler *handler, 31 + struct dentry *dentry, const char *name, 32 + void *buffer, size_t size) 33 33 { 34 34 if (strcmp(name, "") == 0) 35 35 return -EINVAL; ··· 39 37 } 40 38 41 39 static int 42 - ext2_xattr_trusted_set(struct dentry *dentry, const char *name, 43 - const void *value, size_t size, int flags, int type) 40 + ext2_xattr_trusted_set(const struct xattr_handler *handler, 41 + struct dentry *dentry, const char *name, 42 + const void *value, size_t size, int flags) 44 43 { 45 44 if (strcmp(name, "") == 0) 46 45 return -EINVAL;
+9 -6
fs/ext2/xattr_user.c
··· 11 11 #include "xattr.h" 12 12 13 13 static size_t 14 - ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, 15 - const char *name, size_t name_len, int type) 14 + ext2_xattr_user_list(const struct xattr_handler *handler, 15 + struct dentry *dentry, char *list, size_t list_size, 16 + const char *name, size_t name_len) 16 17 { 17 18 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 18 19 const size_t total_len = prefix_len + name_len + 1; ··· 30 29 } 31 30 32 31 static int 33 - ext2_xattr_user_get(struct dentry *dentry, const char *name, 34 - void *buffer, size_t size, int type) 32 + ext2_xattr_user_get(const struct xattr_handler *handler, 33 + struct dentry *dentry, const char *name, 34 + void *buffer, size_t size) 35 35 { 36 36 if (strcmp(name, "") == 0) 37 37 return -EINVAL; ··· 43 41 } 44 42 45 43 static int 46 - ext2_xattr_user_set(struct dentry *dentry, const char *name, 47 - const void *value, size_t size, int flags, int type) 44 + ext2_xattr_user_set(const struct xattr_handler *handler, 45 + struct dentry *dentry, const char *name, 46 + const void *value, size_t size, int flags) 48 47 { 49 48 if (strcmp(name, "") == 0) 50 49 return -EINVAL;
+3 -4
fs/ext4/xattr.c
··· 405 405 ext4_xattr_handler(entry->e_name_index); 406 406 407 407 if (handler) { 408 - size_t size = handler->list(dentry, buffer, rest, 409 - entry->e_name, 410 - entry->e_name_len, 411 - handler->flags); 408 + size_t size = handler->list(handler, dentry, buffer, 409 + rest, entry->e_name, 410 + entry->e_name_len); 412 411 if (buffer) { 413 412 if (size > rest) 414 413 return -ERANGE;
+9 -6
fs/ext4/xattr_security.c
··· 12 12 #include "xattr.h" 13 13 14 14 static size_t 15 - ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size, 16 - const char *name, size_t name_len, int type) 15 + ext4_xattr_security_list(const struct xattr_handler *handler, 16 + struct dentry *dentry, char *list, size_t list_size, 17 + const char *name, size_t name_len) 17 18 { 18 19 const size_t prefix_len = sizeof(XATTR_SECURITY_PREFIX)-1; 19 20 const size_t total_len = prefix_len + name_len + 1; ··· 29 28 } 30 29 31 30 static int 32 - ext4_xattr_security_get(struct dentry *dentry, const char *name, 33 - void *buffer, size_t size, int type) 31 + ext4_xattr_security_get(const struct xattr_handler *handler, 32 + struct dentry *dentry, const char *name, 33 + void *buffer, size_t size) 34 34 { 35 35 if (strcmp(name, "") == 0) 36 36 return -EINVAL; ··· 40 38 } 41 39 42 40 static int 43 - ext4_xattr_security_set(struct dentry *dentry, const char *name, 44 - const void *value, size_t size, int flags, int type) 41 + ext4_xattr_security_set(const struct xattr_handler *handler, 42 + struct dentry *dentry, const char *name, 43 + const void *value, size_t size, int flags) 45 44 { 46 45 if (strcmp(name, "") == 0) 47 46 return -EINVAL;
+9 -6
fs/ext4/xattr_trusted.c
··· 13 13 #include "xattr.h" 14 14 15 15 static size_t 16 - ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size, 17 - const char *name, size_t name_len, int type) 16 + ext4_xattr_trusted_list(const struct xattr_handler *handler, 17 + struct dentry *dentry, char *list, size_t list_size, 18 + const char *name, size_t name_len) 18 19 { 19 20 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; 20 21 const size_t total_len = prefix_len + name_len + 1; ··· 32 31 } 33 32 34 33 static int 35 - ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer, 36 - size_t size, int type) 34 + ext4_xattr_trusted_get(const struct xattr_handler *handler, 35 + struct dentry *dentry, const char *name, void *buffer, 36 + size_t size) 37 37 { 38 38 if (strcmp(name, "") == 0) 39 39 return -EINVAL; ··· 43 41 } 44 42 45 43 static int 46 - ext4_xattr_trusted_set(struct dentry *dentry, const char *name, 47 - const void *value, size_t size, int flags, int type) 44 + ext4_xattr_trusted_set(const struct xattr_handler *handler, 45 + struct dentry *dentry, const char *name, 46 + const void *value, size_t size, int flags) 48 47 { 49 48 if (strcmp(name, "") == 0) 50 49 return -EINVAL;
+9 -6
fs/ext4/xattr_user.c
··· 12 12 #include "xattr.h" 13 13 14 14 static size_t 15 - ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size, 16 - const char *name, size_t name_len, int type) 15 + ext4_xattr_user_list(const struct xattr_handler *handler, 16 + struct dentry *dentry, char *list, size_t list_size, 17 + const char *name, size_t name_len) 17 18 { 18 19 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 19 20 const size_t total_len = prefix_len + name_len + 1; ··· 31 30 } 32 31 33 32 static int 34 - ext4_xattr_user_get(struct dentry *dentry, const char *name, 35 - void *buffer, size_t size, int type) 33 + ext4_xattr_user_get(const struct xattr_handler *handler, 34 + struct dentry *dentry, const char *name, 35 + void *buffer, size_t size) 36 36 { 37 37 if (strcmp(name, "") == 0) 38 38 return -EINVAL; ··· 44 42 } 45 43 46 44 static int 47 - ext4_xattr_user_set(struct dentry *dentry, const char *name, 48 - const void *value, size_t size, int flags, int type) 45 + ext4_xattr_user_set(const struct xattr_handler *handler, 46 + struct dentry *dentry, const char *name, 47 + const void *value, size_t size, int flags) 49 48 { 50 49 if (strcmp(name, "") == 0) 51 50 return -EINVAL;
+27 -20
fs/f2fs/xattr.c
··· 25 25 #include "f2fs.h" 26 26 #include "xattr.h" 27 27 28 - static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list, 29 - size_t list_size, const char *name, size_t len, int type) 28 + static size_t f2fs_xattr_generic_list(const struct xattr_handler *handler, 29 + struct dentry *dentry, char *list, size_t list_size, 30 + const char *name, size_t len) 30 31 { 31 32 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 32 33 int total_len, prefix_len = 0; 33 34 const char *prefix = NULL; 34 35 35 - switch (type) { 36 + switch (handler->flags) { 36 37 case F2FS_XATTR_INDEX_USER: 37 38 if (!test_opt(sbi, XATTR_USER)) 38 39 return -EOPNOTSUPP; ··· 63 62 return total_len; 64 63 } 65 64 66 - static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name, 67 - void *buffer, size_t size, int type) 65 + static int f2fs_xattr_generic_get(const struct xattr_handler *handler, 66 + struct dentry *dentry, const char *name, void *buffer, 67 + size_t size) 68 68 { 69 69 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 70 70 71 - switch (type) { 71 + switch (handler->flags) { 72 72 case F2FS_XATTR_INDEX_USER: 73 73 if (!test_opt(sbi, XATTR_USER)) 74 74 return -EOPNOTSUPP; ··· 85 83 } 86 84 if (strcmp(name, "") == 0) 87 85 return -EINVAL; 88 - return f2fs_getxattr(d_inode(dentry), type, name, buffer, size, NULL); 86 + return f2fs_getxattr(d_inode(dentry), handler->flags, name, 87 + buffer, size, NULL); 89 88 } 90 89 91 - static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name, 92 - const void *value, size_t size, int flags, int type) 90 + static int f2fs_xattr_generic_set(const struct xattr_handler *handler, 91 + struct dentry *dentry, const char *name, const void *value, 92 + size_t size, int flags) 93 93 { 94 94 struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); 95 95 96 - switch (type) { 96 + switch (handler->flags) { 97 97 case F2FS_XATTR_INDEX_USER: 98 98 if (!test_opt(sbi, XATTR_USER)) 99 99 return -EOPNOTSUPP; ··· 112 108 if (strcmp(name, "") == 0) 113 109 return -EINVAL; 114 110 115 - return f2fs_setxattr(d_inode(dentry), type, name, 111 + return f2fs_setxattr(d_inode(dentry), handler->flags, name, 116 112 value, size, NULL, flags); 117 113 } 118 114 119 - static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list, 120 - size_t list_size, const char *name, size_t len, int type) 115 + static size_t f2fs_xattr_advise_list(const struct xattr_handler *handler, 116 + struct dentry *dentry, char *list, size_t list_size, 117 + const char *name, size_t len) 121 118 { 122 119 const char *xname = F2FS_SYSTEM_ADVISE_PREFIX; 123 120 size_t size; 124 121 125 - if (type != F2FS_XATTR_INDEX_ADVISE) 122 + if (handler->flags != F2FS_XATTR_INDEX_ADVISE) 126 123 return 0; 127 124 128 125 size = strlen(xname) + 1; ··· 132 127 return size; 133 128 } 134 129 135 - static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name, 136 - void *buffer, size_t size, int type) 130 + static int f2fs_xattr_advise_get(const struct xattr_handler *handler, 131 + struct dentry *dentry, const char *name, void *buffer, 132 + size_t size) 137 133 { 138 134 struct inode *inode = d_inode(dentry); 139 135 ··· 146 140 return sizeof(char); 147 141 } 148 142 149 - static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name, 150 - const void *value, size_t size, int flags, int type) 143 + static int f2fs_xattr_advise_set(const struct xattr_handler *handler, 144 + struct dentry *dentry, const char *name, const void *value, 145 + size_t size, int flags) 151 146 { 152 147 struct inode *inode = d_inode(dentry); 153 148 ··· 469 462 if (!handler) 470 463 continue; 471 464 472 - size = handler->list(dentry, buffer, rest, entry->e_name, 473 - entry->e_name_len, handler->flags); 465 + size = handler->list(handler, dentry, buffer, rest, 466 + entry->e_name, entry->e_name_len); 474 467 if (buffer && size > rest) { 475 468 error = -ERANGE; 476 469 goto cleanup;
+8 -5
fs/gfs2/xattr.c
··· 583 583 * 584 584 * Returns: actual size of data on success, -errno on error 585 585 */ 586 - static int gfs2_xattr_get(struct dentry *dentry, const char *name, 587 - void *buffer, size_t size, int type) 586 + static int gfs2_xattr_get(const struct xattr_handler *handler, 587 + struct dentry *dentry, const char *name, 588 + void *buffer, size_t size) 588 589 { 589 590 struct gfs2_inode *ip = GFS2_I(d_inode(dentry)); 590 591 struct gfs2_ea_location el; 592 + int type = handler->flags; 591 593 int error; 592 594 593 595 if (!ip->i_eattr) ··· 1229 1227 return error; 1230 1228 } 1231 1229 1232 - static int gfs2_xattr_set(struct dentry *dentry, const char *name, 1233 - const void *value, size_t size, int flags, int type) 1230 + static int gfs2_xattr_set(const struct xattr_handler *handler, 1231 + struct dentry *dentry, const char *name, 1232 + const void *value, size_t size, int flags) 1234 1233 { 1235 1234 return __gfs2_xattr_set(d_inode(dentry), name, value, 1236 - size, flags, type); 1235 + size, flags, handler->flags); 1237 1236 } 1238 1237 1239 1238
+6 -4
fs/hfsplus/xattr.c
··· 849 849 return err; 850 850 } 851 851 852 - static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, 853 - void *buffer, size_t size, int type) 852 + static int hfsplus_osx_getxattr(const struct xattr_handler *handler, 853 + struct dentry *dentry, const char *name, 854 + void *buffer, size_t size) 854 855 { 855 856 if (!strcmp(name, "")) 856 857 return -EINVAL; ··· 872 871 return __hfsplus_getxattr(d_inode(dentry), name, buffer, size); 873 872 } 874 873 875 - static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, 876 - const void *buffer, size_t size, int flags, int type) 874 + static int hfsplus_osx_setxattr(const struct xattr_handler *handler, 875 + struct dentry *dentry, const char *name, 876 + const void *buffer, size_t size, int flags) 877 877 { 878 878 if (!strcmp(name, "")) 879 879 return -EINVAL;
+6 -4
fs/hfsplus/xattr_security.c
··· 13 13 #include "xattr.h" 14 14 #include "acl.h" 15 15 16 - static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, 17 - void *buffer, size_t size, int type) 16 + static int hfsplus_security_getxattr(const struct xattr_handler *handler, 17 + struct dentry *dentry, const char *name, 18 + void *buffer, size_t size) 18 19 { 19 20 return hfsplus_getxattr(dentry, name, buffer, size, 20 21 XATTR_SECURITY_PREFIX, 21 22 XATTR_SECURITY_PREFIX_LEN); 22 23 } 23 24 24 - static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, 25 - const void *buffer, size_t size, int flags, int type) 25 + static int hfsplus_security_setxattr(const struct xattr_handler *handler, 26 + struct dentry *dentry, const char *name, 27 + const void *buffer, size_t size, int flags) 26 28 { 27 29 return hfsplus_setxattr(dentry, name, buffer, size, flags, 28 30 XATTR_SECURITY_PREFIX,
+6 -4
fs/hfsplus/xattr_trusted.c
··· 11 11 #include "hfsplus_fs.h" 12 12 #include "xattr.h" 13 13 14 - static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, 15 - void *buffer, size_t size, int type) 14 + static int hfsplus_trusted_getxattr(const struct xattr_handler *handler, 15 + struct dentry *dentry, const char *name, 16 + void *buffer, size_t size) 16 17 { 17 18 return hfsplus_getxattr(dentry, name, buffer, size, 18 19 XATTR_TRUSTED_PREFIX, 19 20 XATTR_TRUSTED_PREFIX_LEN); 20 21 } 21 22 22 - static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, 23 - const void *buffer, size_t size, int flags, int type) 23 + static int hfsplus_trusted_setxattr(const struct xattr_handler *handler, 24 + struct dentry *dentry, const char *name, 25 + const void *buffer, size_t size, int flags) 24 26 { 25 27 return hfsplus_setxattr(dentry, name, buffer, size, flags, 26 28 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
+6 -4
fs/hfsplus/xattr_user.c
··· 11 11 #include "hfsplus_fs.h" 12 12 #include "xattr.h" 13 13 14 - static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, 15 - void *buffer, size_t size, int type) 14 + static int hfsplus_user_getxattr(const struct xattr_handler *handler, 15 + struct dentry *dentry, const char *name, 16 + void *buffer, size_t size) 16 17 { 17 18 18 19 return hfsplus_getxattr(dentry, name, buffer, size, 19 20 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 20 21 } 21 22 22 - static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, 23 - const void *buffer, size_t size, int flags, int type) 23 + static int hfsplus_user_setxattr(const struct xattr_handler *handler, 24 + struct dentry *dentry, const char *name, 25 + const void *buffer, size_t size, int flags) 24 26 { 25 27 return hfsplus_setxattr(dentry, name, buffer, size, flags, 26 28 XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
+10 -6
fs/jffs2/security.c
··· 48 48 } 49 49 50 50 /* ---- XATTR Handler for "security.*" ----------------- */ 51 - static int jffs2_security_getxattr(struct dentry *dentry, const char *name, 52 - void *buffer, size_t size, int type) 51 + static int jffs2_security_getxattr(const struct xattr_handler *handler, 52 + struct dentry *dentry, const char *name, 53 + void *buffer, size_t size) 53 54 { 54 55 if (!strcmp(name, "")) 55 56 return -EINVAL; ··· 59 58 name, buffer, size); 60 59 } 61 60 62 - static int jffs2_security_setxattr(struct dentry *dentry, const char *name, 63 - const void *buffer, size_t size, int flags, int type) 61 + static int jffs2_security_setxattr(const struct xattr_handler *handler, 62 + struct dentry *dentry, const char *name, 63 + const void *buffer, size_t size, int flags) 64 64 { 65 65 if (!strcmp(name, "")) 66 66 return -EINVAL; ··· 70 68 name, buffer, size, flags); 71 69 } 72 70 73 - static size_t jffs2_security_listxattr(struct dentry *dentry, char *list, 74 - size_t list_size, const char *name, size_t name_len, int type) 71 + static size_t jffs2_security_listxattr(const struct xattr_handler *handler, 72 + struct dentry *dentry, char *list, 73 + size_t list_size, const char *name, 74 + size_t name_len) 75 75 { 76 76 size_t retlen = XATTR_SECURITY_PREFIX_LEN + name_len + 1; 77 77
+5 -4
fs/jffs2/xattr.c
··· 1001 1001 if (!xhandle) 1002 1002 continue; 1003 1003 if (buffer) { 1004 - rc = xhandle->list(dentry, buffer+len, size-len, 1005 - xd->xname, xd->name_len, xd->flags); 1004 + rc = xhandle->list(xhandle, dentry, buffer + len, 1005 + size - len, xd->xname, 1006 + xd->name_len); 1006 1007 } else { 1007 - rc = xhandle->list(dentry, NULL, 0, xd->xname, 1008 - xd->name_len, xd->flags); 1008 + rc = xhandle->list(xhandle, dentry, NULL, 0, 1009 + xd->xname, xd->name_len); 1009 1010 } 1010 1011 if (rc < 0) 1011 1012 goto out;
+10 -6
fs/jffs2/xattr_trusted.c
··· 16 16 #include <linux/mtd/mtd.h> 17 17 #include "nodelist.h" 18 18 19 - static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name, 20 - void *buffer, size_t size, int type) 19 + static int jffs2_trusted_getxattr(const struct xattr_handler *handler, 20 + struct dentry *dentry, const char *name, 21 + void *buffer, size_t size) 21 22 { 22 23 if (!strcmp(name, "")) 23 24 return -EINVAL; ··· 26 25 name, buffer, size); 27 26 } 28 27 29 - static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name, 30 - const void *buffer, size_t size, int flags, int type) 28 + static int jffs2_trusted_setxattr(const struct xattr_handler *handler, 29 + struct dentry *dentry, const char *name, 30 + const void *buffer, size_t size, int flags) 31 31 { 32 32 if (!strcmp(name, "")) 33 33 return -EINVAL; ··· 36 34 name, buffer, size, flags); 37 35 } 38 36 39 - static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list, 40 - size_t list_size, const char *name, size_t name_len, int type) 37 + static size_t jffs2_trusted_listxattr(const struct xattr_handler *handler, 38 + struct dentry *dentry, char *list, 39 + size_t list_size, const char *name, 40 + size_t name_len) 41 41 { 42 42 size_t retlen = XATTR_TRUSTED_PREFIX_LEN + name_len + 1; 43 43
+10 -6
fs/jffs2/xattr_user.c
··· 16 16 #include <linux/mtd/mtd.h> 17 17 #include "nodelist.h" 18 18 19 - static int jffs2_user_getxattr(struct dentry *dentry, const char *name, 20 - void *buffer, size_t size, int type) 19 + static int jffs2_user_getxattr(const struct xattr_handler *handler, 20 + struct dentry *dentry, const char *name, 21 + void *buffer, size_t size) 21 22 { 22 23 if (!strcmp(name, "")) 23 24 return -EINVAL; ··· 26 25 name, buffer, size); 27 26 } 28 27 29 - static int jffs2_user_setxattr(struct dentry *dentry, const char *name, 30 - const void *buffer, size_t size, int flags, int type) 28 + static int jffs2_user_setxattr(const struct xattr_handler *handler, 29 + struct dentry *dentry, const char *name, 30 + const void *buffer, size_t size, int flags) 31 31 { 32 32 if (!strcmp(name, "")) 33 33 return -EINVAL; ··· 36 34 name, buffer, size, flags); 37 35 } 38 36 39 - static size_t jffs2_user_listxattr(struct dentry *dentry, char *list, 40 - size_t list_size, const char *name, size_t name_len, int type) 37 + static size_t jffs2_user_listxattr(const struct xattr_handler *handler, 38 + struct dentry *dentry, char *list, 39 + size_t list_size, const char *name, 40 + size_t name_len) 41 41 { 42 42 size_t retlen = XATTR_USER_PREFIX_LEN + name_len + 1; 43 43
+20 -14
fs/nfs/nfs4proc.c
··· 6249 6249 6250 6250 #define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" 6251 6251 6252 - static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key, 6252 + static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler, 6253 + struct dentry *dentry, const char *key, 6253 6254 const void *buf, size_t buflen, 6254 - int flags, int type) 6255 + int flags) 6255 6256 { 6256 6257 if (strcmp(key, "") != 0) 6257 6258 return -EINVAL; ··· 6260 6259 return nfs4_proc_set_acl(d_inode(dentry), buf, buflen); 6261 6260 } 6262 6261 6263 - static int nfs4_xattr_get_nfs4_acl(struct dentry *dentry, const char *key, 6264 - void *buf, size_t buflen, int type) 6262 + static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler, 6263 + struct dentry *dentry, const char *key, 6264 + void *buf, size_t buflen) 6265 6265 { 6266 6266 if (strcmp(key, "") != 0) 6267 6267 return -EINVAL; ··· 6270 6268 return nfs4_proc_get_acl(d_inode(dentry), buf, buflen); 6271 6269 } 6272 6270 6273 - static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list, 6271 + static size_t nfs4_xattr_list_nfs4_acl(const struct xattr_handler *handler, 6272 + struct dentry *dentry, char *list, 6274 6273 size_t list_len, const char *name, 6275 - size_t name_len, int type) 6274 + size_t name_len) 6276 6275 { 6277 6276 size_t len = sizeof(XATTR_NAME_NFSV4_ACL); 6278 6277 ··· 6291 6288 return server->caps & NFS_CAP_SECURITY_LABEL; 6292 6289 } 6293 6290 6294 - static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key, 6295 - const void *buf, size_t buflen, 6296 - int flags, int type) 6291 + static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler, 6292 + struct dentry *dentry, const char *key, 6293 + const void *buf, size_t buflen, 6294 + int flags) 6297 6295 { 6298 6296 if (security_ismaclabel(key)) 6299 6297 return nfs4_set_security_label(dentry, buf, buflen); ··· 6302 6298 return -EOPNOTSUPP; 6303 6299 } 6304 6300 6305 - static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key, 6306 - void *buf, size_t buflen, int type) 6301 + static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler, 6302 + struct dentry *dentry, const char *key, 6303 + void *buf, size_t buflen) 6307 6304 { 6308 6305 if (security_ismaclabel(key)) 6309 6306 return nfs4_get_security_label(d_inode(dentry), buf, buflen); 6310 6307 return -EOPNOTSUPP; 6311 6308 } 6312 6309 6313 - static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list, 6314 - size_t list_len, const char *name, 6315 - size_t name_len, int type) 6310 + static size_t nfs4_xattr_list_nfs4_label(const struct xattr_handler *handler, 6311 + struct dentry *dentry, char *list, 6312 + size_t list_len, const char *name, 6313 + size_t name_len) 6316 6314 { 6317 6315 size_t len = 0; 6318 6316
+27 -18
fs/ocfs2/xattr.c
··· 7229 7229 /* 7230 7230 * 'security' attributes support 7231 7231 */ 7232 - static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list, 7232 + static size_t ocfs2_xattr_security_list(const struct xattr_handler *handler, 7233 + struct dentry *dentry, char *list, 7233 7234 size_t list_size, const char *name, 7234 - size_t name_len, int type) 7235 + size_t name_len) 7235 7236 { 7236 7237 const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN; 7237 7238 const size_t total_len = prefix_len + name_len + 1; ··· 7245 7244 return total_len; 7246 7245 } 7247 7246 7248 - static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name, 7249 - void *buffer, size_t size, int type) 7247 + static int ocfs2_xattr_security_get(const struct xattr_handler *handler, 7248 + struct dentry *dentry, const char *name, 7249 + void *buffer, size_t size) 7250 7250 { 7251 7251 if (strcmp(name, "") == 0) 7252 7252 return -EINVAL; ··· 7255 7253 name, buffer, size); 7256 7254 } 7257 7255 7258 - static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name, 7259 - const void *value, size_t size, int flags, int type) 7256 + static int ocfs2_xattr_security_set(const struct xattr_handler *handler, 7257 + struct dentry *dentry, const char *name, 7258 + const void *value, size_t size, int flags) 7260 7259 { 7261 7260 if (strcmp(name, "") == 0) 7262 7261 return -EINVAL; ··· 7322 7319 /* 7323 7320 * 'trusted' attributes support 7324 7321 */ 7325 - static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list, 7322 + static size_t ocfs2_xattr_trusted_list(const struct xattr_handler *handler, 7323 + struct dentry *dentry, char *list, 7326 7324 size_t list_size, const char *name, 7327 - size_t name_len, int type) 7325 + size_t name_len) 7328 7326 { 7329 7327 const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN; 7330 7328 const size_t total_len = prefix_len + name_len + 1; ··· 7341 7337 return total_len; 7342 7338 } 7343 7339 7344 - static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name, 7345 - void *buffer, size_t size, int type) 7340 + static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler, 7341 + struct dentry *dentry, const char *name, 7342 + void *buffer, size_t size) 7346 7343 { 7347 7344 if (strcmp(name, "") == 0) 7348 7345 return -EINVAL; ··· 7351 7346 name, buffer, size); 7352 7347 } 7353 7348 7354 - static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name, 7355 - const void *value, size_t size, int flags, int type) 7349 + static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler, 7350 + struct dentry *dentry, const char *name, 7351 + const void *value, size_t size, int flags) 7356 7352 { 7357 7353 if (strcmp(name, "") == 0) 7358 7354 return -EINVAL; ··· 7372 7366 /* 7373 7367 * 'user' attributes support 7374 7368 */ 7375 - static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list, 7369 + static size_t ocfs2_xattr_user_list(const struct xattr_handler *handler, 7370 + struct dentry *dentry, char *list, 7376 7371 size_t list_size, const char *name, 7377 - size_t name_len, int type) 7372 + size_t name_len) 7378 7373 { 7379 7374 const size_t prefix_len = XATTR_USER_PREFIX_LEN; 7380 7375 const size_t total_len = prefix_len + name_len + 1; ··· 7392 7385 return total_len; 7393 7386 } 7394 7387 7395 - static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name, 7396 - void *buffer, size_t size, int type) 7388 + static int ocfs2_xattr_user_get(const struct xattr_handler *handler, 7389 + struct dentry *dentry, const char *name, 7390 + void *buffer, size_t size) 7397 7391 { 7398 7392 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 7399 7393 ··· 7406 7398 buffer, size); 7407 7399 } 7408 7400 7409 - static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name, 7410 - const void *value, size_t size, int flags, int type) 7401 + static int ocfs2_xattr_user_set(const struct xattr_handler *handler, 7402 + struct dentry *dentry, const char *name, 7403 + const void *value, size_t size, int flags) 7411 7404 { 7412 7405 struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); 7413 7406
+13 -15
fs/posix_acl.c
··· 762 762 EXPORT_SYMBOL (posix_acl_to_xattr); 763 763 764 764 static int 765 - posix_acl_xattr_get(struct dentry *dentry, const char *name, 766 - void *value, size_t size, int type) 765 + posix_acl_xattr_get(const struct xattr_handler *handler, 766 + struct dentry *dentry, const char *name, 767 + void *value, size_t size) 767 768 { 768 769 struct posix_acl *acl; 769 770 int error; ··· 776 775 if (d_is_symlink(dentry)) 777 776 return -EOPNOTSUPP; 778 777 779 - acl = get_acl(d_backing_inode(dentry), type); 778 + acl = get_acl(d_backing_inode(dentry), handler->flags); 780 779 if (IS_ERR(acl)) 781 780 return PTR_ERR(acl); 782 781 if (acl == NULL) ··· 789 788 } 790 789 791 790 static int 792 - posix_acl_xattr_set(struct dentry *dentry, const char *name, 793 - const void *value, size_t size, int flags, int type) 791 + posix_acl_xattr_set(const struct xattr_handler *handler, 792 + struct dentry *dentry, const char *name, 793 + const void *value, size_t size, int flags) 794 794 { 795 795 struct inode *inode = d_backing_inode(dentry); 796 796 struct posix_acl *acl = NULL; ··· 804 802 if (!inode->i_op->set_acl) 805 803 return -EOPNOTSUPP; 806 804 807 - if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) 805 + if (handler->flags == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) 808 806 return value ? -EACCES : 0; 809 807 if (!inode_owner_or_capable(inode)) 810 808 return -EPERM; ··· 821 819 } 822 820 } 823 821 824 - ret = inode->i_op->set_acl(inode, acl, type); 822 + ret = inode->i_op->set_acl(inode, acl, handler->flags); 825 823 out: 826 824 posix_acl_release(acl); 827 825 return ret; 828 826 } 829 827 830 828 static size_t 831 - posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size, 832 - const char *name, size_t name_len, int type) 829 + posix_acl_xattr_list(const struct xattr_handler *handler, 830 + struct dentry *dentry, char *list, size_t list_size, 831 + const char *name, size_t name_len) 833 832 { 834 - const char *xname; 833 + const char *xname = handler->prefix; 835 834 size_t size; 836 835 837 836 if (!IS_POSIXACL(d_backing_inode(dentry))) 838 837 return 0; 839 - 840 - if (type == ACL_TYPE_ACCESS) 841 - xname = POSIX_ACL_XATTR_ACCESS; 842 - else 843 - xname = POSIX_ACL_XATTR_DEFAULT; 844 838 845 839 size = strlen(xname) + 1; 846 840 if (list && size <= list_size)
+8 -8
fs/reiserfs/xattr.c
··· 778 778 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) 779 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 797 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) 798 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 814 if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1) 815 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 820 820 struct listxattr_buf { ··· 842 842 if (!handler) /* Unsupported xattr name */ 843 843 return 0; 844 844 if (b->buf) { 845 - size = handler->list(b->dentry, b->buf + b->pos, 846 - b->size, name, namelen, 847 - handler->flags); 845 + size = handler->list(handler, b->dentry, 846 + b->buf + b->pos, b->size, name, 847 + namelen); 848 848 if (size > b->size) 849 849 return -ERANGE; 850 850 } else { 851 - size = handler->list(b->dentry, NULL, 0, name, 852 - namelen, handler->flags); 851 + size = handler->list(handler, b->dentry, 852 + NULL, 0, name, namelen); 853 853 } 854 854 855 855 b->pos += size;
+7 -6
fs/reiserfs/xattr_security.c
··· 9 9 #include <linux/uaccess.h> 10 10 11 11 static int 12 - security_get(struct dentry *dentry, const char *name, void *buffer, size_t size, 13 - int handler_flags) 12 + security_get(const struct xattr_handler *handler, struct dentry *dentry, 13 + const char *name, void *buffer, size_t size) 14 14 { 15 15 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 16 16 return -EINVAL; ··· 22 22 } 23 23 24 24 static int 25 - security_set(struct dentry *dentry, const char *name, const void *buffer, 26 - size_t size, int flags, int handler_flags) 25 + security_set(const struct xattr_handler *handler, struct dentry *dentry, 26 + const char *name, const void *buffer, size_t size, int flags) 27 27 { 28 28 if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX)) 29 29 return -EINVAL; ··· 34 34 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); 35 35 } 36 36 37 - static size_t security_list(struct dentry *dentry, char *list, size_t list_len, 38 - const char *name, size_t namelen, int handler_flags) 37 + static size_t security_list(const struct xattr_handler *handler, 38 + struct dentry *dentry, char *list, size_t list_len, 39 + const char *name, size_t namelen) 39 40 { 40 41 const size_t len = namelen + 1; 41 42
+7 -6
fs/reiserfs/xattr_trusted.c
··· 8 8 #include <linux/uaccess.h> 9 9 10 10 static int 11 - trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size, 12 - int handler_flags) 11 + trusted_get(const struct xattr_handler *handler, struct dentry *dentry, 12 + const char *name, void *buffer, size_t size) 13 13 { 14 14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 15 15 return -EINVAL; ··· 21 21 } 22 22 23 23 static int 24 - trusted_set(struct dentry *dentry, const char *name, const void *buffer, 25 - size_t size, int flags, int handler_flags) 24 + trusted_set(const struct xattr_handler *handler, struct dentry *dentry, 25 + const char *name, const void *buffer, size_t size, int flags) 26 26 { 27 27 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX)) 28 28 return -EINVAL; ··· 33 33 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); 34 34 } 35 35 36 - static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size, 37 - const char *name, size_t name_len, int handler_flags) 36 + static size_t trusted_list(const struct xattr_handler *handler, 37 + struct dentry *dentry, char *list, size_t list_size, 38 + const char *name, size_t name_len) 38 39 { 39 40 const size_t len = name_len + 1; 40 41
+7 -6
fs/reiserfs/xattr_user.c
··· 7 7 #include <linux/uaccess.h> 8 8 9 9 static int 10 - user_get(struct dentry *dentry, const char *name, void *buffer, size_t size, 11 - int handler_flags) 10 + user_get(const struct xattr_handler *handler, struct dentry *dentry, 11 + const char *name, void *buffer, size_t size) 12 12 { 13 13 14 14 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) ··· 19 19 } 20 20 21 21 static int 22 - user_set(struct dentry *dentry, const char *name, const void *buffer, 23 - size_t size, int flags, int handler_flags) 22 + user_set(const struct xattr_handler *handler, struct dentry *dentry, 23 + const char *name, const void *buffer, size_t size, int flags) 24 24 { 25 25 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 26 26 return -EINVAL; ··· 30 30 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags); 31 31 } 32 32 33 - static size_t user_list(struct dentry *dentry, char *list, size_t list_size, 34 - const char *name, size_t name_len, int handler_flags) 33 + static size_t user_list(const struct xattr_handler *handler, 34 + struct dentry *dentry, char *list, size_t list_size, 35 + const char *name, size_t name_len) 35 36 { 36 37 const size_t len = name_len + 1; 37 38
+22 -14
fs/squashfs/xattr.c
··· 68 68 name_size = le16_to_cpu(entry.size); 69 69 handler = squashfs_xattr_handler(le16_to_cpu(entry.type)); 70 70 if (handler) 71 - prefix_size = handler->list(d, buffer, rest, NULL, 72 - name_size, handler->flags); 71 + prefix_size = handler->list(handler, d, buffer, rest, 72 + NULL, name_size); 73 73 if (prefix_size) { 74 74 if (buffer) { 75 75 if (prefix_size + name_size + 1 > rest) { ··· 215 215 /* 216 216 * User namespace support 217 217 */ 218 - static size_t squashfs_user_list(struct dentry *d, char *list, size_t list_size, 219 - const char *name, size_t name_len, int type) 218 + static size_t squashfs_user_list(const struct xattr_handler *handler, 219 + struct dentry *d, char *list, size_t list_size, 220 + const char *name, size_t name_len) 220 221 { 221 222 if (list && XATTR_USER_PREFIX_LEN <= list_size) 222 223 memcpy(list, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 223 224 return XATTR_USER_PREFIX_LEN; 224 225 } 225 226 226 - static int squashfs_user_get(struct dentry *d, const char *name, void *buffer, 227 - size_t size, int type) 227 + static int squashfs_user_get(const struct xattr_handler *handler, 228 + struct dentry *d, const char *name, void *buffer, 229 + size_t size) 228 230 { 229 231 if (name[0] == '\0') 230 232 return -EINVAL; ··· 244 242 /* 245 243 * Trusted namespace support 246 244 */ 247 - static size_t squashfs_trusted_list(struct dentry *d, char *list, 248 - size_t list_size, const char *name, size_t name_len, int type) 245 + static size_t squashfs_trusted_list(const struct xattr_handler *handler, 246 + struct dentry *d, char *list, 247 + size_t list_size, const char *name, 248 + size_t name_len) 249 249 { 250 250 if (!capable(CAP_SYS_ADMIN)) 251 251 return 0; ··· 257 253 return XATTR_TRUSTED_PREFIX_LEN; 258 254 } 259 255 260 - static int squashfs_trusted_get(struct dentry *d, const char *name, 261 - void *buffer, size_t size, int type) 256 + static int squashfs_trusted_get(const struct xattr_handler *handler, 257 + struct dentry *d, const char *name, 258 + void *buffer, size_t size) 262 259 { 263 260 if (name[0] == '\0') 264 261 return -EINVAL; ··· 277 272 /* 278 273 * Security namespace support 279 274 */ 280 - static size_t squashfs_security_list(struct dentry *d, char *list, 281 - size_t list_size, const char *name, size_t name_len, int type) 275 + static size_t squashfs_security_list(const struct xattr_handler *handler, 276 + struct dentry *d, char *list, 277 + size_t list_size, const char *name, 278 + size_t name_len) 282 279 { 283 280 if (list && XATTR_SECURITY_PREFIX_LEN <= list_size) 284 281 memcpy(list, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN); 285 282 return XATTR_SECURITY_PREFIX_LEN; 286 283 } 287 284 288 - static int squashfs_security_get(struct dentry *d, const char *name, 289 - void *buffer, size_t size, int type) 285 + static int squashfs_security_get(const struct xattr_handler *handler, 286 + struct dentry *d, const char *name, 287 + void *buffer, size_t size) 290 288 { 291 289 if (name[0] == '\0') 292 290 return -EINVAL;
+7 -8
fs/xattr.c
··· 720 720 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 721 721 if (!handler) 722 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 735 736 736 if (!buffer) { 737 737 for_each_xattr_handler(handlers, handler) { 738 - size += handler->list(dentry, NULL, 0, NULL, 0, 739 - handler->flags); 738 + size += handler->list(handler, dentry, NULL, 0, 739 + NULL, 0); 740 740 } 741 741 } else { 742 742 char *buf = buffer; 743 743 744 744 for_each_xattr_handler(handlers, handler) { 745 - size = handler->list(dentry, buf, buffer_size, 746 - NULL, 0, handler->flags); 745 + size = handler->list(handler, dentry, buf, buffer_size, 746 + NULL, 0); 747 747 if (size > buffer_size) 748 748 return -ERANGE; 749 749 buf += size; ··· 767 767 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 768 768 if (!handler) 769 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 782 handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); 783 783 if (!handler) 784 784 return -EOPNOTSUPP; 785 - return handler->set(dentry, name, NULL, 0, 786 - XATTR_REPLACE, handler->flags); 785 + return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE); 787 786 } 788 787 789 788 EXPORT_SYMBOL(generic_getxattr);
+6 -4
fs/xfs/xfs_xattr.c
··· 32 32 33 33 34 34 static int 35 - xfs_xattr_get(struct dentry *dentry, const char *name, 36 - void *value, size_t size, int xflags) 35 + xfs_xattr_get(const struct xattr_handler *handler, struct dentry *dentry, 36 + const char *name, void *value, size_t size) 37 37 { 38 + int xflags = handler->flags; 38 39 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 39 40 int error, asize = size; 40 41 ··· 55 54 } 56 55 57 56 static int 58 - xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, 59 - size_t size, int flags, int xflags) 57 + xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, 58 + const char *name, const void *value, size_t size, int flags) 60 59 { 60 + int xflags = handler->flags; 61 61 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 62 62 63 63 if (strcmp(name, "") == 0)