[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191024155327.1095907-5-Valdis.Kletnieks@vt.edu>
Date: Thu, 24 Oct 2019 11:53:15 -0400
From: Valdis Kletnieks <valdis.kletnieks@...edu>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Valdis Kletnieks <Valdis.Kletnieks@...edu>,
Valdis Kletnieks <valdis.kletnieks@...edu>,
linux-fsdevel@...r.kernel.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 04/15] staging: exfat: Clean up return codes - FFS_PERMISSIONERR
Convert FFS_PERMISSIONERR to -EPERM
Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@...edu>
---
drivers/staging/exfat/exfat.h | 1 -
drivers/staging/exfat/exfat_super.c | 20 ++++++++++----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index ec52237b01cd..86bdcf222a5a 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -217,7 +217,6 @@ static inline u16 get_row_index(u16 i)
#define FFS_INVALIDPATH 7
#define FFS_INVALIDFID 8
#define FFS_FILEEXIST 10
-#define FFS_PERMISSIONERR 11
#define FFS_NOTOPENED 12
#define FFS_MAXOPENED 13
#define FFS_EOF 15
diff --git a/drivers/staging/exfat/exfat_super.c b/drivers/staging/exfat/exfat_super.c
index 566cfba0a522..fd5d8ba0d8bc 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -702,7 +702,7 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer,
/* check if the given file ID is opened */
if (fid->type != TYPE_FILE) {
- ret = FFS_PERMISSIONERR;
+ ret = -EPERM;
goto out;
}
@@ -832,7 +832,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
/* check if the given file ID is opened */
if (fid->type != TYPE_FILE) {
- ret = FFS_PERMISSIONERR;
+ ret = -EPERM;
goto out;
}
@@ -1079,7 +1079,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
/* check if the given file ID is opened */
if (fid->type != TYPE_FILE) {
- ret = FFS_PERMISSIONERR;
+ ret = -EPERM;
goto out;
}
@@ -1246,7 +1246,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
/* check if the old file is "." or ".." */
if (p_fs->vol_type != EXFAT) {
if ((olddir.dir != p_fs->root_dir) && (dentry < 2)) {
- ret = FFS_PERMISSIONERR;
+ ret = -EPERM;
goto out2;
}
}
@@ -1258,7 +1258,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
}
if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) {
- ret = FFS_PERMISSIONERR;
+ ret = -EPERM;
goto out2;
}
@@ -1365,7 +1365,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid)
}
if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) {
- ret = FFS_PERMISSIONERR;
+ ret = -EPERM;
goto out;
}
fs_set_vol_flags(sb, VOL_DIRTY);
@@ -1947,7 +1947,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
/* check if the given file ID is opened */
if (fid->type != TYPE_DIR)
- return FFS_PERMISSIONERR;
+ return -EPERM;
/* acquire the lock for file system critical section */
down(&p_fs->v_sem);
@@ -2145,7 +2145,7 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid)
/* check if the file is "." or ".." */
if (p_fs->vol_type != EXFAT) {
if ((dir.dir != p_fs->root_dir) && (dentry < 2))
- return FFS_PERMISSIONERR;
+ return -EPERM;
}
/* acquire the lock for file system critical section */
@@ -2526,7 +2526,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
err = ffsRemoveFile(dir, &(EXFAT_I(inode)->fid));
if (err) {
- if (err == FFS_PERMISSIONERR)
+ if (err == -EPERM)
err = -EPERM;
else
err = -EIO;
@@ -2746,7 +2746,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
err = ffsMoveFile(old_dir, &(EXFAT_I(old_inode)->fid), new_dir,
new_dentry);
if (err) {
- if (err == FFS_PERMISSIONERR)
+ if (err == -EPERM)
err = -EPERM;
else if (err == FFS_INVALIDPATH)
err = -EINVAL;
--
2.23.0
Powered by blists - more mailing lists