Commit 7ca8049f authored by Valdis Kletnieks's avatar Valdis Kletnieks Committed by Greg Kroah-Hartman

staging: exfat: Clean up return codes - FFS_PERMISSIONERR

Convert FFS_PERMISSIONERR to -EPERM
Signed-off-by: default avatarValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191024155327.1095907-5-Valdis.Kletnieks@vt.eduSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent df7098f8
...@@ -217,7 +217,6 @@ static inline u16 get_row_index(u16 i) ...@@ -217,7 +217,6 @@ static inline u16 get_row_index(u16 i)
#define FFS_INVALIDPATH 7 #define FFS_INVALIDPATH 7
#define FFS_INVALIDFID 8 #define FFS_INVALIDFID 8
#define FFS_FILEEXIST 10 #define FFS_FILEEXIST 10
#define FFS_PERMISSIONERR 11
#define FFS_NOTOPENED 12 #define FFS_NOTOPENED 12
#define FFS_MAXOPENED 13 #define FFS_MAXOPENED 13
#define FFS_EOF 15 #define FFS_EOF 15
......
...@@ -708,7 +708,7 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer, ...@@ -708,7 +708,7 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer,
/* check if the given file ID is opened */ /* check if the given file ID is opened */
if (fid->type != TYPE_FILE) { if (fid->type != TYPE_FILE) {
ret = FFS_PERMISSIONERR; ret = -EPERM;
goto out; goto out;
} }
...@@ -838,7 +838,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, ...@@ -838,7 +838,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
/* check if the given file ID is opened */ /* check if the given file ID is opened */
if (fid->type != TYPE_FILE) { if (fid->type != TYPE_FILE) {
ret = FFS_PERMISSIONERR; ret = -EPERM;
goto out; goto out;
} }
...@@ -1085,7 +1085,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size) ...@@ -1085,7 +1085,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
/* check if the given file ID is opened */ /* check if the given file ID is opened */
if (fid->type != TYPE_FILE) { if (fid->type != TYPE_FILE) {
ret = FFS_PERMISSIONERR; ret = -EPERM;
goto out; goto out;
} }
...@@ -1252,7 +1252,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, ...@@ -1252,7 +1252,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
/* check if the old file is "." or ".." */ /* check if the old file is "." or ".." */
if (p_fs->vol_type != EXFAT) { if (p_fs->vol_type != EXFAT) {
if ((olddir.dir != p_fs->root_dir) && (dentry < 2)) { if ((olddir.dir != p_fs->root_dir) && (dentry < 2)) {
ret = FFS_PERMISSIONERR; ret = -EPERM;
goto out2; goto out2;
} }
} }
...@@ -1264,7 +1264,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, ...@@ -1264,7 +1264,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) { if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) {
ret = FFS_PERMISSIONERR; ret = -EPERM;
goto out2; goto out2;
} }
...@@ -1371,7 +1371,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid) ...@@ -1371,7 +1371,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid)
} }
if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) { if (p_fs->fs_func->get_entry_attr(ep) & ATTR_READONLY) {
ret = FFS_PERMISSIONERR; ret = -EPERM;
goto out; goto out;
} }
fs_set_vol_flags(sb, VOL_DIRTY); fs_set_vol_flags(sb, VOL_DIRTY);
...@@ -1953,7 +1953,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) ...@@ -1953,7 +1953,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
/* check if the given file ID is opened */ /* check if the given file ID is opened */
if (fid->type != TYPE_DIR) if (fid->type != TYPE_DIR)
return FFS_PERMISSIONERR; return -EPERM;
/* acquire the lock for file system critical section */ /* acquire the lock for file system critical section */
down(&p_fs->v_sem); down(&p_fs->v_sem);
...@@ -2151,7 +2151,7 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid) ...@@ -2151,7 +2151,7 @@ static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid)
/* check if the file is "." or ".." */ /* check if the file is "." or ".." */
if (p_fs->vol_type != EXFAT) { if (p_fs->vol_type != EXFAT) {
if ((dir.dir != p_fs->root_dir) && (dentry < 2)) if ((dir.dir != p_fs->root_dir) && (dentry < 2))
return FFS_PERMISSIONERR; return -EPERM;
} }
/* acquire the lock for file system critical section */ /* acquire the lock for file system critical section */
...@@ -2532,7 +2532,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry) ...@@ -2532,7 +2532,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
err = ffsRemoveFile(dir, &(EXFAT_I(inode)->fid)); err = ffsRemoveFile(dir, &(EXFAT_I(inode)->fid));
if (err) { if (err) {
if (err == FFS_PERMISSIONERR) if (err == -EPERM)
err = -EPERM; err = -EPERM;
else else
err = -EIO; err = -EIO;
...@@ -2752,7 +2752,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -2752,7 +2752,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
err = ffsMoveFile(old_dir, &(EXFAT_I(old_inode)->fid), new_dir, err = ffsMoveFile(old_dir, &(EXFAT_I(old_inode)->fid), new_dir,
new_dentry); new_dentry);
if (err) { if (err) {
if (err == FFS_PERMISSIONERR) if (err == -EPERM)
err = -EPERM; err = -EPERM;
else if (err == FFS_INVALIDPATH) else if (err == FFS_INVALIDPATH)
err = -EINVAL; err = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment