staging: exfat: Clean up return codes - FFS_PERMISSIONERR
authorValdis Kletnieks <valdis.kletnieks@vt.edu>
Thu, 24 Oct 2019 15:53:15 +0000 (11:53 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Oct 2019 02:49:36 +0000 (22:49 -0400)
Convert FFS_PERMISSIONERR to -EPERM

Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191024155327.1095907-5-Valdis.Kletnieks@vt.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/exfat/exfat.h
drivers/staging/exfat/exfat_super.c

index f3736b33ca562798a344dd09c726a429eb91d334..a6e0c79ba6a44964d4d5cb09a49c54b90bde2d5e 100644 (file)
@@ -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
index 638de11eb6257916618d9e37885d14ab7f7e112c..afa687a786a3c7cec84a1803509f45c0e0ca2d83 100644 (file)
@@ -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 */
        if (fid->type != TYPE_FILE) {
-               ret = FFS_PERMISSIONERR;
+               ret = -EPERM;
                goto out;
        }
 
@@ -838,7 +838,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;
        }
 
@@ -1085,7 +1085,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;
        }
 
@@ -1252,7 +1252,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;
                }
        }
@@ -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) {
-               ret = FFS_PERMISSIONERR;
+               ret = -EPERM;
                goto out2;
        }
 
@@ -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) {
-               ret = FFS_PERMISSIONERR;
+               ret = -EPERM;
                goto out;
        }
        fs_set_vol_flags(sb, VOL_DIRTY);
@@ -1953,7 +1953,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);
@@ -2151,7 +2151,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 */
@@ -2532,7 +2532,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;
@@ -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,
                          new_dentry);
        if (err) {
-               if (err == FFS_PERMISSIONERR)
+               if (err == -EPERM)
                        err = -EPERM;
                else if (err == FFS_INVALIDPATH)
                        err = -EINVAL;