Merge git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
[deliverable/linux.git] / fs / f2fs / xattr.c
index 06a72dc0191a022049bbf48ad26e127bb6211c02..e3decae3acfbba671f9324c5cdc030d4b0400d2f 100644 (file)
 #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:
@@ -45,15 +45,16 @@ 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);
 }
 
 static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
-               struct dentry *dentry, const char *name, const void *value,
+               struct dentry *unused, struct inode *inode,
+               const char *name, const void *value,
                size_t size, int flags)
 {
-       struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
+       struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
 
        switch (handler->flags) {
        case F2FS_XATTR_INDEX_USER:
@@ -69,7 +70,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
        default:
                return -EINVAL;
        }
-       return f2fs_setxattr(d_inode(dentry), handler->flags, name,
+       return f2fs_setxattr(inode, handler->flags, name,
                                        value, size, NULL, flags);
 }
 
@@ -86,22 +87,19 @@ 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);
 }
 
 static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
-               struct dentry *dentry, const char *name, const void *value,
+               struct dentry *unused, struct inode *inode,
+               const char *name, const void *value,
                size_t size, int flags)
 {
-       struct inode *inode = d_inode(dentry);
-
        if (!inode_owner_or_capable(inode))
                return -EPERM;
        if (value == NULL)
@@ -500,7 +498,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
                        free = free + ENTRY_SIZE(here);
 
                if (unlikely(free < newsize)) {
-                       error = -ENOSPC;
+                       error = -E2BIG;
                        goto exit;
                }
        }
@@ -528,7 +526,6 @@ static int __f2fs_setxattr(struct inode *inode, int index,
                 * Before we come here, old entry is removed.
                 * We just write new entry.
                 */
-               memset(last, 0, newsize);
                last->e_name_index = index;
                last->e_name_len = len;
                memcpy(last->e_name, name, len);
This page took 0.040038 seconds and 5 git commands to generate.