[PATCH 06/15] staging: exfat: Clean up return codes - FFS_FILEEXIST

From: Valdis Kletnieks
Date: Thu Oct 24 2019 - 11:54:34 EST


Convert FFS_FILEEXIST to -EEXIST

Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@xxxxxx>
---
drivers/staging/exfat/exfat.h | 1 -
drivers/staging/exfat/exfat_core.c | 2 +-
drivers/staging/exfat/exfat_super.c | 14 +++++++-------
3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index a2b865788697..c56363652c5d 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -216,7 +216,6 @@ static inline u16 get_row_index(u16 i)
#define FFS_SEMAPHOREERR 6
#define FFS_INVALIDPATH 7
#define FFS_INVALIDFID 8
-#define FFS_FILEEXIST 10
#define FFS_NOTOPENED 12
#define FFS_MAXOPENED 13
#define FFS_EOF 15
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index af1ccd686e01..ba5680123b0f 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -2103,7 +2103,7 @@ static s32 fat_generate_dos_name(struct super_block *sb, struct chain_t *p_dir,
}

if ((count == 0) || (count >= 1024))
- return FFS_FILEEXIST;
+ return -EEXIST;
fat_attach_count_to_dos_name(p_dosname->name, count);

/* Now dos_name has DOS~????.EXT */
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index eb3c3642abca..2c294e238d7b 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -1288,7 +1288,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
new_clu.flags = new_fid->flags;

if (!is_dir_empty(sb, &new_clu)) {
- ret = FFS_FILEEXIST;
+ ret = -EEXIST;
goto out;
}
}
@@ -2156,7 +2156,7 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid)
clu_to_free.flags = fid->flags;

if (!is_dir_empty(sb, &clu_to_free)) {
- ret = FFS_FILEEXIST;
+ ret = -EEXIST;
goto out;
}

@@ -2358,7 +2358,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
- else if (err == FFS_FILEEXIST)
+ else if (err == -EEXIST)
err = -EEXIST;
else if (err == -ENOSPC)
err = -ENOSPC;
@@ -2569,7 +2569,7 @@ static int exfat_symlink(struct inode *dir, struct dentry *dentry,
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
- else if (err == FFS_FILEEXIST)
+ else if (err == -EEXIST)
err = -EEXIST;
else if (err == -ENOSPC)
err = -ENOSPC;
@@ -2639,7 +2639,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
- else if (err == FFS_FILEEXIST)
+ else if (err == -EEXIST)
err = -EEXIST;
else if (err == -ENOSPC)
err = -ENOSPC;
@@ -2693,7 +2693,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
if (err) {
if (err == FFS_INVALIDPATH)
err = -EINVAL;
- else if (err == FFS_FILEEXIST)
+ else if (err == -EEXIST)
err = -ENOTEMPTY;
else if (err == -ENOENT)
err = -ENOENT;
@@ -2750,7 +2750,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
err = -EPERM;
else if (err == FFS_INVALIDPATH)
err = -EINVAL;
- else if (err == FFS_FILEEXIST)
+ else if (err == -EEXIST)
err = -EEXIST;
else if (err == -ENOENT)
err = -ENOENT;
--
2.23.0