Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-block.git] / fs / ext2 / xattr_user.c
index 0c03ea131a948da241849d9bb82953f4b4e9cabd..92495d28c62f0b43da553efba59e482d16d388bc 100644 (file)
 #include "ext2.h"
 #include "xattr.h"
 
-#define XATTR_USER_PREFIX "user."
-
 static size_t
 ext2_xattr_user_list(struct inode *inode, char *list, size_t list_size,
                     const char *name, size_t name_len)
 {
-       const size_t prefix_len = sizeof(XATTR_USER_PREFIX)-1;
+       const size_t prefix_len = XATTR_USER_PREFIX_LEN;
        const size_t total_len = prefix_len + name_len + 1;
 
        if (!test_opt(inode->i_sb, XATTR_USER))
@@ -35,16 +33,10 @@ static int
 ext2_xattr_user_get(struct inode *inode, const char *name,
                    void *buffer, size_t size)
 {
-       int error;
-
        if (strcmp(name, "") == 0)
                return -EINVAL;
        if (!test_opt(inode->i_sb, XATTR_USER))
                return -EOPNOTSUPP;
-       error = permission(inode, MAY_READ, NULL);
-       if (error)
-               return error;
-
        return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size);
 }
 
@@ -52,18 +44,10 @@ static int
 ext2_xattr_user_set(struct inode *inode, const char *name,
                    const void *value, size_t size, int flags)
 {
-       int error;
-
        if (strcmp(name, "") == 0)
                return -EINVAL;
        if (!test_opt(inode->i_sb, XATTR_USER))
                return -EOPNOTSUPP;
-       if ( !S_ISREG(inode->i_mode) &&
-           (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX))
-               return -EPERM;
-       error = permission(inode, MAY_WRITE, NULL);
-       if (error)
-               return error;
 
        return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name,
                              value, size, flags);