[v2,01/10] staging: exfat: Clean up return codes - FFS_FORMATERR
diff mbox series

Message ID 20191104014510.102356-2-Valdis.Kletnieks@vt.edu
State New
Headers show
Series
  • staging: exfat: Clean up return codes, revisited
Related show

Commit Message

Valdis Kl ē tnieks Nov. 4, 2019, 1:44 a.m. UTC
Convert FFS_FORMATERR to -EFSCORRUPTED

Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
---
 drivers/staging/exfat/exfat.h      | 3 ++-
 drivers/staging/exfat/exfat_core.c | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

Comments

Greg KH Nov. 5, 2019, 5:05 p.m. UTC | #1
On Sun, Nov 03, 2019 at 08:44:57PM -0500, Valdis Kletnieks wrote:
> Convert FFS_FORMATERR to -EFSCORRUPTED
> 
> Signed-off-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
> ---
>  drivers/staging/exfat/exfat.h      | 3 ++-
>  drivers/staging/exfat/exfat_core.c | 8 ++++----
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
> index acb73f47a253..4f9ba235d967 100644
> --- a/drivers/staging/exfat/exfat.h
> +++ b/drivers/staging/exfat/exfat.h
> @@ -30,6 +30,8 @@
>  #undef DEBUG
>  #endif
>  
> +#define EFSCORRUPTED	EUCLEAN		/* Filesystem is corrupted */
> +
>  #define DENTRY_SIZE		32	/* dir entry size */
>  #define DENTRY_SIZE_BITS	5
>  
> @@ -209,7 +211,6 @@ static inline u16 get_row_index(u16 i)
>  /* return values */
>  #define FFS_SUCCESS             0
>  #define FFS_MEDIAERR            1
> -#define FFS_FORMATERR           2
>  #define FFS_MOUNTED             3
>  #define FFS_NOTMOUNTED          4
>  #define FFS_ALIGNMENTERR        5
> diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
> index b23fbf3ebaa5..e90b54a17150 100644
> --- a/drivers/staging/exfat/exfat_core.c
> +++ b/drivers/staging/exfat/exfat_core.c
> @@ -573,7 +573,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
>  			return FFS_MEDIAERR;
>  	}
>  
> -	return FFS_FORMATERR;
> +	return -EFSCORRUPTED;
>  }
>  
>  void free_alloc_bitmap(struct super_block *sb)
> @@ -3016,7 +3016,7 @@ s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
>  	struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
>  
>  	if (p_bpb->num_fats == 0)
> -		return FFS_FORMATERR;
> +		return -EFSCORRUPTED;
>  
>  	num_root_sectors = GET16(p_bpb->num_root_entries) << DENTRY_SIZE_BITS;
>  	num_root_sectors = ((num_root_sectors - 1) >>
> @@ -3078,7 +3078,7 @@ s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
>  	struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
>  
>  	if (p_bpb->num_fats == 0)
> -		return FFS_FORMATERR;
> +		return -EFSCORRUPTED;
>  
>  	p_fs->sectors_per_clu = p_bpb->sectors_per_clu;
>  	p_fs->sectors_per_clu_bits = ilog2(p_bpb->sectors_per_clu);
> @@ -3157,7 +3157,7 @@ s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
>  	struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
>  
>  	if (p_bpb->num_fats == 0)
> -		return FFS_FORMATERR;
> +		return -EFSCORRUPTED;
>  
>  	p_fs->sectors_per_clu = 1 << p_bpb->sectors_per_clu_bits;
>  	p_fs->sectors_per_clu_bits = p_bpb->sectors_per_clu_bits;

This patch breaks the build:

drivers/staging/exfat/exfat_super.c: In function ‘ffsMountVol’:
drivers/staging/exfat/exfat_super.c:387:9: error: ‘FFS_FORMATERR’ undeclared (first use in this function)
  387 |   ret = FFS_FORMATERR;
      |         ^~~~~~~~~~~~~


Did you test-build this thing?

thanks,

greg k-h

Patch
diff mbox series

diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index acb73f47a253..4f9ba235d967 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -30,6 +30,8 @@ 
 #undef DEBUG
 #endif
 
+#define EFSCORRUPTED	EUCLEAN		/* Filesystem is corrupted */
+
 #define DENTRY_SIZE		32	/* dir entry size */
 #define DENTRY_SIZE_BITS	5
 
@@ -209,7 +211,6 @@  static inline u16 get_row_index(u16 i)
 /* return values */
 #define FFS_SUCCESS             0
 #define FFS_MEDIAERR            1
-#define FFS_FORMATERR           2
 #define FFS_MOUNTED             3
 #define FFS_NOTMOUNTED          4
 #define FFS_ALIGNMENTERR        5
diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index b23fbf3ebaa5..e90b54a17150 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -573,7 +573,7 @@  s32 load_alloc_bitmap(struct super_block *sb)
 			return FFS_MEDIAERR;
 	}
 
-	return FFS_FORMATERR;
+	return -EFSCORRUPTED;
 }
 
 void free_alloc_bitmap(struct super_block *sb)
@@ -3016,7 +3016,7 @@  s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
 	struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
 
 	if (p_bpb->num_fats == 0)
-		return FFS_FORMATERR;
+		return -EFSCORRUPTED;
 
 	num_root_sectors = GET16(p_bpb->num_root_entries) << DENTRY_SIZE_BITS;
 	num_root_sectors = ((num_root_sectors - 1) >>
@@ -3078,7 +3078,7 @@  s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
 	struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
 
 	if (p_bpb->num_fats == 0)
-		return FFS_FORMATERR;
+		return -EFSCORRUPTED;
 
 	p_fs->sectors_per_clu = p_bpb->sectors_per_clu;
 	p_fs->sectors_per_clu_bits = ilog2(p_bpb->sectors_per_clu);
@@ -3157,7 +3157,7 @@  s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
 	struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
 
 	if (p_bpb->num_fats == 0)
-		return FFS_FORMATERR;
+		return -EFSCORRUPTED;
 
 	p_fs->sectors_per_clu = 1 << p_bpb->sectors_per_clu_bits;
 	p_fs->sectors_per_clu_bits = p_bpb->sectors_per_clu_bits;