@@ -293,7 +293,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
ext2_xattr_handler(entry->e_name_index);
if (handler) {
- size_t size = handler->list(dentry, buffer, rest,
+ size_t size = handler->list(inode, buffer, rest,
entry->e_name,
entry->e_name_len,
handler);
@@ -8,7 +8,7 @@
#include "xattr.h"
static size_t
-ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
+ext2_xattr_security_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -24,24 +24,24 @@ ext2_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext2_xattr_security_get(struct dentry *dentry, const char *name,
+ext2_xattr_security_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_SECURITY, name,
+ return ext2_xattr_get(inode, EXT2_XATTR_INDEX_SECURITY, name,
buffer, size);
}
static int
-ext2_xattr_security_set(struct dentry *dentry, const char *name,
+ext2_xattr_security_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- 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);
}
@@ -9,7 +9,7 @@
#include "xattr.h"
static size_t
-ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
+ext2_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -28,24 +28,24 @@ ext2_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext2_xattr_trusted_get(struct dentry *dentry, const char *name,
+ext2_xattr_trusted_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext2_xattr_get(d_inode(dentry), EXT2_XATTR_INDEX_TRUSTED, name,
+ return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name,
buffer, size);
}
static int
-ext2_xattr_trusted_set(struct dentry *dentry, const char *name,
+ext2_xattr_trusted_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- 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);
}
@@ -11,14 +11,14 @@
#include "xattr.h"
static size_t
-ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
+ext2_xattr_user_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
const size_t prefix_len = XATTR_USER_PREFIX_LEN;
const size_t total_len = prefix_len + name_len + 1;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return 0;
if (list && total_len <= list_size) {
@@ -30,29 +30,29 @@ ext2_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext2_xattr_user_get(struct dentry *dentry, const char *name,
+ext2_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- 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);
}
static int
-ext2_xattr_user_set(struct dentry *dentry, const char *name,
+ext2_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- 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);
}
@@ -330,6 +330,7 @@ static int
ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry,
char *buffer, size_t buffer_size)
{
+ struct inode *inode = d_inode(dentry);
size_t rest = buffer_size;
for (; !IS_LAST_ENTRY(entry); entry = EXT3_XATTR_NEXT(entry)) {
@@ -337,7 +338,7 @@ ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry,
ext3_xattr_handler(entry->e_name_index);
if (handler) {
- size_t size = handler->list(dentry, buffer, rest,
+ size_t size = handler->list(inode, buffer, rest,
entry->e_name,
entry->e_name_len,
handler);
@@ -8,7 +8,7 @@
#include "xattr.h"
static size_t
-ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
+ext3_xattr_security_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -25,24 +25,24 @@ ext3_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext3_xattr_security_get(struct dentry *dentry, const char *name,
+ext3_xattr_security_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY,
+ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_SECURITY,
name, buffer, size);
}
static int
-ext3_xattr_security_set(struct dentry *dentry, const char *name,
+ext3_xattr_security_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_SECURITY,
+ return ext3_xattr_set(inode, EXT3_XATTR_INDEX_SECURITY,
name, value, size, flags);
}
@@ -9,7 +9,7 @@
#include "xattr.h"
static size_t
-ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
+ext3_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -28,24 +28,24 @@ ext3_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext3_xattr_trusted_get(struct dentry *dentry, const char *name,
+ext3_xattr_trusted_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED,
+ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED,
name, buffer, size);
}
static int
-ext3_xattr_trusted_set(struct dentry *dentry, const char *name,
+ext3_xattr_trusted_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_TRUSTED, name,
+ return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name,
value, size, flags);
}
@@ -9,14 +9,14 @@
#include "xattr.h"
static size_t
-ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
+ext3_xattr_user_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
const size_t prefix_len = XATTR_USER_PREFIX_LEN;
const size_t total_len = prefix_len + name_len + 1;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return 0;
if (list && total_len <= list_size) {
@@ -28,28 +28,28 @@ ext3_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext3_xattr_user_get(struct dentry *dentry, const char *name, void *buffer,
+ext3_xattr_user_get(struct inode *inode, const char *name, void *buffer,
size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
- return ext3_xattr_get(d_inode(dentry), EXT3_XATTR_INDEX_USER,
+ return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER,
name, buffer, size);
}
static int
-ext3_xattr_user_set(struct dentry *dentry, const char *name,
+ext3_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return -EOPNOTSUPP;
- return ext3_xattr_set(d_inode(dentry), EXT3_XATTR_INDEX_USER,
+ return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER,
name, value, size, flags);
}
@@ -398,6 +398,7 @@ static int
ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
char *buffer, size_t buffer_size)
{
+ struct inode *inode = d_inode(dentry);
size_t rest = buffer_size;
for (; !IS_LAST_ENTRY(entry); entry = EXT4_XATTR_NEXT(entry)) {
@@ -405,7 +406,7 @@ ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
ext4_xattr_handler(entry->e_name_index);
if (handler) {
- size_t size = handler->list(dentry, buffer, rest,
+ size_t size = handler->list(inode, buffer, rest,
entry->e_name,
entry->e_name_len,
handler);
@@ -12,7 +12,7 @@
#include "xattr.h"
static size_t
-ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
+ext4_xattr_security_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -29,24 +29,24 @@ ext4_xattr_security_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext4_xattr_security_get(struct dentry *dentry, const char *name,
+ext4_xattr_security_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY,
+ return ext4_xattr_get(inode, EXT4_XATTR_INDEX_SECURITY,
name, buffer, size);
}
static int
-ext4_xattr_security_set(struct dentry *dentry, const char *name,
+ext4_xattr_security_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_SECURITY,
+ return ext4_xattr_set(inode, EXT4_XATTR_INDEX_SECURITY,
name, value, size, flags);
}
@@ -13,7 +13,7 @@
#include "xattr.h"
static size_t
-ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
+ext4_xattr_trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -32,24 +32,24 @@ ext4_xattr_trusted_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext4_xattr_trusted_get(struct dentry *dentry, const char *name, void *buffer,
+ext4_xattr_trusted_get(struct inode *inode, const char *name, void *buffer,
size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED,
+ return ext4_xattr_get(inode, EXT4_XATTR_INDEX_TRUSTED,
name, buffer, size);
}
static int
-ext4_xattr_trusted_set(struct dentry *dentry, const char *name,
+ext4_xattr_trusted_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_TRUSTED,
+ return ext4_xattr_set(inode, EXT4_XATTR_INDEX_TRUSTED,
name, value, size, flags);
}
@@ -12,14 +12,14 @@
#include "xattr.h"
static size_t
-ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
+ext4_xattr_user_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
const size_t prefix_len = XATTR_USER_PREFIX_LEN;
const size_t total_len = prefix_len + name_len + 1;
- if (!test_opt(dentry->d_sb, XATTR_USER))
+ if (!test_opt(inode->i_sb, XATTR_USER))
return 0;
if (list && total_len <= list_size) {
@@ -31,28 +31,28 @@ ext4_xattr_user_list(struct dentry *dentry, char *list, size_t list_size,
}
static int
-ext4_xattr_user_get(struct dentry *dentry, const char *name,
+ext4_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- 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);
}
static int
-ext4_xattr_user_set(struct dentry *dentry, const char *name,
+ext4_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- 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);
}
@@ -25,11 +25,11 @@
#include "f2fs.h"
#include "xattr.h"
-static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,
+static size_t f2fs_xattr_generic_list(struct inode *inode, char *list,
size_t list_size, const char *name, size_t len,
const struct xattr_handler *handler)
{
- struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
+ struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
int total_len, prefix_len;
switch (handler->flags) {
@@ -57,11 +57,11 @@ static size_t f2fs_xattr_generic_list(struct dentry *dentry, char *list,
return total_len;
}
-static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
+static int f2fs_xattr_generic_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- 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:
@@ -79,15 +79,14 @@ static int f2fs_xattr_generic_get(struct dentry *dentry, const char *name,
}
if (strcmp(name, "") == 0)
return -EINVAL;
- return f2fs_getxattr(d_inode(dentry), handler->flags, name,
- buffer, size, NULL);
+ return f2fs_getxattr(inode, handler->flags, name, buffer, size, NULL);
}
-static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
+static int f2fs_xattr_generic_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
- 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:
@@ -106,11 +105,11 @@ static int f2fs_xattr_generic_set(struct dentry *dentry, const char *name,
if (strcmp(name, "") == 0)
return -EINVAL;
- return f2fs_setxattr(d_inode(dentry), handler->flags, name,
- value, size, NULL, flags);
+ return f2fs_setxattr(inode, handler->flags, name, value, size, NULL,
+ flags);
}
-static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
+static size_t f2fs_xattr_advise_list(struct inode *inode, char *list,
size_t list_size, const char *name, size_t len,
const struct xattr_handler *handler)
{
@@ -123,12 +122,10 @@ static size_t f2fs_xattr_advise_list(struct dentry *dentry, char *list,
return size;
}
-static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
+static int f2fs_xattr_advise_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- struct inode *inode = d_inode(dentry);
-
if (strcmp(name, "") != 0)
return -EINVAL;
@@ -137,12 +134,10 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
return sizeof(char);
}
-static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
+static int f2fs_xattr_advise_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
- struct inode *inode = d_inode(dentry);
-
if (strcmp(name, "") != 0)
return -EINVAL;
if (!inode_owner_or_capable(inode))
@@ -460,7 +455,7 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
if (!handler)
continue;
- size = handler->list(dentry, buffer, rest, entry->e_name,
+ size = handler->list(inode, buffer, rest, entry->e_name,
entry->e_name_len, handler);
if (buffer && size > rest) {
error = -ERANGE;
@@ -583,11 +583,11 @@ out:
*
* Returns: actual size of data on success, -errno on error
*/
-static int gfs2_xattr_get(struct dentry *dentry, const char *name,
+static int gfs2_xattr_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- 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;
@@ -1229,11 +1229,11 @@ int __gfs2_xattr_set(struct inode *inode, const char *name,
return error;
}
-static int gfs2_xattr_set(struct dentry *dentry, const char *name,
+static int gfs2_xattr_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
- return __gfs2_xattr_set(d_inode(dentry), name, value,
+ return __gfs2_xattr_set(inode, name, value,
size, flags, handler->flags);
}
@@ -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)
{
@@ -440,7 +440,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,
+ res = __hfsplus_setxattr(inode, xattr_name, value, size,
flags);
kfree(xattr_name);
return res;
@@ -582,7 +582,7 @@ failed_getxattr_init:
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)
{
@@ -600,7 +600,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;
@@ -849,7 +849,7 @@ end_removexattr:
return err;
}
-static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
+static int hfsplus_osx_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
@@ -869,10 +869,10 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
* 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(struct dentry *dentry, const char *name,
+static int hfsplus_osx_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
@@ -892,7 +892,7 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
* 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 = {
@@ -21,14 +21,14 @@ 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);
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);
@@ -13,20 +13,20 @@
#include "xattr.h"
#include "acl.h"
-static int hfsplus_security_getxattr(struct dentry *dentry, const char *name,
+static int hfsplus_security_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- return hfsplus_getxattr(dentry, name, buffer, size,
+ return hfsplus_getxattr(inode, name, buffer, size,
XATTR_SECURITY_PREFIX,
XATTR_SECURITY_PREFIX_LEN);
}
-static int hfsplus_security_setxattr(struct dentry *dentry, const char *name,
+static int hfsplus_security_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
- return hfsplus_setxattr(dentry, name, buffer, size, flags,
+ return hfsplus_setxattr(inode, name, buffer, size, flags,
XATTR_SECURITY_PREFIX,
XATTR_SECURITY_PREFIX_LEN);
}
@@ -11,20 +11,20 @@
#include "hfsplus_fs.h"
#include "xattr.h"
-static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name,
+static int hfsplus_trusted_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- return hfsplus_getxattr(dentry, name, buffer, size,
+ return hfsplus_getxattr(inode, name, buffer, size,
XATTR_TRUSTED_PREFIX,
XATTR_TRUSTED_PREFIX_LEN);
}
-static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name,
+static int hfsplus_trusted_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
- return hfsplus_setxattr(dentry, name, buffer, size, flags,
+ return hfsplus_setxattr(inode, name, buffer, size, flags,
XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
}
@@ -11,20 +11,20 @@
#include "hfsplus_fs.h"
#include "xattr.h"
-static int hfsplus_user_getxattr(struct dentry *dentry, const char *name,
+static int hfsplus_user_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- return hfsplus_getxattr(dentry, name, buffer, size,
+ return hfsplus_getxattr(inode, name, buffer, size,
XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
}
-static int hfsplus_user_setxattr(struct dentry *dentry, const char *name,
+static int hfsplus_user_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
- return hfsplus_setxattr(dentry, name, buffer, size, flags,
+ return hfsplus_setxattr(inode, name, buffer, size, flags,
XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN);
}
@@ -48,29 +48,29 @@ int jffs2_init_security(struct inode *inode, struct inode *dir,
}
/* ---- XATTR Handler for "security.*" ----------------- */
-static int jffs2_security_getxattr(struct dentry *dentry, const char *name,
+static int jffs2_security_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY,
+ return do_jffs2_getxattr(inode, JFFS2_XPREFIX_SECURITY,
name, buffer, size);
}
-static int jffs2_security_setxattr(struct dentry *dentry, const char *name,
+static int jffs2_security_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_SECURITY,
+ return do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY,
name, buffer, size, flags);
}
-static size_t jffs2_security_listxattr(struct dentry *dentry, char *list,
+static size_t jffs2_security_listxattr(struct inode *inode, char *list,
size_t list_size, const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -1001,10 +1001,10 @@ ssize_t jffs2_listxattr(struct dentry *dentry, char *buffer, size_t size)
if (!xhandle)
continue;
if (buffer) {
- rc = xhandle->list(dentry, buffer+len, size-len,
+ rc = xhandle->list(inode, buffer+len, size-len,
xd->xname, xd->name_len, xhandle);
} else {
- rc = xhandle->list(dentry, NULL, 0, xd->xname,
+ rc = xhandle->list(inode, NULL, 0, xd->xname,
xd->name_len, xhandle);
}
if (rc < 0)
@@ -16,26 +16,26 @@
#include <linux/mtd/mtd.h>
#include "nodelist.h"
-static int jffs2_trusted_getxattr(struct dentry *dentry, const char *name,
+static int jffs2_trusted_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size, const struct xattr_handler *handler)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED,
+ return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED,
name, buffer, size);
}
-static int jffs2_trusted_setxattr(struct dentry *dentry, const char *name,
+static int jffs2_trusted_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_TRUSTED,
+ return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED,
name, buffer, size, flags);
}
-static size_t jffs2_trusted_listxattr(struct dentry *dentry, char *list,
+static size_t jffs2_trusted_listxattr(struct inode *inode, char *list,
size_t list_size, const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -16,27 +16,27 @@
#include <linux/mtd/mtd.h>
#include "nodelist.h"
-static int jffs2_user_getxattr(struct dentry *dentry, const char *name,
+static int jffs2_user_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_getxattr(d_inode(dentry), JFFS2_XPREFIX_USER,
+ return do_jffs2_getxattr(inode, JFFS2_XPREFIX_USER,
name, buffer, size);
}
-static int jffs2_user_setxattr(struct dentry *dentry, const char *name,
+static int jffs2_user_setxattr(struct inode *inode, const char *name,
const void *buffer, size_t size, int flags,
const struct xattr_handler *handler)
{
if (!strcmp(name, ""))
return -EINVAL;
- return do_jffs2_setxattr(d_inode(dentry), JFFS2_XPREFIX_USER,
+ return do_jffs2_setxattr(inode, JFFS2_XPREFIX_USER,
name, buffer, size, flags);
}
-static size_t jffs2_user_listxattr(struct dentry *dentry, char *list,
+static size_t jffs2_user_listxattr(struct inode *inode, char *list,
size_t list_size, const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -4841,12 +4841,11 @@ static int nfs4_do_set_security_label(struct inode *inode,
}
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 nfs_fattr fattr;
struct rpc_cred *cred;
- struct inode *inode = d_inode(dentry);
int status;
if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL))
@@ -6201,7 +6200,7 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
#define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
-static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
+static int nfs4_xattr_set_nfs4_acl(struct inode *inode, const char *key,
const void *buf, size_t buflen,
int flags,
const struct xattr_handler *handler)
@@ -6209,27 +6208,27 @@ static int nfs4_xattr_set_nfs4_acl(struct dentry *dentry, const char *key,
if (strcmp(key, "") != 0)
return -EINVAL;
- 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(struct dentry *dentry, const char *key,
+static int nfs4_xattr_get_nfs4_acl(struct inode *inode, const char *key,
void *buf, size_t buflen,
const struct xattr_handler *handler)
{
if (strcmp(key, "") != 0)
return -EINVAL;
- return nfs4_proc_get_acl(d_inode(dentry), buf, buflen);
+ return nfs4_proc_get_acl(inode, buf, buflen);
}
-static size_t nfs4_xattr_list_nfs4_acl(struct dentry *dentry, char *list,
+static size_t nfs4_xattr_list_nfs4_acl(struct inode *inode, char *list,
size_t list_len, const char *name,
size_t name_len,
const struct xattr_handler *handler)
{
size_t len = sizeof(XATTR_NAME_NFSV4_ACL);
- if (!nfs4_server_supports_acls(NFS_SERVER(d_inode(dentry))))
+ if (!nfs4_server_supports_acls(NFS_SERVER(inode)))
return 0;
if (list && len <= list_len)
@@ -6243,37 +6242,37 @@ static inline int nfs4_server_supports_labels(struct nfs_server *server)
return server->caps & NFS_CAP_SECURITY_LABEL;
}
-static int nfs4_xattr_set_nfs4_label(struct dentry *dentry, const char *key,
+static int nfs4_xattr_set_nfs4_label(struct inode *inode, const char *key,
const void *buf, size_t buflen,
int flags,
const struct xattr_handler *handler)
{
if (security_ismaclabel(key))
- return nfs4_set_security_label(dentry, buf, buflen);
+ return nfs4_set_security_label(inode, buf, buflen);
return -EOPNOTSUPP;
}
-static int nfs4_xattr_get_nfs4_label(struct dentry *dentry, const char *key,
+static int nfs4_xattr_get_nfs4_label(struct inode *inode, const char *key,
void *buf, size_t buflen,
const struct xattr_handler *handler)
{
if (security_ismaclabel(key))
- return nfs4_get_security_label(d_inode(dentry), buf, buflen);
+ return nfs4_get_security_label(inode, buf, buflen);
return -EOPNOTSUPP;
}
-static size_t nfs4_xattr_list_nfs4_label(struct dentry *dentry, char *list,
+static size_t nfs4_xattr_list_nfs4_label(struct inode *inode, char *list,
size_t list_len, const char *name,
size_t name_len,
const struct xattr_handler *handler)
{
size_t len = 0;
- if (nfs_server_capable(d_inode(dentry), NFS_CAP_SECURITY_LABEL)) {
- len = security_inode_listsecurity(d_inode(dentry), NULL, 0);
+ if (nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) {
+ len = security_inode_listsecurity(inode, NULL, 0);
if (list && len <= list_len)
- security_inode_listsecurity(d_inode(dentry), list, len);
+ security_inode_listsecurity(inode, list, len);
}
return len;
}
@@ -7237,7 +7237,7 @@ leave:
/*
* 'security' attributes support
*/
-static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_security_list(struct inode *inode, char *list,
size_t list_size, const char *name,
size_t name_len,
const struct xattr_handler *handler)
@@ -7253,24 +7253,24 @@ static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
return total_len;
}
-static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
+static int ocfs2_xattr_security_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
+ return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY,
name, buffer, size);
}
-static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
+static int ocfs2_xattr_security_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_SECURITY,
+ return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY,
name, value, size, flags);
}
@@ -7330,7 +7330,7 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
/*
* 'trusted' attributes support
*/
-static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_trusted_list(struct inode *inode, char *list,
size_t list_size, const char *name,
size_t name_len,
const struct xattr_handler *handler)
@@ -7346,24 +7346,24 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
return total_len;
}
-static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
+static int ocfs2_xattr_trusted_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ocfs2_xattr_get(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
+ return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_TRUSTED,
name, buffer, size);
}
-static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name,
+static int ocfs2_xattr_trusted_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
if (strcmp(name, "") == 0)
return -EINVAL;
- return ocfs2_xattr_set(d_inode(dentry), OCFS2_XATTR_INDEX_TRUSTED,
+ return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_TRUSTED,
name, value, size, flags);
}
@@ -7377,14 +7377,14 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
/*
* 'user' attributes support
*/
-static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_user_list(struct inode *inode, char *list,
size_t list_size, const char *name,
size_t name_len,
const struct xattr_handler *handler)
{
const size_t prefix_len = XATTR_USER_PREFIX_LEN;
const size_t total_len = prefix_len + name_len + 1;
- 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 0;
@@ -7397,32 +7397,32 @@ static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
return total_len;
}
-static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
+static int ocfs2_xattr_user_get(struct inode *inode, const char *name,
void *buffer, size_t size,
const struct xattr_handler *handler)
{
- struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
+ struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
if (strcmp(name, "") == 0)
return -EINVAL;
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);
}
-static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name,
+static int ocfs2_xattr_user_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
- struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
+ struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
if (strcmp(name, "") == 0)
return -EINVAL;
if (osb->s_mount_opt & OCFS2_MOUNT_NOUSERXATTR)
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);
}
@@ -762,19 +762,19 @@ posix_acl_to_xattr(struct user_namespace *user_ns, const struct posix_acl *acl,
EXPORT_SYMBOL (posix_acl_to_xattr);
static int
-posix_acl_xattr_get(struct dentry *dentry, const char *name,
+posix_acl_xattr_get(struct inode *inode, const char *name,
void *value, size_t size,
const struct xattr_handler *handler)
{
struct posix_acl *acl;
int error;
- if (!IS_POSIXACL(d_backing_inode(dentry)))
+ if (!IS_POSIXACL(inode))
return -EOPNOTSUPP;
- if (d_is_symlink(dentry))
+ if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
- acl = get_acl(d_backing_inode(dentry), handler->flags);
+ acl = get_acl(inode, handler->flags);
if (IS_ERR(acl))
return PTR_ERR(acl);
if (acl == NULL)
@@ -787,11 +787,10 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name,
}
static int
-posix_acl_xattr_set(struct dentry *dentry, const char *name,
+posix_acl_xattr_set(struct inode *inode, const char *name,
const void *value, size_t size, int flags,
const struct xattr_handler *handler)
{
- struct inode *inode = d_backing_inode(dentry);
struct posix_acl *acl = NULL;
int ret;
@@ -824,16 +823,16 @@ out:
}
static size_t
-posix_acl_xattr_list(struct dentry *dentry, char *list, size_t list_size,
+posix_acl_xattr_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
const char *xname = handler->prefix;
size_t size;
- if (!IS_POSIXACL(d_backing_inode(dentry)))
+ if (!IS_POSIXACL(inode))
return -EOPNOTSUPP;
- if (d_is_symlink(dentry))
+ if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP;
size = strlen(xname) + 1;
@@ -771,50 +771,53 @@ ssize_t
reiserfs_getxattr(struct dentry * dentry, const char *name, void *buffer,
size_t size)
{
+ struct inode *inode = d_inode(dentry);
const struct xattr_handler *handler;
handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
- if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
+ if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1)
return -EOPNOTSUPP;
- return handler->get(dentry, name, buffer, size, handler);
+ return handler->get(inode, name, buffer, size, handler);
}
/*
* Inode operation setxattr()
*
- * d_inode(dentry)->i_mutex down
+ * inode->i_mutex down
*/
int
reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags)
{
+ struct inode *inode = d_inode(dentry);
const struct xattr_handler *handler;
handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
- if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
+ if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1)
return -EOPNOTSUPP;
- return handler->set(dentry, name, value, size, flags, handler);
+ return handler->set(inode, name, value, size, flags, handler);
}
/*
* Inode operation removexattr()
*
- * d_inode(dentry)->i_mutex down
+ * inode->i_mutex down
*/
int reiserfs_removexattr(struct dentry *dentry, const char *name)
{
+ struct inode *inode = d_inode(dentry);
const struct xattr_handler *handler;
handler = find_xattr_handler_prefix(dentry->d_sb->s_xattr, name);
- if (!handler || get_inode_sd_version(d_inode(dentry)) == STAT_DATA_V1)
+ if (!handler || get_inode_sd_version(inode) == STAT_DATA_V1)
return -EOPNOTSUPP;
- return handler->set(dentry, name, NULL, 0, XATTR_REPLACE, handler);
+ return handler->set(inode, name, NULL, 0, XATTR_REPLACE, handler);
}
struct listxattr_buf {
@@ -835,6 +838,7 @@ static int listxattr_filler(struct dir_context *ctx, const char *name,
if (name[0] != '.' ||
(namelen != 1 && (name[1] != '.' || namelen != 2))) {
+ struct inode *inode = d_inode(b->dentry);
const struct xattr_handler *handler;
handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr,
@@ -842,13 +846,13 @@ static int listxattr_filler(struct dir_context *ctx, const char *name,
if (!handler) /* Unsupported xattr name */
return 0;
if (b->buf) {
- size = handler->list(b->dentry, b->buf + b->pos,
- b->size, name, namelen, handler);
+ size = handler->list(inode, b->buf + b->pos, b->size,
+ name, namelen, handler);
if (size > b->size)
return -ERANGE;
} else {
- size = handler->list(b->dentry, NULL, 0, name,
- namelen, handler);
+ size = handler->list(inode, NULL, 0,
+ name, namelen, handler);
}
b->pos += size;
@@ -9,39 +9,39 @@
#include <linux/uaccess.h>
static int
-security_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
+security_get(struct inode *inode, const char *name, void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;
- if (IS_PRIVATE(d_inode(dentry)))
+ if (IS_PRIVATE(inode))
return -EPERM;
- return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
+ return reiserfs_xattr_get(inode, name, buffer, size);
}
static int
-security_set(struct dentry *dentry, const char *name, const void *buffer,
+security_set(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags,
const struct xattr_handler *handler)
{
if (strlen(name) < sizeof(XATTR_SECURITY_PREFIX))
return -EINVAL;
- if (IS_PRIVATE(d_inode(dentry)))
+ if (IS_PRIVATE(inode))
return -EPERM;
- return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
+ return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
-static size_t security_list(struct dentry *dentry, char *list, size_t list_len,
+static size_t security_list(struct inode *inode, char *list, size_t list_len,
const char *name, size_t namelen,
const struct xattr_handler *handler)
{
const size_t len = namelen + 1;
- if (IS_PRIVATE(d_inode(dentry)))
+ if (IS_PRIVATE(inode))
return 0;
if (list && len <= list_len) {
@@ -8,39 +8,39 @@
#include <linux/uaccess.h>
static int
-trusted_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
+trusted_get(struct inode *inode, const char *name, void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
+ if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;
- return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
+ return reiserfs_xattr_get(inode, name, buffer, size);
}
static int
-trusted_set(struct dentry *dentry, const char *name, const void *buffer,
+trusted_set(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags,
const struct xattr_handler *handler)
{
if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
return -EINVAL;
- if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
+ if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return -EPERM;
- return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
+ return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
-static size_t trusted_list(struct dentry *dentry, char *list, size_t list_size,
+static size_t trusted_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
const size_t len = name_len + 1;
- if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
+ if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
return 0;
if (list && len <= list_size) {
@@ -7,37 +7,37 @@
#include <linux/uaccess.h>
static int
-user_get(struct dentry *dentry, const char *name, void *buffer, size_t size,
+user_get(struct inode *inode, const char *name, void *buffer, size_t size,
const struct xattr_handler *handler)
{
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL;
- if (!reiserfs_xattrs_user(dentry->d_sb))
+ if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP;
- return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
+ return reiserfs_xattr_get(inode, name, buffer, size);
}
static int
-user_set(struct dentry *dentry, const char *name, const void *buffer,
+user_set(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags,
const struct xattr_handler *handler)
{
if (strlen(name) < sizeof(XATTR_USER_PREFIX))
return -EINVAL;
- if (!reiserfs_xattrs_user(dentry->d_sb))
+ if (!reiserfs_xattrs_user(inode->i_sb))
return -EOPNOTSUPP;
- return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
+ return reiserfs_xattr_set(inode, name, buffer, size, flags);
}
-static size_t user_list(struct dentry *dentry, char *list, size_t list_size,
+static size_t user_list(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *handler)
{
const size_t len = name_len + 1;
- if (!reiserfs_xattrs_user(dentry->d_sb))
+ if (!reiserfs_xattrs_user(inode->i_sb))
return 0;
if (list && len <= list_size) {
memcpy(list, name, name_len);
@@ -68,7 +68,7 @@ ssize_t squashfs_listxattr(struct dentry *d, char *buffer,
name_size = le16_to_cpu(entry.size);
handler = squashfs_xattr_handler(le16_to_cpu(entry.type));
if (handler)
- prefix_size = handler->list(d, buffer, rest, NULL,
+ prefix_size = handler->list(inode, buffer, rest, NULL,
name_size, handler);
if (prefix_size) {
if (buffer) {
@@ -212,7 +212,7 @@ failed:
}
-static size_t squashfs_xattr_handler_list(struct dentry *d, char *list,
+static size_t squashfs_xattr_handler_list(struct inode *inode, char *list,
size_t list_size, const char *name, size_t name_len,
const struct xattr_handler *handler)
{
@@ -223,13 +223,13 @@ static size_t squashfs_xattr_handler_list(struct dentry *d, char *list,
return len;
}
-static int squashfs_xattr_handler_get(struct dentry *d, const char *name,
+static int squashfs_xattr_handler_get(struct inode *inode, const char *name,
void *buffer, size_t size, const struct xattr_handler *handler)
{
if (name[0] == '\0')
return -EINVAL;
- return squashfs_xattr_get(d_inode(d), handler->flags, name,
+ return squashfs_xattr_get(inode, handler->flags, name,
buffer, size);
}
@@ -246,13 +246,13 @@ static const struct xattr_handler squashfs_xattr_user_handler = {
/*
* Trusted namespace support
*/
-static size_t squashfs_trusted_xattr_handler_list(struct dentry *d, char *list,
+static size_t squashfs_trusted_xattr_handler_list(struct inode *inode, char *list,
size_t list_size, const char *name, size_t name_len,
const struct xattr_handler *handler)
{
if (!capable(CAP_SYS_ADMIN))
return 0;
- return squashfs_xattr_handler_list(d, list, list_size, name, name_len,
+ return squashfs_xattr_handler_list(inode, list, list_size, name, name_len,
handler);
}
@@ -709,7 +709,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler)
return -EOPNOTSUPP;
- return handler->get(dentry, name, buffer, size, handler);
+ return handler->get(dentry->d_inode, name, buffer, size, handler);
}
/*
@@ -720,18 +720,18 @@ ssize_t
generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
{
const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr;
+ struct inode *inode = dentry->d_inode;
unsigned int size = 0;
if (!buffer) {
for_each_xattr_handler(handlers, handler) {
- size += handler->list(dentry, NULL, 0, NULL, 0,
- handler);
+ size += handler->list(inode, NULL, 0, NULL, 0, handler);
}
} else {
char *buf = buffer;
for_each_xattr_handler(handlers, handler) {
- size = handler->list(dentry, buf, buffer_size,
+ size = handler->list(inode, buf, buffer_size,
NULL, 0, handler);
if (size > buffer_size)
return -ERANGE;
@@ -756,7 +756,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler)
return -EOPNOTSUPP;
- return handler->set(dentry, name, value, size, flags, handler);
+ return handler->set(dentry->d_inode, name, value, size, flags, handler);
}
/*
@@ -771,7 +771,7 @@ generic_removexattr(struct dentry *dentry, const char *name)
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler)
return -EOPNOTSUPP;
- return handler->set(dentry, name, NULL, 0,
+ return handler->set(dentry->d_inode, name, NULL, 0,
XATTR_REPLACE, handler);
}
@@ -32,12 +32,12 @@
static int
-xfs_xattr_get(struct dentry *dentry, const char *name,
+xfs_xattr_get(struct inode *inode, const char *name,
void *value, size_t size,
const struct xattr_handler *handler)
{
int xflags = handler->flags;
- struct xfs_inode *ip = XFS_I(d_inode(dentry));
+ struct xfs_inode *ip = XFS_I(inode);
int error, asize = size;
if (strcmp(name, "") == 0)
@@ -56,12 +56,12 @@ xfs_xattr_get(struct dentry *dentry, const char *name,
}
static int
-xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
+xfs_xattr_set(struct inode *inode, const char *name, const void *value,
size_t size, int flags,
const struct xattr_handler *handler)
{
int xflags = handler->flags;
- struct xfs_inode *ip = XFS_I(d_inode(dentry));
+ struct xfs_inode *ip = XFS_I(inode);
if (strcmp(name, "") == 0)
return -EINVAL;
@@ -22,12 +22,12 @@ struct dentry;
struct xattr_handler {
const char *prefix;
int flags; /* fs private flags */
- size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
+ size_t (*list)(struct inode *inode, char *list, size_t list_size,
const char *name, size_t name_len,
const struct xattr_handler *);
- int (*get)(struct dentry *dentry, const char *name, void *buffer,
+ int (*get)(struct inode *inode, const char *name, void *buffer,
size_t size, const struct xattr_handler *);
- int (*set)(struct dentry *dentry, const char *name, const void *buffer,
+ int (*set)(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags, const struct xattr_handler *);
};
All remaining file systems that use the generic xattr_handler infrastructure only access dentry->d_inode and do nothing else with the dentry, so pass down the inode instead of the dentry to the xattr_handler operations. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> --- fs/ext2/xattr.c | 2 +- fs/ext2/xattr_security.c | 10 +++++----- fs/ext2/xattr_trusted.c | 10 +++++----- fs/ext2/xattr_user.c | 16 ++++++++-------- fs/ext3/xattr.c | 3 ++- fs/ext3/xattr_security.c | 10 +++++----- fs/ext3/xattr_trusted.c | 10 +++++----- fs/ext3/xattr_user.c | 16 ++++++++-------- fs/ext4/xattr.c | 3 ++- fs/ext4/xattr_security.c | 10 +++++----- fs/ext4/xattr_trusted.c | 10 +++++----- fs/ext4/xattr_user.c | 16 ++++++++-------- fs/f2fs/xattr.c | 31 +++++++++++++------------------ fs/gfs2/xattr.c | 8 ++++---- fs/hfsplus/xattr.c | 16 ++++++++-------- fs/hfsplus/xattr.h | 4 ++-- fs/hfsplus/xattr_security.c | 8 ++++---- fs/hfsplus/xattr_trusted.c | 8 ++++---- fs/hfsplus/xattr_user.c | 8 ++++---- fs/jffs2/security.c | 10 +++++----- fs/jffs2/xattr.c | 4 ++-- fs/jffs2/xattr_trusted.c | 10 +++++----- fs/jffs2/xattr_user.c | 10 +++++----- fs/nfs/nfs4proc.c | 31 +++++++++++++++---------------- fs/ocfs2/xattr.c | 36 ++++++++++++++++++------------------ fs/posix_acl.c | 17 ++++++++--------- fs/reiserfs/xattr.c | 28 ++++++++++++++++------------ fs/reiserfs/xattr_security.c | 16 ++++++++-------- fs/reiserfs/xattr_trusted.c | 16 ++++++++-------- fs/reiserfs/xattr_user.c | 16 ++++++++-------- fs/squashfs/xattr.c | 12 ++++++------ fs/xattr.c | 12 ++++++------ fs/xfs/xfs_xattr.c | 8 ++++---- include/linux/xattr.h | 6 +++--- 34 files changed, 215 insertions(+), 216 deletions(-)