Commit 59301226 authored by Al Viro's avatar Al Viro

switch xattr_handler->set() to passing dentry and inode separately

preparation for similar switch in ->setxattr() (see the next commit for
rationale).
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 00235411
...@@ -239,13 +239,13 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler, ...@@ -239,13 +239,13 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
} }
static int v9fs_xattr_set_acl(const struct xattr_handler *handler, static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *dentry, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
int retval; int retval;
struct posix_acl *acl; struct posix_acl *acl;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
struct inode *inode = d_inode(dentry);
v9ses = v9fs_dentry2v9ses(dentry); v9ses = v9fs_dentry2v9ses(dentry);
/* /*
......
...@@ -147,8 +147,9 @@ static int v9fs_xattr_handler_get(const struct xattr_handler *handler, ...@@ -147,8 +147,9 @@ static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
} }
static int v9fs_xattr_handler_set(const struct xattr_handler *handler, static int v9fs_xattr_handler_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *dentry, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
const char *full_name = xattr_full_name(handler, name); const char *full_name = xattr_full_name(handler, name);
......
...@@ -380,23 +380,21 @@ static int btrfs_xattr_handler_get(const struct xattr_handler *handler, ...@@ -380,23 +380,21 @@ static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
} }
static int btrfs_xattr_handler_set(const struct xattr_handler *handler, static int btrfs_xattr_handler_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, const char *name, const void *buffer,
int flags) size_t size, int flags)
{ {
struct inode *inode = d_inode(dentry);
name = xattr_full_name(handler, name); name = xattr_full_name(handler, name);
return __btrfs_setxattr(NULL, inode, name, buffer, size, flags); return __btrfs_setxattr(NULL, inode, name, buffer, size, flags);
} }
static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler, static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
struct dentry *dentry, struct dentry *unused, struct inode *inode,
const char *name, const void *value, const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
{ {
name = xattr_full_name(handler, name); name = xattr_full_name(handler, name);
return btrfs_set_prop(d_inode(dentry), name, value, size, flags); return btrfs_set_prop(inode, name, value, size, flags);
} }
static const struct xattr_handler btrfs_security_xattr_handler = { static const struct xattr_handler btrfs_security_xattr_handler = {
......
...@@ -1051,12 +1051,13 @@ static int ceph_get_xattr_handler(const struct xattr_handler *handler, ...@@ -1051,12 +1051,13 @@ static int ceph_get_xattr_handler(const struct xattr_handler *handler,
} }
static int ceph_set_xattr_handler(const struct xattr_handler *handler, static int ceph_set_xattr_handler(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
if (!ceph_is_valid_xattr(name)) if (!ceph_is_valid_xattr(name))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return __ceph_setxattr(d_inode(dentry), name, value, size, flags); return __ceph_setxattr(inode, name, value, size, flags);
} }
const struct xattr_handler ceph_other_xattr_handler = { const struct xattr_handler ceph_other_xattr_handler = {
......
...@@ -39,8 +39,9 @@ ...@@ -39,8 +39,9 @@
enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT }; enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT };
static int cifs_xattr_set(const struct xattr_handler *handler, static int cifs_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *dentry, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
unsigned int xid; unsigned int xid;
...@@ -99,12 +100,12 @@ static int cifs_xattr_set(const struct xattr_handler *handler, ...@@ -99,12 +100,12 @@ static int cifs_xattr_set(const struct xattr_handler *handler,
if (value && if (value &&
pTcon->ses->server->ops->set_acl) pTcon->ses->server->ops->set_acl)
rc = pTcon->ses->server->ops->set_acl(pacl, rc = pTcon->ses->server->ops->set_acl(pacl,
size, d_inode(dentry), size, inode,
full_path, CIFS_ACL_DACL); full_path, CIFS_ACL_DACL);
else else
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
if (rc == 0) /* force revalidate of the inode */ if (rc == 0) /* force revalidate of the inode */
CIFS_I(d_inode(dentry))->time = 0; CIFS_I(inode)->time = 0;
kfree(pacl); kfree(pacl);
} }
#endif /* CONFIG_CIFS_ACL */ #endif /* CONFIG_CIFS_ACL */
......
...@@ -18,10 +18,11 @@ ext2_xattr_security_get(const struct xattr_handler *handler, ...@@ -18,10 +18,11 @@ ext2_xattr_security_get(const struct xattr_handler *handler,
static int static int
ext2_xattr_security_set(const struct xattr_handler *handler, ext2_xattr_security_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name, return ext2_xattr_set(inode, EXT2_XATTR_INDEX_SECURITY, name,
value, size, flags); value, size, flags);
} }
......
...@@ -25,10 +25,11 @@ ext2_xattr_trusted_get(const struct xattr_handler *handler, ...@@ -25,10 +25,11 @@ ext2_xattr_trusted_get(const struct xattr_handler *handler,
static int static int
ext2_xattr_trusted_set(const struct xattr_handler *handler, ext2_xattr_trusted_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name, return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name,
value, size, flags); value, size, flags);
} }
......
...@@ -29,13 +29,14 @@ ext2_xattr_user_get(const struct xattr_handler *handler, ...@@ -29,13 +29,14 @@ ext2_xattr_user_get(const struct xattr_handler *handler,
static int static int
ext2_xattr_user_set(const struct xattr_handler *handler, ext2_xattr_user_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
if (!test_opt(dentry->d_sb, XATTR_USER)) if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER, return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER,
name, value, size, flags); name, value, size, flags);
} }
......
...@@ -22,10 +22,11 @@ ext4_xattr_security_get(const struct xattr_handler *handler, ...@@ -22,10 +22,11 @@ ext4_xattr_security_get(const struct xattr_handler *handler,
static int static int
ext4_xattr_security_set(const struct xattr_handler *handler, ext4_xattr_security_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY, return ext4_xattr_set(inode, EXT4_XATTR_INDEX_SECURITY,
name, value, size, flags); name, value, size, flags);
} }
......
...@@ -29,10 +29,11 @@ ext4_xattr_trusted_get(const struct xattr_handler *handler, ...@@ -29,10 +29,11 @@ ext4_xattr_trusted_get(const struct xattr_handler *handler,
static int static int
ext4_xattr_trusted_set(const struct xattr_handler *handler, ext4_xattr_trusted_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED, return ext4_xattr_set(inode, EXT4_XATTR_INDEX_TRUSTED,
name, value, size, flags); name, value, size, flags);
} }
......
...@@ -30,12 +30,13 @@ ext4_xattr_user_get(const struct xattr_handler *handler, ...@@ -30,12 +30,13 @@ ext4_xattr_user_get(const struct xattr_handler *handler,
static int static int
ext4_xattr_user_set(const struct xattr_handler *handler, ext4_xattr_user_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
if (!test_opt(dentry->d_sb, XATTR_USER)) if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER, return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER,
name, value, size, flags); name, value, size, flags);
} }
......
...@@ -50,10 +50,11 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler, ...@@ -50,10 +50,11 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
} }
static int f2fs_xattr_generic_set(const struct xattr_handler *handler, static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, const void *value, struct dentry *unused, struct inode *inode,
const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
{ {
struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb); struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
switch (handler->flags) { switch (handler->flags) {
case F2FS_XATTR_INDEX_USER: case F2FS_XATTR_INDEX_USER:
...@@ -69,7 +70,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler, ...@@ -69,7 +70,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
default: default:
return -EINVAL; return -EINVAL;
} }
return f2fs_setxattr(d_inode(dentry), handler->flags, name, return f2fs_setxattr(inode, handler->flags, name,
value, size, NULL, flags); value, size, NULL, flags);
} }
...@@ -95,11 +96,10 @@ static int f2fs_xattr_advise_get(const struct xattr_handler *handler, ...@@ -95,11 +96,10 @@ static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
} }
static int f2fs_xattr_advise_set(const struct xattr_handler *handler, static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, const void *value, struct dentry *unused, struct inode *inode,
const char *name, const void *value,
size_t size, int flags) size_t size, int flags)
{ {
struct inode *inode = d_inode(dentry);
if (!inode_owner_or_capable(inode)) if (!inode_owner_or_capable(inode))
return -EPERM; return -EPERM;
if (value == NULL) if (value == NULL)
......
...@@ -1251,10 +1251,10 @@ int __gfs2_xattr_set(struct inode *inode, const char *name, ...@@ -1251,10 +1251,10 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
} }
static int gfs2_xattr_set(const struct xattr_handler *handler, static int gfs2_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct inode *inode = d_inode(dentry);
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_holder gh; struct gfs2_holder gh;
int ret; int ret;
......
...@@ -424,7 +424,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len) ...@@ -424,7 +424,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len)
return len; return len;
} }
int hfsplus_setxattr(struct dentry *dentry, const char *name, int hfsplus_setxattr(struct inode *inode, const char *name,
const void *value, size_t size, int flags, const void *value, size_t size, int flags,
const char *prefix, size_t prefixlen) const char *prefix, size_t prefixlen)
{ {
...@@ -437,8 +437,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name, ...@@ -437,8 +437,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
return -ENOMEM; return -ENOMEM;
strcpy(xattr_name, prefix); strcpy(xattr_name, prefix);
strcpy(xattr_name + prefixlen, name); strcpy(xattr_name + prefixlen, name);
res = __hfsplus_setxattr(d_inode(dentry), xattr_name, value, size, res = __hfsplus_setxattr(inode, xattr_name, value, size, flags);
flags);
kfree(xattr_name); kfree(xattr_name);
return res; return res;
} }
...@@ -864,8 +863,9 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler, ...@@ -864,8 +863,9 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
} }
static int hfsplus_osx_setxattr(const struct xattr_handler *handler, static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
/* /*
* Don't allow setting properly prefixed attributes * Don't allow setting properly prefixed attributes
...@@ -880,7 +880,7 @@ static int hfsplus_osx_setxattr(const struct xattr_handler *handler, ...@@ -880,7 +880,7 @@ static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
* creates), so we pass the name through unmodified (after * creates), so we pass the name through unmodified (after
* ensuring it doesn't conflict with another namespace). * ensuring it doesn't conflict with another namespace).
*/ */
return __hfsplus_setxattr(d_inode(dentry), name, buffer, size, flags); return __hfsplus_setxattr(inode, name, buffer, size, flags);
} }
const struct xattr_handler hfsplus_xattr_osx_handler = { const struct xattr_handler hfsplus_xattr_osx_handler = {
......
...@@ -21,7 +21,7 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[]; ...@@ -21,7 +21,7 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[];
int __hfsplus_setxattr(struct inode *inode, const char *name, int __hfsplus_setxattr(struct inode *inode, const char *name,
const void *value, size_t size, int flags); const void *value, size_t size, int flags);
int hfsplus_setxattr(struct dentry *dentry, const char *name, int hfsplus_setxattr(struct inode *inode, const char *name,
const void *value, size_t size, int flags, const void *value, size_t size, int flags,
const char *prefix, size_t prefixlen); const char *prefix, size_t prefixlen);
......
...@@ -23,10 +23,11 @@ static int hfsplus_security_getxattr(const struct xattr_handler *handler, ...@@ -23,10 +23,11 @@ static int hfsplus_security_getxattr(const struct xattr_handler *handler,
} }
static int hfsplus_security_setxattr(const struct xattr_handler *handler, static int hfsplus_security_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
return hfsplus_setxattr(dentry, name, buffer, size, flags, return hfsplus_setxattr(inode, name, buffer, size, flags,
XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX,
XATTR_SECURITY_PREFIX_LEN); XATTR_SECURITY_PREFIX_LEN);
} }
......
...@@ -21,10 +21,11 @@ static int hfsplus_trusted_getxattr(const struct xattr_handler *handler, ...@@ -21,10 +21,11 @@ static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
} }
static int hfsplus_trusted_setxattr(const struct xattr_handler *handler, static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
return hfsplus_setxattr(dentry, name, buffer, size, flags, return hfsplus_setxattr(inode, name, buffer, size, flags,
XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
} }
......
...@@ -21,10 +21,11 @@ static int hfsplus_user_getxattr(const struct xattr_handler *handler, ...@@ -21,10 +21,11 @@ static int hfsplus_user_getxattr(const struct xattr_handler *handler,
} }
static int hfsplus_user_setxattr(const struct xattr_handler *handler, static int hfsplus_user_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
return hfsplus_setxattr(dentry, name, buffer, size, flags, return hfsplus_setxattr(inode, name, buffer, size, flags,
XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
} }
......
...@@ -57,10 +57,11 @@ static int jffs2_security_getxattr(const struct xattr_handler *handler, ...@@ -57,10 +57,11 @@ static int jffs2_security_getxattr(const struct xattr_handler *handler,
} }
static int jffs2_security_setxattr(const struct xattr_handler *handler, static int jffs2_security_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY, return do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY,
name, buffer, size, flags); name, buffer, size, flags);
} }
......
...@@ -25,10 +25,11 @@ static int jffs2_trusted_getxattr(const struct xattr_handler *handler, ...@@ -25,10 +25,11 @@ static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
} }
static int jffs2_trusted_setxattr(const struct xattr_handler *handler, static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED, return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED,
name, buffer, size, flags); name, buffer, size, flags);
} }
......
...@@ -25,10 +25,11 @@ static int jffs2_user_getxattr(const struct xattr_handler *handler, ...@@ -25,10 +25,11 @@ static int jffs2_user_getxattr(const struct xattr_handler *handler,
} }
static int jffs2_user_setxattr(const struct xattr_handler *handler, static int jffs2_user_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *buffer, size_t size, int flags) const char *name, const void *buffer,
size_t size, int flags)
{ {
return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER, return do_jffs2_setxattr(inode, JFFS2_XPREFIX_USER,
name, buffer, size, flags); name, buffer, size, flags);
} }
......
...@@ -943,11 +943,10 @@ static int jfs_xattr_get(const struct xattr_handler *handler, ...@@ -943,11 +943,10 @@ static int jfs_xattr_get(const struct xattr_handler *handler,
} }
static int jfs_xattr_set(const struct xattr_handler *handler, static int jfs_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct inode *inode = d_inode(dentry);
name = xattr_full_name(handler, name); name = xattr_full_name(handler, name);
return __jfs_xattr_set(inode, name, value, size, flags); return __jfs_xattr_set(inode, name, value, size, flags);
} }
...@@ -962,11 +961,10 @@ static int jfs_xattr_get_os2(const struct xattr_handler *handler, ...@@ -962,11 +961,10 @@ static int jfs_xattr_get_os2(const struct xattr_handler *handler,
} }
static int jfs_xattr_set_os2(const struct xattr_handler *handler, static int jfs_xattr_set_os2(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct inode *inode = d_inode(dentry);
if (is_known_namespace(name)) if (is_known_namespace(name))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return __jfs_xattr_set(inode, name, value, size, flags); return __jfs_xattr_set(inode, name, value, size, flags);
......
...@@ -4993,12 +4993,11 @@ static int nfs4_do_set_security_label(struct inode *inode, ...@@ -4993,12 +4993,11 @@ static int nfs4_do_set_security_label(struct inode *inode,
} }
static int static int
nfs4_set_security_label(struct dentry *dentry, const void *buf, size_t buflen) nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen)
{ {
struct nfs4_label ilabel, *olabel = NULL; struct nfs4_label ilabel, *olabel = NULL;
struct nfs_fattr fattr; struct nfs_fattr fattr;
struct rpc_cred *cred; struct rpc_cred *cred;
struct inode *inode = d_inode(dentry);
int status; int status;
if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL))
...@@ -6255,11 +6254,11 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp) ...@@ -6255,11 +6254,11 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl" #define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler, static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler,
struct dentry *dentry, const char *key, struct dentry *unused, struct inode *inode,
const void *buf, size_t buflen, const char *key, const void *buf,
int flags) size_t buflen, int flags)
{ {
return nfs4_proc_set_acl(d_inode(dentry), buf, buflen); return nfs4_proc_set_acl(inode, buf, buflen);
} }
static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler, static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
...@@ -6277,12 +6276,12 @@ static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry) ...@@ -6277,12 +6276,12 @@ static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry)
#ifdef CONFIG_NFS_V4_SECURITY_LABEL #ifdef CONFIG_NFS_V4_SECURITY_LABEL
static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler, static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
struct dentry *dentry, const char *key, struct dentry *unused, struct inode *inode,
const void *buf, size_t buflen, const char *key, const void *buf,
int flags) size_t buflen, int flags)
{ {
if (security_ismaclabel(key)) if (security_ismaclabel(key))
return nfs4_set_security_label(dentry, buf, buflen); return nfs4_set_security_label(inode, buf, buflen);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -7254,10 +7254,11 @@ static int ocfs2_xattr_security_get(const struct xattr_handler *handler, ...@@ -7254,10 +7254,11 @@ static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
} }
static int ocfs2_xattr_security_set(const struct xattr_handler *handler, static int ocfs2_xattr_security_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY, return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
name, value, size, flags); name, value, size, flags);
} }
...@@ -7325,10 +7326,11 @@ static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler, ...@@ -7325,10 +7326,11 @@ static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
} }
static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler, static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED, return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_TRUSTED,
name, value, size, flags); name, value, size, flags);
} }
...@@ -7354,15 +7356,16 @@ static int ocfs2_xattr_user_get(const struct xattr_handler *handler, ...@@ -7354,15 +7356,16 @@ static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
} }
static int ocfs2_xattr_user_set(const struct xattr_handler *handler, static int ocfs2_xattr_user_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR) if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_USER, return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_USER,
name, value, size, flags); name, value, size, flags);
} }
......
...@@ -448,13 +448,14 @@ ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size) ...@@ -448,13 +448,14 @@ ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size)
} }
static int orangefs_xattr_set_default(const struct xattr_handler *handler, static int orangefs_xattr_set_default(const struct xattr_handler *handler,
struct dentry *dentry, struct dentry *unused,
struct inode *inode,
const char *name, const char *name,
const void *buffer, const void *buffer,
size_t size, size_t size,
int flags) int flags)
{ {
return orangefs_inode_setxattr(dentry->d_inode, return orangefs_inode_setxattr(inode,
ORANGEFS_XATTR_NAME_DEFAULT_PREFIX, ORANGEFS_XATTR_NAME_DEFAULT_PREFIX,
name, name,
buffer, buffer,
...@@ -478,13 +479,14 @@ static int orangefs_xattr_get_default(const struct xattr_handler *handler, ...@@ -478,13 +479,14 @@ static int orangefs_xattr_get_default(const struct xattr_handler *handler,
} }
static int orangefs_xattr_set_trusted(const struct xattr_handler *handler, static int orangefs_xattr_set_trusted(const struct xattr_handler *handler,
struct dentry *dentry, struct dentry *unused,
struct inode *inode,
const char *name, const char *name,
const void *buffer, const void *buffer,
size_t size, size_t size,
int flags) int flags)
{ {
return orangefs_inode_setxattr(dentry->d_inode, return orangefs_inode_setxattr(inode,
ORANGEFS_XATTR_NAME_TRUSTED_PREFIX, ORANGEFS_XATTR_NAME_TRUSTED_PREFIX,
name, name,
buffer, buffer,
......
...@@ -822,10 +822,10 @@ posix_acl_xattr_get(const struct xattr_handler *handler, ...@@ -822,10 +822,10 @@ posix_acl_xattr_get(const struct xattr_handler *handler,
static int static int
posix_acl_xattr_set(const struct xattr_handler *handler, posix_acl_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct inode *inode = d_backing_inode(dentry);
struct posix_acl *acl = NULL; struct posix_acl *acl = NULL;
int ret; int ret;
......
...@@ -20,13 +20,14 @@ security_get(const struct xattr_handler *handler, struct dentry *unused, ...@@ -20,13 +20,14 @@ security_get(const struct xattr_handler *handler, struct dentry *unused,
} }
static int static int
security_set(const struct xattr_handler *handler, struct dentry *dentry, security_set(const struct xattr_handler *handler, struct dentry *unused,
const char *name, const void *buffer, size_t size, int flags) struct inode *inode, const char *name, const void *buffer,
size_t size, int flags)
{ {
if (IS_PRIVATE(d_inode(dentry))) if (IS_PRIVATE(inode))
return -EPERM; return -EPERM;
return reiserfs_xattr_set(d_inode(dentry), return reiserfs_xattr_set(inode,
xattr_full_name(handler, name), xattr_full_name(handler, name),
buffer, size, flags); buffer, size, flags);
} }
......
...@@ -19,13 +19,14 @@ trusted_get(const struct xattr_handler *handler, struct dentry *unused, ...@@ -19,13 +19,14 @@ trusted_get(const struct xattr_handler *handler, struct dentry *unused,
} }
static int static int
trusted_set(const struct xattr_handler *handler, struct dentry *dentry, trusted_set(const struct xattr_handler *handler, struct dentry *unused,
const char *name, const void *buffer, size_t size, int flags) struct inode *inode, const char *name, const void *buffer,
size_t size, int flags)
{ {
if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry))) if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM; return -EPERM;
return reiserfs_xattr_set(d_inode(dentry), return reiserfs_xattr_set(inode,
xattr_full_name(handler, name), xattr_full_name(handler, name),
buffer, size, flags); buffer, size, flags);
} }
......
...@@ -17,12 +17,13 @@ user_get(const struct xattr_handler *handler, struct dentry *unused, ...@@ -17,12 +17,13 @@ user_get(const struct xattr_handler *handler, struct dentry *unused,
} }
static int static int
user_set(const struct xattr_handler *handler, struct dentry *dentry, user_set(const struct xattr_handler *handler, struct dentry *unused,
const char *name, const void *buffer, size_t size, int flags) struct inode *inode, const char *name, const void *buffer,
size_t size, int flags)
{ {
if (!reiserfs_xattrs_user(dentry->d_sb)) if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP; return -EOPNOTSUPP;
return reiserfs_xattr_set(d_inode(dentry), return reiserfs_xattr_set(inode,
xattr_full_name(handler, name), xattr_full_name(handler, name),
buffer, size, flags); buffer, size, flags);
} }
......
...@@ -579,11 +579,10 @@ static int ubifs_xattr_get(const struct xattr_handler *handler, ...@@ -579,11 +579,10 @@ static int ubifs_xattr_get(const struct xattr_handler *handler,
} }
static int ubifs_xattr_set(const struct xattr_handler *handler, static int ubifs_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *dentry, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct inode *inode = d_inode(dentry);
dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd", dbg_gen("xattr '%s', host ino %lu ('%pd'), size %zd",
name, inode->i_ino, dentry, size); name, inode->i_ino, dentry, size);
......
...@@ -754,7 +754,8 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz ...@@ -754,7 +754,8 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (IS_ERR(handler)) if (IS_ERR(handler))
return PTR_ERR(handler); return PTR_ERR(handler);
return handler->set(handler, dentry, name, value, size, flags); return handler->set(handler, dentry, d_inode(dentry), name, value,
size, flags);
} }
/* /*
...@@ -769,7 +770,8 @@ generic_removexattr(struct dentry *dentry, const char *name) ...@@ -769,7 +770,8 @@ generic_removexattr(struct dentry *dentry, const char *name)
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (IS_ERR(handler)) if (IS_ERR(handler))
return PTR_ERR(handler); return PTR_ERR(handler);
return handler->set(handler, dentry, name, NULL, 0, XATTR_REPLACE); return handler->set(handler, dentry, d_inode(dentry), name, NULL,
0, XATTR_REPLACE);
} }
EXPORT_SYMBOL(generic_getxattr); EXPORT_SYMBOL(generic_getxattr);
......
...@@ -74,11 +74,12 @@ xfs_forget_acl( ...@@ -74,11 +74,12 @@ xfs_forget_acl(
} }
static int static int
xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
const char *name, const void *value, size_t size, int flags) struct inode *inode, const char *name, const void *value,
size_t size, int flags)
{ {
int xflags = handler->flags; int xflags = handler->flags;
struct xfs_inode *ip = XFS_I(d_inode(dentry)); struct xfs_inode *ip = XFS_I(inode);
int error; int error;
/* Convert Linux syscall to XFS internal ATTR flags */ /* Convert Linux syscall to XFS internal ATTR flags */
...@@ -92,7 +93,7 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry, ...@@ -92,7 +93,7 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *dentry,
error = xfs_attr_set(ip, (unsigned char *)name, error = xfs_attr_set(ip, (unsigned char *)name,
(void *)value, size, xflags); (void *)value, size, xflags);
if (!error) if (!error)
xfs_forget_acl(d_inode(dentry), name, xflags); xfs_forget_acl(inode, name, xflags);
return error; return error;
} }
......
...@@ -33,8 +33,8 @@ struct xattr_handler { ...@@ -33,8 +33,8 @@ struct xattr_handler {
struct inode *inode, const char *name, void *buffer, struct inode *inode, const char *name, void *buffer,
size_t size); size_t size);
int (*set)(const struct xattr_handler *, struct dentry *dentry, int (*set)(const struct xattr_handler *, struct dentry *dentry,
const char *name, const void *buffer, size_t size, struct inode *inode, const char *name, const void *buffer,
int flags); size_t size, int flags);
}; };
const char *xattr_full_name(const struct xattr_handler *, const char *); const char *xattr_full_name(const struct xattr_handler *, const char *);
......
...@@ -2645,10 +2645,11 @@ static int shmem_xattr_handler_get(const struct xattr_handler *handler, ...@@ -2645,10 +2645,11 @@ static int shmem_xattr_handler_get(const struct xattr_handler *handler,
} }
static int shmem_xattr_handler_set(const struct xattr_handler *handler, static int shmem_xattr_handler_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, struct dentry *unused, struct inode *inode,
const void *value, size_t size, int flags) const char *name, const void *value,
size_t size, int flags)
{ {
struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); struct shmem_inode_info *info = SHMEM_I(inode);
name = xattr_full_name(handler, name); name = xattr_full_name(handler, name);
return simple_xattr_set(&info->xattrs, name, value, size, flags); return simple_xattr_set(&info->xattrs, name, value, size, flags);
......
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