Skip to content

Commit

Permalink
switch xattr_handler->set() to passing dentry and inode separately
Browse files Browse the repository at this point in the history
preparation for similar switch in ->setxattr() (see the next commit for
rationale).

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 27, 2016
1 parent 0023541 commit 5930122
Show file tree
Hide file tree
Showing 34 changed files with 156 additions and 135 deletions.
6 changes: 3 additions & 3 deletions fs/9p/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *dentry, struct inode *inode,
const char *name, const void *value,
size_t size, int flags)
{
int retval;
struct posix_acl *acl;
struct v9fs_session_info *v9ses;
struct inode *inode = d_inode(dentry);

v9ses = v9fs_dentry2v9ses(dentry);
/*
Expand Down
5 changes: 3 additions & 2 deletions fs/9p/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *dentry, struct inode *inode,
const char *name, const void *value,
size_t size, int flags)
{
const char *full_name = xattr_full_name(handler, name);

Expand Down
12 changes: 5 additions & 7 deletions fs/btrfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
struct dentry *dentry, const char *name,
const void *buffer, size_t size,
int flags)
struct dentry *unused, struct inode *inode,
const char *name, const void *buffer,
size_t size, int flags)
{
struct inode *inode = d_inode(dentry);

name = xattr_full_name(handler, name);
return __btrfs_setxattr(NULL, inode, name, buffer, size, flags);
}

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,
size_t size, int flags)
{
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 = {
Expand Down
7 changes: 4 additions & 3 deletions fs/ceph/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
const char *name, const void *value,
size_t size, int flags)
{
if (!ceph_is_valid_xattr(name))
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 = {
Expand Down
9 changes: 5 additions & 4 deletions fs/cifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
enum { XATTR_USER, XATTR_CIFS_ACL, XATTR_ACL_ACCESS, XATTR_ACL_DEFAULT };

static int cifs_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *dentry, struct inode *inode,
const char *name, const void *value,
size_t size, int flags)
{
int rc = -EOPNOTSUPP;
unsigned int xid;
Expand Down Expand Up @@ -99,12 +100,12 @@ static int cifs_xattr_set(const struct xattr_handler *handler,
if (value &&
pTcon->ses->server->ops->set_acl)
rc = pTcon->ses->server->ops->set_acl(pacl,
size, d_inode(dentry),
size, inode,
full_path, CIFS_ACL_DACL);
else
rc = -EOPNOTSUPP;
if (rc == 0) /* force revalidate of the inode */
CIFS_I(d_inode(dentry))->time = 0;
CIFS_I(inode)->time = 0;
kfree(pacl);
}
#endif /* CONFIG_CIFS_ACL */
Expand Down
7 changes: 4 additions & 3 deletions fs/ext2/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ ext2_xattr_security_get(const struct xattr_handler *handler,

static int
ext2_xattr_security_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/ext2/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ ext2_xattr_trusted_get(const struct xattr_handler *handler,

static int
ext2_xattr_trusted_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
9 changes: 5 additions & 4 deletions fs/ext2/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ ext2_xattr_user_get(const struct xattr_handler *handler,

static int
ext2_xattr_user_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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 ext2_xattr_set(d_inode(dentry), EXT2_XATTR_INDEX_USER,
return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER,
name, value, size, flags);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/ext4/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ ext4_xattr_security_get(const struct xattr_handler *handler,

static int
ext4_xattr_security_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/ext4/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ ext4_xattr_trusted_get(const struct xattr_handler *handler,

static int
ext4_xattr_trusted_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
9 changes: 5 additions & 4 deletions fs/ext4/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ ext4_xattr_user_get(const struct xattr_handler *handler,

static int
ext4_xattr_user_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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 ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER,
return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER,
name, value, size, flags);
}

Expand Down
12 changes: 6 additions & 6 deletions fs/f2fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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)
{
struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);

switch (handler->flags) {
case F2FS_XATTR_INDEX_USER:
Expand All @@ -69,7 +70,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
default:
return -EINVAL;
}
return f2fs_setxattr(d_inode(dentry), handler->flags, name,
return f2fs_setxattr(inode, handler->flags, name,
value, size, NULL, flags);
}

Expand All @@ -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,
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)
{
struct inode *inode = d_inode(dentry);

if (!inode_owner_or_capable(inode))
return -EPERM;
if (value == NULL)
Expand Down
6 changes: 3 additions & 3 deletions fs/gfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,10 +1251,10 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
}

static int gfs2_xattr_set(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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_holder gh;
int ret;
Expand Down
12 changes: 6 additions & 6 deletions fs/hfsplus/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_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 char *prefix, size_t prefixlen)
{
Expand All @@ -437,8 +437,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
return -ENOMEM;
strcpy(xattr_name, prefix);
strcpy(xattr_name + prefixlen, name);
res = __hfsplus_setxattr(d_inode(dentry), xattr_name, value, size,
flags);
res = __hfsplus_setxattr(inode, xattr_name, value, size, flags);
kfree(xattr_name);
return res;
}
Expand Down Expand Up @@ -864,8 +863,9 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
}

static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
const char *name, const void *buffer,
size_t size, int flags)
{
/*
* Don't allow setting properly prefixed attributes
Expand All @@ -880,7 +880,7 @@ static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
* creates), so we pass the name through unmodified (after
* 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 = {
Expand Down
2 changes: 1 addition & 1 deletion fs/hfsplus/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[];
int __hfsplus_setxattr(struct inode *inode, const char *name,
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 char *prefix, size_t prefixlen);

Expand Down
7 changes: 4 additions & 3 deletions fs/hfsplus/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ static int hfsplus_security_getxattr(const struct xattr_handler *handler,
}

static int hfsplus_security_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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_LEN);
}
Expand Down
7 changes: 4 additions & 3 deletions fs/hfsplus/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
}

static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/hfsplus/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ static int hfsplus_user_getxattr(const struct xattr_handler *handler,
}

static int hfsplus_user_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/jffs2/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ static int jffs2_security_getxattr(const struct xattr_handler *handler,
}

static int jffs2_security_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/jffs2/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
}

static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
7 changes: 4 additions & 3 deletions fs/jffs2/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ static int jffs2_user_getxattr(const struct xattr_handler *handler,
}

static int jffs2_user_setxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
const void *buffer, size_t size, int flags)
struct dentry *unused, struct inode *inode,
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);
}

Expand Down
Loading

0 comments on commit 5930122

Please sign in to comment.