Skip to content

Commit

Permalink
xattr_handler: pass dentry and inode as separate arguments of ->get()
Browse files Browse the repository at this point in the history
... and do not assume they are already attached to each other

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Apr 11, 2016
1 parent 79a628d commit b296821
Show file tree
Hide file tree
Showing 31 changed files with 113 additions and 114 deletions.
6 changes: 3 additions & 3 deletions fs/9p/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ int v9fs_acl_mode(struct inode *dir, umode_t *modep,
}

static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct v9fs_session_info *v9ses;
struct posix_acl *acl;
Expand All @@ -227,7 +227,7 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
return v9fs_xattr_get(dentry, handler->name, buffer, size);

acl = v9fs_get_cached_acl(d_inode(dentry), handler->flags);
acl = v9fs_get_cached_acl(inode, handler->flags);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
Expand Down
4 changes: 2 additions & 2 deletions fs/9p/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
}

static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *dentry, struct inode *inode,
const char *name, void *buffer, size_t size)
{
const char *full_name = xattr_full_name(handler, name);

Expand Down
6 changes: 2 additions & 4 deletions fs/btrfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,9 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
}

static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct inode *inode = d_inode(dentry);

name = xattr_full_name(handler, name);
return __btrfs_getxattr(inode, name, buffer, size);
}
Expand Down
6 changes: 3 additions & 3 deletions fs/ext2/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

static int
ext2_xattr_security_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name,
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_SECURITY, name,
buffer, size);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/ext2/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ ext2_xattr_trusted_list(struct dentry *dentry)

static int
ext2_xattr_trusted_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name,
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
buffer, size);
}

Expand Down
8 changes: 4 additions & 4 deletions fs/ext2/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ ext2_xattr_user_list(struct dentry *dentry)

static int
ext2_xattr_user_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
if (!test_opt(dentry->d_sb, XATTR_USER))
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER,
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER,
name, buffer, size);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/ext4/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

static int
ext4_xattr_security_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY,
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_SECURITY,
name, buffer, size);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/ext4/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ ext4_xattr_trusted_list(struct dentry *dentry)

static int
ext4_xattr_trusted_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, void *buffer,
size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED,
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_TRUSTED,
name, buffer, size);
}

Expand Down
8 changes: 4 additions & 4 deletions fs/ext4/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ ext4_xattr_user_list(struct dentry *dentry)

static int
ext4_xattr_user_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
if (!test_opt(dentry->d_sb, XATTR_USER))
if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER,
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER,
name, buffer, size);
}

Expand Down
14 changes: 6 additions & 8 deletions fs/f2fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#include "xattr.h"

static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, void *buffer,
size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
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 @@ -45,7 +45,7 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
default:
return -EINVAL;
}
return f2fs_getxattr(d_inode(dentry), handler->flags, name,
return f2fs_getxattr(inode, handler->flags, name,
buffer, size, NULL);
}

Expand Down Expand Up @@ -86,11 +86,9 @@ static bool f2fs_xattr_trusted_list(struct dentry *dentry)
}

static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name, void *buffer,
size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct inode *inode = d_inode(dentry);

if (buffer)
*((char *)buffer) = F2FS_I(inode)->i_advise;
return sizeof(char);
Expand Down
6 changes: 3 additions & 3 deletions fs/gfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ int gfs2_xattr_acl_get(struct gfs2_inode *ip, const char *name, char **ppdata)
* Returns: actual size of data on success, -errno on error
*/
static int gfs2_xattr_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
struct gfs2_inode *ip = GFS2_I(d_inode(dentry));
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_ea_location el;
int type = handler->flags;
int error;
Expand Down
10 changes: 5 additions & 5 deletions fs/hfsplus/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
return res;
}

ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
ssize_t hfsplus_getxattr(struct inode *inode, const char *name,
void *value, size_t size,
const char *prefix, size_t prefixlen)
{
Expand All @@ -594,7 +594,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
strcpy(xattr_name, prefix);
strcpy(xattr_name + prefixlen, name);

res = __hfsplus_getxattr(d_inode(dentry), xattr_name, value, size);
res = __hfsplus_getxattr(inode, xattr_name, value, size);
kfree(xattr_name);
return res;

Expand Down Expand Up @@ -844,8 +844,8 @@ static int hfsplus_removexattr(struct inode *inode, const char *name)
}

static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
/*
* Don't allow retrieving properly prefixed attributes
Expand All @@ -860,7 +860,7 @@ static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
* creates), so we pass the name through unmodified (after
* ensuring it doesn't conflict with another namespace).
*/
return __hfsplus_getxattr(d_inode(dentry), name, buffer, size);
return __hfsplus_getxattr(inode, name, buffer, size);
}

static int hfsplus_osx_setxattr(const struct xattr_handler *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 @@ -28,7 +28,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
void *value, size_t size);

ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
ssize_t hfsplus_getxattr(struct inode *inode, const char *name,
void *value, size_t size,
const char *prefix, size_t prefixlen);

Expand Down
6 changes: 3 additions & 3 deletions fs/hfsplus/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include "acl.h"

static int hfsplus_security_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return hfsplus_getxattr(dentry, name, buffer, size,
return hfsplus_getxattr(inode, name, buffer, size,
XATTR_SECURITY_PREFIX,
XATTR_SECURITY_PREFIX_LEN);
}
Expand Down
6 changes: 3 additions & 3 deletions fs/hfsplus/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "xattr.h"

static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return hfsplus_getxattr(dentry, name, buffer, size,
return hfsplus_getxattr(inode, name, buffer, size,
XATTR_TRUSTED_PREFIX,
XATTR_TRUSTED_PREFIX_LEN);
}
Expand Down
6 changes: 3 additions & 3 deletions fs/hfsplus/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
#include "xattr.h"

static int hfsplus_user_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{

return hfsplus_getxattr(dentry, name, buffer, size,
return hfsplus_getxattr(inode, name, buffer, size,
XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/jffs2/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,

/* ---- XATTR Handler for "security.*" ----------------- */
static int jffs2_security_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY,
return do_jffs2_getxattr(inode, JFFS2_XPREFIX_SECURITY,
name, buffer, size);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/jffs2/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include "nodelist.h"

static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED,
return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED,
name, buffer, size);
}

Expand Down
6 changes: 3 additions & 3 deletions fs/jffs2/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include "nodelist.h"

static int jffs2_user_getxattr(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER,
return do_jffs2_getxattr(inode, JFFS2_XPREFIX_USER,
name, buffer, size);
}

Expand Down
12 changes: 6 additions & 6 deletions fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6263,10 +6263,10 @@ static int nfs4_xattr_set_nfs4_acl(const struct xattr_handler *handler,
}

static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
struct dentry *dentry, const char *key,
void *buf, size_t buflen)
struct dentry *unused, struct inode *inode,
const char *key, void *buf, size_t buflen)
{
return nfs4_proc_get_acl(d_inode(dentry), buf, buflen);
return nfs4_proc_get_acl(inode, buf, buflen);
}

static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry)
Expand All @@ -6288,11 +6288,11 @@ static int nfs4_xattr_set_nfs4_label(const struct xattr_handler *handler,
}

static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler,
struct dentry *dentry, const char *key,
void *buf, size_t buflen)
struct dentry *unused, struct inode *inode,
const char *key, void *buf, size_t buflen)
{
if (security_ismaclabel(key))
return nfs4_get_security_label(d_inode(dentry), buf, buflen);
return nfs4_get_security_label(inode, buf, buflen);
return -EOPNOTSUPP;
}

Expand Down
20 changes: 10 additions & 10 deletions fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7250,10 +7250,10 @@ int ocfs2_init_security_and_acl(struct inode *dir,
* 'security' attributes support
*/
static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY,
name, buffer, size);
}

Expand Down Expand Up @@ -7321,10 +7321,10 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
* 'trusted' attributes support
*/
static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unused, struct inode *inode,
const char *name, void *buffer, size_t size)
{
return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_TRUSTED,
name, buffer, size);
}

Expand All @@ -7346,14 +7346,14 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
* 'user' attributes support
*/
static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
struct dentry *dentry, const char *name,
void *buffer, size_t size)
struct dentry *unusde, struct inode *inode,
const char *name, void *buffer, size_t size)
{
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)
return -EOPNOTSUPP;
return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_USER, name,
return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_USER, name,
buffer, size);
}

Expand Down
Loading

0 comments on commit b296821

Please sign in to comment.