xattr_handler: pass dentry and inode as separate arguments of ->get()
... and do not assume they are already attached to each other Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
79a628d14e
commit
b296821a7c
|
@ -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,
|
static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *dentry, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct v9fs_session_info *v9ses;
|
struct v9fs_session_info *v9ses;
|
||||||
struct posix_acl *acl;
|
struct posix_acl *acl;
|
||||||
|
@ -227,7 +227,7 @@ static int v9fs_xattr_get_acl(const struct xattr_handler *handler,
|
||||||
if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
|
if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT)
|
||||||
return v9fs_xattr_get(dentry, handler->name, buffer, size);
|
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))
|
if (IS_ERR(acl))
|
||||||
return PTR_ERR(acl);
|
return PTR_ERR(acl);
|
||||||
if (acl == NULL)
|
if (acl == NULL)
|
||||||
|
|
|
@ -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,
|
static int v9fs_xattr_handler_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *dentry, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
const char *full_name = xattr_full_name(handler, name);
|
const char *full_name = xattr_full_name(handler, name);
|
||||||
|
|
||||||
|
|
|
@ -369,11 +369,9 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
|
static int btrfs_xattr_handler_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
|
||||||
|
|
||||||
name = xattr_full_name(handler, name);
|
name = xattr_full_name(handler, name);
|
||||||
return __btrfs_getxattr(inode, name, buffer, size);
|
return __btrfs_getxattr(inode, name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ext2_xattr_security_get(const struct xattr_handler *handler,
|
ext2_xattr_security_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ ext2_xattr_trusted_list(struct dentry *dentry)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ext2_xattr_trusted_get(const struct xattr_handler *handler,
|
ext2_xattr_trusted_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,12 @@ ext2_xattr_user_list(struct dentry *dentry)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ext2_xattr_user_get(const struct xattr_handler *handler,
|
ext2_xattr_user_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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 -EOPNOTSUPP;
|
||||||
return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_USER,
|
return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER,
|
||||||
name, buffer, size);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ext4_xattr_security_get(const struct xattr_handler *handler,
|
ext4_xattr_security_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ ext4_xattr_trusted_list(struct dentry *dentry)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ext4_xattr_trusted_get(const struct xattr_handler *handler,
|
ext4_xattr_trusted_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name, void *buffer,
|
struct dentry *unused, struct inode *inode,
|
||||||
size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,12 @@ ext4_xattr_user_list(struct dentry *dentry)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ext4_xattr_user_get(const struct xattr_handler *handler,
|
ext4_xattr_user_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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 -EOPNOTSUPP;
|
||||||
return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER,
|
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER,
|
||||||
name, buffer, size);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
|
|
||||||
static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
|
static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name, void *buffer,
|
struct dentry *unused, struct inode *inode,
|
||||||
size_t size)
|
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) {
|
switch (handler->flags) {
|
||||||
case F2FS_XATTR_INDEX_USER:
|
case F2FS_XATTR_INDEX_USER:
|
||||||
|
@ -45,7 +45,7 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return f2fs_getxattr(d_inode(dentry), handler->flags, name,
|
return f2fs_getxattr(inode, handler->flags, name,
|
||||||
buffer, size, NULL);
|
buffer, size, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,11 +86,9 @@ static bool f2fs_xattr_trusted_list(struct dentry *dentry)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
|
static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name, void *buffer,
|
struct dentry *unused, struct inode *inode,
|
||||||
size_t size)
|
const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
struct inode *inode = d_inode(dentry);
|
|
||||||
|
|
||||||
if (buffer)
|
if (buffer)
|
||||||
*((char *)buffer) = F2FS_I(inode)->i_advise;
|
*((char *)buffer) = F2FS_I(inode)->i_advise;
|
||||||
return sizeof(char);
|
return sizeof(char);
|
||||||
|
|
|
@ -584,10 +584,10 @@ out:
|
||||||
* Returns: actual size of data on success, -errno on error
|
* Returns: actual size of data on success, -errno on error
|
||||||
*/
|
*/
|
||||||
static int gfs2_xattr_get(const struct xattr_handler *handler,
|
static int gfs2_xattr_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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;
|
struct gfs2_ea_location el;
|
||||||
int type = handler->flags;
|
int type = handler->flags;
|
||||||
int error;
|
int error;
|
||||||
|
|
|
@ -579,7 +579,7 @@ failed_getxattr_init:
|
||||||
return res;
|
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,
|
void *value, size_t size,
|
||||||
const char *prefix, size_t prefixlen)
|
const char *prefix, size_t prefixlen)
|
||||||
{
|
{
|
||||||
|
@ -594,7 +594,7 @@ ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name,
|
||||||
strcpy(xattr_name, prefix);
|
strcpy(xattr_name, prefix);
|
||||||
strcpy(xattr_name + prefixlen, name);
|
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);
|
kfree(xattr_name);
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
@ -844,8 +844,8 @@ end_removexattr:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
|
static int hfsplus_osx_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Don't allow retrieving properly prefixed attributes
|
* Don't allow retrieving properly prefixed attributes
|
||||||
|
@ -860,7 +860,7 @@ static int hfsplus_osx_getxattr(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_getxattr(d_inode(dentry), name, buffer, size);
|
return __hfsplus_getxattr(inode, name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
|
static int hfsplus_osx_setxattr(const struct xattr_handler *handler,
|
||||||
|
|
|
@ -28,7 +28,7 @@ int hfsplus_setxattr(struct dentry *dentry, const char *name,
|
||||||
ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
|
ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
|
||||||
void *value, size_t size);
|
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,
|
void *value, size_t size,
|
||||||
const char *prefix, size_t prefixlen);
|
const char *prefix, size_t prefixlen);
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include "acl.h"
|
#include "acl.h"
|
||||||
|
|
||||||
static int hfsplus_security_getxattr(const struct xattr_handler *handler,
|
static int hfsplus_security_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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,
|
||||||
XATTR_SECURITY_PREFIX_LEN);
|
XATTR_SECURITY_PREFIX_LEN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
|
|
||||||
static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
|
static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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,
|
||||||
XATTR_TRUSTED_PREFIX_LEN);
|
XATTR_TRUSTED_PREFIX_LEN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
|
|
||||||
static int hfsplus_user_getxattr(const struct xattr_handler *handler,
|
static int hfsplus_user_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,10 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,
|
||||||
|
|
||||||
/* ---- XATTR Handler for "security.*" ----------------- */
|
/* ---- XATTR Handler for "security.*" ----------------- */
|
||||||
static int jffs2_security_getxattr(const struct xattr_handler *handler,
|
static int jffs2_security_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
#include "nodelist.h"
|
#include "nodelist.h"
|
||||||
|
|
||||||
static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
|
static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
#include "nodelist.h"
|
#include "nodelist.h"
|
||||||
|
|
||||||
static int jffs2_user_getxattr(const struct xattr_handler *handler,
|
static int jffs2_user_getxattr(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
static int nfs4_xattr_get_nfs4_acl(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *key,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buf, size_t buflen)
|
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)
|
static bool nfs4_xattr_list_nfs4_acl(struct dentry *dentry)
|
||||||
|
@ -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,
|
static int nfs4_xattr_get_nfs4_label(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *key,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buf, size_t buflen)
|
const char *key, void *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
if (security_ismaclabel(key))
|
if (security_ismaclabel(key))
|
||||||
return nfs4_get_security_label(d_inode(dentry), buf, buflen);
|
return nfs4_get_security_label(inode, buf, buflen);
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7250,10 +7250,10 @@ leave:
|
||||||
* 'security' attributes support
|
* 'security' attributes support
|
||||||
*/
|
*/
|
||||||
static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
|
static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7321,10 +7321,10 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
|
||||||
* 'trusted' attributes support
|
* 'trusted' attributes support
|
||||||
*/
|
*/
|
||||||
static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
|
static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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);
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7346,14 +7346,14 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
|
||||||
* 'user' attributes support
|
* 'user' attributes support
|
||||||
*/
|
*/
|
||||||
static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
|
static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unusde, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
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)
|
if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
|
||||||
return -EOPNOTSUPP;
|
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);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,12 +478,13 @@ static int orangefs_xattr_set_default(const struct xattr_handler *handler,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int orangefs_xattr_get_default(const struct xattr_handler *handler,
|
static int orangefs_xattr_get_default(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry,
|
struct dentry *unused,
|
||||||
|
struct inode *inode,
|
||||||
const char *name,
|
const char *name,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
return orangefs_inode_getxattr(dentry->d_inode,
|
return orangefs_inode_getxattr(inode,
|
||||||
ORANGEFS_XATTR_NAME_DEFAULT_PREFIX,
|
ORANGEFS_XATTR_NAME_DEFAULT_PREFIX,
|
||||||
name,
|
name,
|
||||||
buffer,
|
buffer,
|
||||||
|
@ -507,12 +508,13 @@ static int orangefs_xattr_set_trusted(const struct xattr_handler *handler,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int orangefs_xattr_get_trusted(const struct xattr_handler *handler,
|
static int orangefs_xattr_get_trusted(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry,
|
struct dentry *unused,
|
||||||
|
struct inode *inode,
|
||||||
const char *name,
|
const char *name,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
return orangefs_inode_getxattr(dentry->d_inode,
|
return orangefs_inode_getxattr(inode,
|
||||||
ORANGEFS_XATTR_NAME_TRUSTED_PREFIX,
|
ORANGEFS_XATTR_NAME_TRUSTED_PREFIX,
|
||||||
name,
|
name,
|
||||||
buffer,
|
buffer,
|
||||||
|
|
|
@ -797,18 +797,18 @@ EXPORT_SYMBOL (posix_acl_to_xattr);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
posix_acl_xattr_get(const struct xattr_handler *handler,
|
posix_acl_xattr_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *value, size_t size)
|
const char *name, void *value, size_t size)
|
||||||
{
|
{
|
||||||
struct posix_acl *acl;
|
struct posix_acl *acl;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (!IS_POSIXACL(d_backing_inode(dentry)))
|
if (!IS_POSIXACL(inode))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
if (d_is_symlink(dentry))
|
if (S_ISLNK(inode->i_mode))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
acl = get_acl(d_backing_inode(dentry), handler->flags);
|
acl = get_acl(inode, handler->flags);
|
||||||
if (IS_ERR(acl))
|
if (IS_ERR(acl))
|
||||||
return PTR_ERR(acl);
|
return PTR_ERR(acl);
|
||||||
if (acl == NULL)
|
if (acl == NULL)
|
||||||
|
|
|
@ -9,14 +9,13 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
security_get(const struct xattr_handler *handler, struct dentry *dentry,
|
security_get(const struct xattr_handler *handler, struct dentry *unused,
|
||||||
const char *name, void *buffer, size_t size)
|
struct inode *inode, const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
if (IS_PRIVATE(d_inode(dentry)))
|
if (IS_PRIVATE(inode))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
return reiserfs_xattr_get(d_inode(dentry),
|
return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
|
||||||
xattr_full_name(handler, name),
|
|
||||||
buffer, size);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,13 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
trusted_get(const struct xattr_handler *handler, struct dentry *dentry,
|
trusted_get(const struct xattr_handler *handler, struct dentry *unused,
|
||||||
const char *name, void *buffer, size_t size)
|
struct inode *inode, const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
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_get(d_inode(dentry),
|
return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
|
||||||
xattr_full_name(handler, name),
|
|
||||||
buffer, size);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,12 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
user_get(const struct xattr_handler *handler, struct dentry *dentry,
|
user_get(const struct xattr_handler *handler, struct dentry *unused,
|
||||||
const char *name, void *buffer, size_t size)
|
struct inode *inode, const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
if (!reiserfs_xattrs_user(dentry->d_sb))
|
if (!reiserfs_xattrs_user(inode->i_sb))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return reiserfs_xattr_get(d_inode(dentry),
|
return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
|
||||||
xattr_full_name(handler, name),
|
|
||||||
buffer, size);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -214,10 +214,12 @@ failed:
|
||||||
|
|
||||||
|
|
||||||
static int squashfs_xattr_handler_get(const struct xattr_handler *handler,
|
static int squashfs_xattr_handler_get(const struct xattr_handler *handler,
|
||||||
struct dentry *d, const char *name,
|
struct dentry *unused,
|
||||||
|
struct inode *inode,
|
||||||
|
const char *name,
|
||||||
void *buffer, size_t size)
|
void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
return squashfs_xattr_get(d_inode(d), handler->flags, name,
|
return squashfs_xattr_get(inode, handler->flags, name,
|
||||||
buffer, size);
|
buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -698,7 +698,8 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s
|
||||||
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->get(handler, dentry, name, buffer, size);
|
return handler->get(handler, dentry, d_inode(dentry),
|
||||||
|
name, buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xfs_xattr_get(const struct xattr_handler *handler, struct dentry *dentry,
|
xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
|
||||||
const char *name, void *value, size_t size)
|
struct inode *inode, const char *name, void *value, size_t size)
|
||||||
{
|
{
|
||||||
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, asize = size;
|
int error, asize = size;
|
||||||
|
|
||||||
/* Convert Linux syscall to XFS internal ATTR flags */
|
/* Convert Linux syscall to XFS internal ATTR flags */
|
||||||
|
|
|
@ -30,7 +30,8 @@ struct xattr_handler {
|
||||||
int flags; /* fs private flags */
|
int flags; /* fs private flags */
|
||||||
bool (*list)(struct dentry *dentry);
|
bool (*list)(struct dentry *dentry);
|
||||||
int (*get)(const struct xattr_handler *, struct dentry *dentry,
|
int (*get)(const struct xattr_handler *, struct dentry *dentry,
|
||||||
const char *name, void *buffer, size_t size);
|
struct inode *inode, const char *name, void *buffer,
|
||||||
|
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,
|
const char *name, const void *buffer, size_t size,
|
||||||
int flags);
|
int flags);
|
||||||
|
|
|
@ -2646,10 +2646,10 @@ static int shmem_initxattrs(struct inode *inode,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shmem_xattr_handler_get(const struct xattr_handler *handler,
|
static int shmem_xattr_handler_get(const struct xattr_handler *handler,
|
||||||
struct dentry *dentry, const char *name,
|
struct dentry *unused, struct inode *inode,
|
||||||
void *buffer, size_t size)
|
const char *name, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
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_get(&info->xattrs, name, buffer, size);
|
return simple_xattr_get(&info->xattrs, name, buffer, size);
|
||||||
|
|
Loading…
Reference in New Issue