[PATCH] hfsplus: return ENODATA when no xattr is found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are several points in the code where ENOENT or EOPNOTSUPP are
used to signal that an extended attribute does not exist. This is
clearly noticeable from the odd error messages shown by setfattr and
getfattr. Use ENODATA instead.

Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@xxxxxxxxx>
---
 fs/hfsplus/attributes.c | 6 ++++--
 fs/hfsplus/xattr.c      | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/hfsplus/attributes.c b/fs/hfsplus/attributes.c
index e5b221d..77b0d40 100644
--- a/fs/hfsplus/attributes.c
+++ b/fs/hfsplus/attributes.c
@@ -268,7 +268,7 @@ static int __hfsplus_delete_attr(struct inode *inode, u32 cnid,
 			offsetof(struct hfsplus_attr_key, cnid),
 			sizeof(__be32));
 	if (cnid != be32_to_cpu(found_cnid))
-		return -ENOENT;
+		return -ENODATA;
 
 	hfs_bnode_read(fd->bnode, &record_type,
 			fd->entryoffset, sizeof(record_type));
@@ -283,7 +283,7 @@ static int __hfsplus_delete_attr(struct inode *inode, u32 cnid,
 		return -EOPNOTSUPP;
 	default:
 		pr_err("invalid extended attribute record\n");
-		return -ENOENT;
+		return -ENODATA;
 	}
 
 	err = hfs_brec_remove(fd);
@@ -324,6 +324,8 @@ int hfsplus_delete_attr(struct inode *inode, const char *name)
 	}
 
 	err = hfs_brec_find(&fd, hfs_find_rec_by_key);
+	if (err == -ENOENT)
+		err = -ENODATA;
 	if (err)
 		goto out;
 
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index d37bb88..814082c 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -511,7 +511,7 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
 		return hfsplus_getxattr_finder_info(inode, value, size);
 
 	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
-		return -EOPNOTSUPP;
+		return -ENODATA;
 
 	entry = hfsplus_alloc_attr_entry();
 	if (!entry) {
@@ -697,7 +697,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
 	if (res < 0)
 		return res;
 	else if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
-		return (res == 0) ? -EOPNOTSUPP : res;
+		return (res == 0) ? -ENODATA : res;
 
 	err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->attr_tree, &fd);
 	if (err) {
@@ -780,7 +780,7 @@ static int hfsplus_removexattr(struct inode *inode, const char *name)
 	int is_all_xattrs_deleted = 0;
 
 	if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
-		return -EOPNOTSUPP;
+		return -ENODATA;
 
 	if (!strcmp_xattr_finder_info(name))
 		return -EOPNOTSUPP;
-- 
2.1.4




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux