Commit 3f614a3d authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] Remove flags argument from xattr inode operations again

SGI Modid: 2.5.x-xfs:slinx:140255a
parent 7e1abff7
...@@ -419,7 +419,7 @@ ext2_acl_chmod(struct inode *inode) ...@@ -419,7 +419,7 @@ ext2_acl_chmod(struct inode *inode)
*/ */
static size_t static size_t
ext2_xattr_list_acl_access(char *list, struct inode *inode, ext2_xattr_list_acl_access(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const size_t size = sizeof(XATTR_NAME_ACL_ACCESS); const size_t size = sizeof(XATTR_NAME_ACL_ACCESS);
...@@ -432,7 +432,7 @@ ext2_xattr_list_acl_access(char *list, struct inode *inode, ...@@ -432,7 +432,7 @@ ext2_xattr_list_acl_access(char *list, struct inode *inode,
static size_t static size_t
ext2_xattr_list_acl_default(char *list, struct inode *inode, ext2_xattr_list_acl_default(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const size_t size = sizeof(XATTR_NAME_ACL_DEFAULT); const size_t size = sizeof(XATTR_NAME_ACL_DEFAULT);
...@@ -465,7 +465,7 @@ ext2_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size) ...@@ -465,7 +465,7 @@ ext2_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
static int static int
ext2_xattr_get_acl_access(struct inode *inode, const char *name, ext2_xattr_get_acl_access(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
if (strcmp(name, "") != 0) if (strcmp(name, "") != 0)
return -EINVAL; return -EINVAL;
...@@ -474,7 +474,7 @@ ext2_xattr_get_acl_access(struct inode *inode, const char *name, ...@@ -474,7 +474,7 @@ ext2_xattr_get_acl_access(struct inode *inode, const char *name,
static int static int
ext2_xattr_get_acl_default(struct inode *inode, const char *name, ext2_xattr_get_acl_default(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
if (strcmp(name, "") != 0) if (strcmp(name, "") != 0)
return -EINVAL; return -EINVAL;
......
...@@ -199,7 +199,7 @@ ext2_xattr_handler(int name_index) ...@@ -199,7 +199,7 @@ ext2_xattr_handler(int name_index)
*/ */
ssize_t ssize_t
ext2_getxattr(struct dentry *dentry, const char *name, ext2_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
struct ext2_xattr_handler *handler; struct ext2_xattr_handler *handler;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -207,7 +207,7 @@ ext2_getxattr(struct dentry *dentry, const char *name, ...@@ -207,7 +207,7 @@ ext2_getxattr(struct dentry *dentry, const char *name,
handler = ext2_xattr_resolve_name(&name); handler = ext2_xattr_resolve_name(&name);
if (!handler) if (!handler)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return handler->get(inode, name, buffer, size, flags); return handler->get(inode, name, buffer, size);
} }
/* /*
...@@ -217,9 +217,9 @@ ext2_getxattr(struct dentry *dentry, const char *name, ...@@ -217,9 +217,9 @@ ext2_getxattr(struct dentry *dentry, const char *name,
* BKL held [before 2.5.x] * BKL held [before 2.5.x]
*/ */
ssize_t ssize_t
ext2_listxattr(struct dentry *dentry, char *buffer, size_t size, int flags) ext2_listxattr(struct dentry *dentry, char *buffer, size_t size)
{ {
return ext2_xattr_list(dentry->d_inode, buffer, size, flags); return ext2_xattr_list(dentry->d_inode, buffer, size);
} }
/* /*
...@@ -250,7 +250,7 @@ ext2_setxattr(struct dentry *dentry, const char *name, ...@@ -250,7 +250,7 @@ ext2_setxattr(struct dentry *dentry, const char *name,
* BKL held [before 2.5.x] * BKL held [before 2.5.x]
*/ */
int int
ext2_removexattr(struct dentry *dentry, const char *name, int flags) ext2_removexattr(struct dentry *dentry, const char *name)
{ {
struct ext2_xattr_handler *handler; struct ext2_xattr_handler *handler;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -258,7 +258,7 @@ ext2_removexattr(struct dentry *dentry, const char *name, int flags) ...@@ -258,7 +258,7 @@ ext2_removexattr(struct dentry *dentry, const char *name, int flags)
handler = ext2_xattr_resolve_name(&name); handler = ext2_xattr_resolve_name(&name);
if (!handler) if (!handler)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return handler->set(inode, name, NULL, 0, flags | XATTR_REPLACE); return handler->set(inode, name, NULL, 0, XATTR_REPLACE);
} }
/* /*
...@@ -371,8 +371,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_get", ...@@ -371,8 +371,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_get",
* used / required on success. * used / required on success.
*/ */
int int
ext2_xattr_list(struct inode *inode, char *buffer, size_t buffer_size, ext2_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
int flags)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct ext2_xattr_entry *entry; struct ext2_xattr_entry *entry;
...@@ -412,7 +411,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list", ...@@ -412,7 +411,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
handler = ext2_xattr_handler(entry->e_name_index); handler = ext2_xattr_handler(entry->e_name_index);
if (handler) if (handler)
size += handler->list(NULL, inode, entry->e_name, size += handler->list(NULL, inode, entry->e_name,
entry->e_name_len, flags); entry->e_name_len);
} }
if (ext2_xattr_cache_insert(bh)) if (ext2_xattr_cache_insert(bh))
...@@ -435,7 +434,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list", ...@@ -435,7 +434,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
handler = ext2_xattr_handler(entry->e_name_index); handler = ext2_xattr_handler(entry->e_name_index);
if (handler) if (handler)
buf += handler->list(buf, inode, entry->e_name, buf += handler->list(buf, inode, entry->e_name,
entry->e_name_len, flags); entry->e_name_len);
} }
error = size; error = size;
......
...@@ -58,9 +58,9 @@ struct ext2_xattr_entry { ...@@ -58,9 +58,9 @@ struct ext2_xattr_entry {
struct ext2_xattr_handler { struct ext2_xattr_handler {
char *prefix; char *prefix;
size_t (*list)(char *list, struct inode *inode, const char *name, size_t (*list)(char *list, struct inode *inode, const char *name,
int name_len, int flags); int name_len);
int (*get)(struct inode *inode, const char *name, void *buffer, int (*get)(struct inode *inode, const char *name, void *buffer,
size_t size, int flags); size_t size);
int (*set)(struct inode *inode, const char *name, const void *buffer, int (*set)(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags); size_t size, int flags);
}; };
...@@ -69,12 +69,12 @@ extern int ext2_xattr_register(int, struct ext2_xattr_handler *); ...@@ -69,12 +69,12 @@ extern int ext2_xattr_register(int, struct ext2_xattr_handler *);
extern void ext2_xattr_unregister(int, struct ext2_xattr_handler *); extern void ext2_xattr_unregister(int, struct ext2_xattr_handler *);
extern int ext2_setxattr(struct dentry *, const char *, const void *, size_t, int); extern int ext2_setxattr(struct dentry *, const char *, const void *, size_t, int);
extern ssize_t ext2_getxattr(struct dentry *, const char *, void *, size_t, int); extern ssize_t ext2_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t ext2_listxattr(struct dentry *, char *, size_t, int); extern ssize_t ext2_listxattr(struct dentry *, char *, size_t);
extern int ext2_removexattr(struct dentry *, const char *, int); extern int ext2_removexattr(struct dentry *, const char *);
extern int ext2_xattr_get(struct inode *, int, const char *, void *, size_t); extern int ext2_xattr_get(struct inode *, int, const char *, void *, size_t);
extern int ext2_xattr_list(struct inode *, char *, size_t, int flags); extern int ext2_xattr_list(struct inode *, char *, size_t);
extern int ext2_xattr_set(struct inode *, int, const char *, const void *, size_t, int); extern int ext2_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
extern void ext2_xattr_delete_inode(struct inode *); extern void ext2_xattr_delete_inode(struct inode *);
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
static size_t static size_t
ext2_xattr_trusted_list(char *list, struct inode *inode, ext2_xattr_trusted_list(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1; const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
if (!((flags & XATTR_KERNEL_CONTEXT) || capable(CAP_SYS_ADMIN))) if (!capable(CAP_SYS_ADMIN))
return 0; return 0;
if (list) { if (list) {
...@@ -33,11 +33,11 @@ ext2_xattr_trusted_list(char *list, struct inode *inode, ...@@ -33,11 +33,11 @@ ext2_xattr_trusted_list(char *list, struct inode *inode,
static int static int
ext2_xattr_trusted_get(struct inode *inode, const char *name, ext2_xattr_trusted_get(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!((flags & XATTR_KERNEL_CONTEXT) || capable(CAP_SYS_ADMIN))) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
buffer, size); buffer, size);
...@@ -49,7 +49,7 @@ ext2_xattr_trusted_set(struct inode *inode, const char *name, ...@@ -49,7 +49,7 @@ ext2_xattr_trusted_set(struct inode *inode, const char *name,
{ {
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!((flags & XATTR_KERNEL_CONTEXT) || capable(CAP_SYS_ADMIN))) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name,
value, size, flags); value, size, flags);
......
...@@ -19,12 +19,11 @@ ...@@ -19,12 +19,11 @@
static size_t static size_t
ext2_xattr_user_list(char *list, struct inode *inode, ext2_xattr_user_list(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const int prefix_len = sizeof(XATTR_USER_PREFIX)-1; const int prefix_len = sizeof(XATTR_USER_PREFIX)-1;
if (!(flags & XATTR_KERNEL_CONTEXT) && if (!test_opt(inode->i_sb, XATTR_USER))
!test_opt(inode->i_sb, XATTR_USER))
return 0; return 0;
if (list) { if (list) {
...@@ -37,49 +36,46 @@ ext2_xattr_user_list(char *list, struct inode *inode, ...@@ -37,49 +36,46 @@ ext2_xattr_user_list(char *list, struct inode *inode,
static int static int
ext2_xattr_user_get(struct inode *inode, const char *name, ext2_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
int error;
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!(flags & XATTR_KERNEL_CONTEXT)) { if (!test_opt(inode->i_sb, XATTR_USER))
int error; return -EOPNOTSUPP;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
#ifdef CONFIG_EXT2_FS_POSIX_ACL #ifdef CONFIG_EXT2_FS_POSIX_ACL
error = ext2_permission_locked(inode, MAY_READ); error = ext2_permission_locked(inode, MAY_READ);
#else #else
error = permission(inode, MAY_READ); error = permission(inode, MAY_READ);
#endif #endif
if (error) if (error)
return error; return error;
}
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size);
buffer, size);
} }
static int static int
ext2_xattr_user_set(struct inode *inode, const char *name, ext2_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags) const void *value, size_t size, int flags)
{ {
int error;
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
if ( !S_ISREG(inode->i_mode) && if ( !S_ISREG(inode->i_mode) &&
(!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
return -EPERM; return -EPERM;
if (!(flags & XATTR_KERNEL_CONTEXT)) {
int error;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
#ifdef CONFIG_EXT2_FS_POSIX_ACL #ifdef CONFIG_EXT2_FS_POSIX_ACL
error = ext2_permission_locked(inode, MAY_WRITE); error = ext2_permission_locked(inode, MAY_WRITE);
#else #else
error = permission(inode, MAY_WRITE); error = permission(inode, MAY_WRITE);
#endif #endif
if (error) if (error)
return error; return error;
}
return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name, return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name,
value, size, flags); value, size, flags);
} }
......
...@@ -431,7 +431,7 @@ ext3_acl_chmod(struct inode *inode) ...@@ -431,7 +431,7 @@ ext3_acl_chmod(struct inode *inode)
*/ */
static size_t static size_t
ext3_xattr_list_acl_access(char *list, struct inode *inode, ext3_xattr_list_acl_access(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const size_t size = sizeof(XATTR_NAME_ACL_ACCESS); const size_t size = sizeof(XATTR_NAME_ACL_ACCESS);
...@@ -444,7 +444,7 @@ ext3_xattr_list_acl_access(char *list, struct inode *inode, ...@@ -444,7 +444,7 @@ ext3_xattr_list_acl_access(char *list, struct inode *inode,
static size_t static size_t
ext3_xattr_list_acl_default(char *list, struct inode *inode, ext3_xattr_list_acl_default(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const size_t size = sizeof(XATTR_NAME_ACL_DEFAULT); const size_t size = sizeof(XATTR_NAME_ACL_DEFAULT);
...@@ -477,7 +477,7 @@ ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size) ...@@ -477,7 +477,7 @@ ext3_xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
static int static int
ext3_xattr_get_acl_access(struct inode *inode, const char *name, ext3_xattr_get_acl_access(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
if (strcmp(name, "") != 0) if (strcmp(name, "") != 0)
return -EINVAL; return -EINVAL;
...@@ -486,7 +486,7 @@ ext3_xattr_get_acl_access(struct inode *inode, const char *name, ...@@ -486,7 +486,7 @@ ext3_xattr_get_acl_access(struct inode *inode, const char *name,
static int static int
ext3_xattr_get_acl_default(struct inode *inode, const char *name, ext3_xattr_get_acl_default(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
if (strcmp(name, "") != 0) if (strcmp(name, "") != 0)
return -EINVAL; return -EINVAL;
......
...@@ -195,7 +195,7 @@ ext3_xattr_handler(int name_index) ...@@ -195,7 +195,7 @@ ext3_xattr_handler(int name_index)
*/ */
ssize_t ssize_t
ext3_getxattr(struct dentry *dentry, const char *name, ext3_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
struct ext3_xattr_handler *handler; struct ext3_xattr_handler *handler;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -203,7 +203,7 @@ ext3_getxattr(struct dentry *dentry, const char *name, ...@@ -203,7 +203,7 @@ ext3_getxattr(struct dentry *dentry, const char *name,
handler = ext3_xattr_resolve_name(&name); handler = ext3_xattr_resolve_name(&name);
if (!handler) if (!handler)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return handler->get(inode, name, buffer, size, flags); return handler->get(inode, name, buffer, size);
} }
/* /*
...@@ -212,9 +212,9 @@ ext3_getxattr(struct dentry *dentry, const char *name, ...@@ -212,9 +212,9 @@ ext3_getxattr(struct dentry *dentry, const char *name,
* dentry->d_inode->i_sem down * dentry->d_inode->i_sem down
*/ */
ssize_t ssize_t
ext3_listxattr(struct dentry *dentry, char *buffer, size_t size, int flags) ext3_listxattr(struct dentry *dentry, char *buffer, size_t size)
{ {
return ext3_xattr_list(dentry->d_inode, buffer, size, flags); return ext3_xattr_list(dentry->d_inode, buffer, size);
} }
/* /*
...@@ -243,7 +243,7 @@ ext3_setxattr(struct dentry *dentry, const char *name, ...@@ -243,7 +243,7 @@ ext3_setxattr(struct dentry *dentry, const char *name,
* dentry->d_inode->i_sem down * dentry->d_inode->i_sem down
*/ */
int int
ext3_removexattr(struct dentry *dentry, const char *name, int flags) ext3_removexattr(struct dentry *dentry, const char *name)
{ {
struct ext3_xattr_handler *handler; struct ext3_xattr_handler *handler;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -251,7 +251,7 @@ ext3_removexattr(struct dentry *dentry, const char *name, int flags) ...@@ -251,7 +251,7 @@ ext3_removexattr(struct dentry *dentry, const char *name, int flags)
handler = ext3_xattr_resolve_name(&name); handler = ext3_xattr_resolve_name(&name);
if (!handler) if (!handler)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return handler->set(inode, name, NULL, 0, flags | XATTR_REPLACE); return handler->set(inode, name, NULL, 0, XATTR_REPLACE);
} }
/* /*
...@@ -364,8 +364,7 @@ bad_block: ext3_error(inode->i_sb, "ext3_xattr_get", ...@@ -364,8 +364,7 @@ bad_block: ext3_error(inode->i_sb, "ext3_xattr_get",
* used / required on success. * used / required on success.
*/ */
int int
ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size, ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
int flags)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct ext3_xattr_entry *entry; struct ext3_xattr_entry *entry;
...@@ -405,7 +404,7 @@ bad_block: ext3_error(inode->i_sb, "ext3_xattr_list", ...@@ -405,7 +404,7 @@ bad_block: ext3_error(inode->i_sb, "ext3_xattr_list",
handler = ext3_xattr_handler(entry->e_name_index); handler = ext3_xattr_handler(entry->e_name_index);
if (handler) if (handler)
size += handler->list(NULL, inode, entry->e_name, size += handler->list(NULL, inode, entry->e_name,
entry->e_name_len, flags); entry->e_name_len);
} }
if (ext3_xattr_cache_insert(bh)) if (ext3_xattr_cache_insert(bh))
...@@ -428,7 +427,7 @@ bad_block: ext3_error(inode->i_sb, "ext3_xattr_list", ...@@ -428,7 +427,7 @@ bad_block: ext3_error(inode->i_sb, "ext3_xattr_list",
handler = ext3_xattr_handler(entry->e_name_index); handler = ext3_xattr_handler(entry->e_name_index);
if (handler) if (handler)
buf += handler->list(buf, inode, entry->e_name, buf += handler->list(buf, inode, entry->e_name,
entry->e_name_len, flags); entry->e_name_len);
} }
error = size; error = size;
......
...@@ -57,9 +57,9 @@ struct ext3_xattr_entry { ...@@ -57,9 +57,9 @@ struct ext3_xattr_entry {
struct ext3_xattr_handler { struct ext3_xattr_handler {
char *prefix; char *prefix;
size_t (*list)(char *list, struct inode *inode, const char *name, size_t (*list)(char *list, struct inode *inode, const char *name,
int name_len, int flags); int name_len);
int (*get)(struct inode *inode, const char *name, void *buffer, int (*get)(struct inode *inode, const char *name, void *buffer,
size_t size, int flags); size_t size);
int (*set)(struct inode *inode, const char *name, const void *buffer, int (*set)(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags); size_t size, int flags);
}; };
...@@ -68,12 +68,12 @@ extern int ext3_xattr_register(int, struct ext3_xattr_handler *); ...@@ -68,12 +68,12 @@ extern int ext3_xattr_register(int, struct ext3_xattr_handler *);
extern void ext3_xattr_unregister(int, struct ext3_xattr_handler *); extern void ext3_xattr_unregister(int, struct ext3_xattr_handler *);
extern int ext3_setxattr(struct dentry *, const char *, const void *, size_t, int); extern int ext3_setxattr(struct dentry *, const char *, const void *, size_t, int);
extern ssize_t ext3_getxattr(struct dentry *, const char *, void *, size_t, int); extern ssize_t ext3_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t ext3_listxattr(struct dentry *, char *, size_t, int); extern ssize_t ext3_listxattr(struct dentry *, char *, size_t);
extern int ext3_removexattr(struct dentry *, const char *, int); extern int ext3_removexattr(struct dentry *, const char *);
extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t); extern int ext3_xattr_get(struct inode *, int, const char *, void *, size_t);
extern int ext3_xattr_list(struct inode *, char *, size_t, int flags); extern int ext3_xattr_list(struct inode *, char *, size_t);
extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int); extern int ext3_xattr_set(struct inode *, int, const char *, const void *, size_t, int);
extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int); extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *, const void *, size_t, int);
...@@ -97,7 +97,7 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name, ...@@ -97,7 +97,7 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name,
} }
static inline int static inline int
ext3_xattr_list(struct inode *inode, void *buffer, size_t size, int flags) ext3_xattr_list(struct inode *inode, void *buffer, size_t size)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
static size_t static size_t
ext3_xattr_trusted_list(char *list, struct inode *inode, ext3_xattr_trusted_list(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1; const int prefix_len = sizeof(XATTR_TRUSTED_PREFIX)-1;
if (!((flags & XATTR_KERNEL_CONTEXT) || capable(CAP_SYS_ADMIN))) if (!capable(CAP_SYS_ADMIN))
return 0; return 0;
if (list) { if (list) {
...@@ -34,11 +34,11 @@ ext3_xattr_trusted_list(char *list, struct inode *inode, ...@@ -34,11 +34,11 @@ ext3_xattr_trusted_list(char *list, struct inode *inode,
static int static int
ext3_xattr_trusted_get(struct inode *inode, const char *name, ext3_xattr_trusted_get(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!((flags & XATTR_KERNEL_CONTEXT) || capable(CAP_SYS_ADMIN))) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name,
buffer, size); buffer, size);
...@@ -50,7 +50,7 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name, ...@@ -50,7 +50,7 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name,
{ {
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!((flags & XATTR_KERNEL_CONTEXT) || capable(CAP_SYS_ADMIN))) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
value, size, flags); value, size, flags);
......
...@@ -21,12 +21,11 @@ ...@@ -21,12 +21,11 @@
static size_t static size_t
ext3_xattr_user_list(char *list, struct inode *inode, ext3_xattr_user_list(char *list, struct inode *inode,
const char *name, int name_len, int flags) const char *name, int name_len)
{ {
const int prefix_len = sizeof(XATTR_USER_PREFIX)-1; const int prefix_len = sizeof(XATTR_USER_PREFIX)-1;
if (!(flags & XATTR_KERNEL_CONTEXT) && if (!test_opt(inode->i_sb, XATTR_USER))
!test_opt(inode->i_sb, XATTR_USER))
return 0; return 0;
if (list) { if (list) {
...@@ -39,49 +38,46 @@ ext3_xattr_user_list(char *list, struct inode *inode, ...@@ -39,49 +38,46 @@ ext3_xattr_user_list(char *list, struct inode *inode,
static int static int
ext3_xattr_user_get(struct inode *inode, const char *name, ext3_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size, int flags) void *buffer, size_t size)
{ {
int error;
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!(flags & XATTR_KERNEL_CONTEXT)) { if (!test_opt(inode->i_sb, XATTR_USER))
int error; return -EOPNOTSUPP;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
#ifdef CONFIG_EXT3_FS_POSIX_ACL #ifdef CONFIG_EXT3_FS_POSIX_ACL
error = ext3_permission_locked(inode, MAY_READ); error = ext3_permission_locked(inode, MAY_READ);
#else #else
error = permission(inode, MAY_READ); error = permission(inode, MAY_READ);
#endif #endif
if (error) if (error)
return error; return error;
}
return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size);
buffer, size);
} }
static int static int
ext3_xattr_user_set(struct inode *inode, const char *name, ext3_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags) const void *value, size_t size, int flags)
{ {
int error;
if (strcmp(name, "") == 0) if (strcmp(name, "") == 0)
return -EINVAL; return -EINVAL;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
if ( !S_ISREG(inode->i_mode) && if ( !S_ISREG(inode->i_mode) &&
(!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
return -EPERM; return -EPERM;
if (!(flags & XATTR_KERNEL_CONTEXT)) {
int error;
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
#ifdef CONFIG_EXT3_FS_POSIX_ACL #ifdef CONFIG_EXT3_FS_POSIX_ACL
error = ext3_permission_locked(inode, MAY_WRITE); error = ext3_permission_locked(inode, MAY_WRITE);
#else #else
error = permission(inode, MAY_WRITE); error = permission(inode, MAY_WRITE);
#endif #endif
if (error) if (error)
return error; return error;
}
return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name,
value, size, flags); value, size, flags);
} }
......
...@@ -57,8 +57,8 @@ extern int __jfs_setxattr(struct inode *, const char *, const void *, size_t, ...@@ -57,8 +57,8 @@ extern int __jfs_setxattr(struct inode *, const char *, const void *, size_t,
extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t, extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t,
int); int);
extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t); extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t, int); extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t jfs_listxattr(struct dentry *, char *, size_t, int); extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
extern int jfs_removexattr(struct dentry *, const char *, int); extern int jfs_removexattr(struct dentry *, const char *);
#endif /* H_JFS_XATTR */ #endif /* H_JFS_XATTR */
...@@ -962,13 +962,12 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, ...@@ -962,13 +962,12 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
} }
ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data, ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,
size_t buf_size, int flags) size_t buf_size)
{ {
return __jfs_getxattr(dentry->d_inode, name, data, buf_size); return __jfs_getxattr(dentry->d_inode, name, data, buf_size);
} }
ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size, ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size)
int flags)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
char *buffer; char *buffer;
...@@ -1014,7 +1013,7 @@ ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size, ...@@ -1014,7 +1013,7 @@ ssize_t jfs_listxattr(struct dentry * dentry, char *data, size_t buf_size,
return size; return size;
} }
int jfs_removexattr(struct dentry *dentry, const char *name, int flags) int jfs_removexattr(struct dentry *dentry, const char *name)
{ {
return __jfs_setxattr(dentry->d_inode, name, 0, 0, XATTR_REPLACE); return __jfs_setxattr(dentry->d_inode, name, 0, 0, XATTR_REPLACE);
} }
...@@ -160,7 +160,7 @@ getxattr(struct dentry *d, char *name, void *value, size_t size) ...@@ -160,7 +160,7 @@ getxattr(struct dentry *d, char *name, void *value, size_t size)
if (error) if (error)
goto out; goto out;
down(&d->d_inode->i_sem); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->getxattr(d, kname, kvalue, size, 0); error = d->d_inode->i_op->getxattr(d, kname, kvalue, size);
up(&d->d_inode->i_sem); up(&d->d_inode->i_sem);
} }
...@@ -233,7 +233,7 @@ listxattr(struct dentry *d, char *list, size_t size) ...@@ -233,7 +233,7 @@ listxattr(struct dentry *d, char *list, size_t size)
if (error) if (error)
goto out; goto out;
down(&d->d_inode->i_sem); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->listxattr(d, klist, size, 0); error = d->d_inode->i_op->listxattr(d, klist, size);
up(&d->d_inode->i_sem); up(&d->d_inode->i_sem);
} }
...@@ -308,7 +308,7 @@ removexattr(struct dentry *d, char *name) ...@@ -308,7 +308,7 @@ removexattr(struct dentry *d, char *name)
if (error) if (error)
goto out; goto out;
down(&d->d_inode->i_sem); down(&d->d_inode->i_sem);
error = d->d_inode->i_op->removexattr(d, kname, 0); error = d->d_inode->i_op->removexattr(d, kname);
up(&d->d_inode->i_sem); up(&d->d_inode->i_sem);
} }
out: out:
......
...@@ -640,8 +640,7 @@ linvfs_getxattr( ...@@ -640,8 +640,7 @@ linvfs_getxattr(
struct dentry *dentry, struct dentry *dentry,
const char *name, const char *name,
void *data, void *data,
size_t size, size_t size)
int flags)
{ {
ssize_t error; ssize_t error;
int xflags = 0; int xflags = 0;
...@@ -698,8 +697,7 @@ STATIC ssize_t ...@@ -698,8 +697,7 @@ STATIC ssize_t
linvfs_listxattr( linvfs_listxattr(
struct dentry *dentry, struct dentry *dentry,
char *data, char *data,
size_t size, size_t size)
int flags)
{ {
ssize_t error; ssize_t error;
int result = 0; int result = 0;
...@@ -743,8 +741,7 @@ linvfs_listxattr( ...@@ -743,8 +741,7 @@ linvfs_listxattr(
STATIC int STATIC int
linvfs_removexattr( linvfs_removexattr(
struct dentry *dentry, struct dentry *dentry,
const char *name, const char *name)
int flags)
{ {
int error; int error;
int xflags = 0; int xflags = 0;
......
...@@ -743,9 +743,9 @@ struct inode_operations { ...@@ -743,9 +743,9 @@ struct inode_operations {
int (*setattr) (struct dentry *, struct iattr *); int (*setattr) (struct dentry *, struct iattr *);
int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t,int); ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
ssize_t (*listxattr) (struct dentry *, char *, size_t, int); ssize_t (*listxattr) (struct dentry *, char *, size_t);
int (*removexattr) (struct dentry *, const char *, int); int (*removexattr) (struct dentry *, const char *);
}; };
struct seq_file; struct seq_file;
......
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
#ifndef _LINUX_XATTR_H #ifndef _LINUX_XATTR_H
#define _LINUX_XATTR_H #define _LINUX_XATTR_H
#define XATTR_CREATE 0x1 /* fail if attr already exists */ #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
#define XATTR_REPLACE 0x2 /* fail if attr does not exist */ #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
#define XATTR_KERNEL_CONTEXT 0x4 /* called from kernel context */
#endif /* _LINUX_XATTR_H */ #endif /* _LINUX_XATTR_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment