Re: [RFC][PATCH 05/11] exofs: use common file type conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/19/2016 10:11 PM, Amir Goldstein wrote:
> deduplicate the exofs file type conversion implementation.
> 
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>

Yes! thank you cool.

ACK-by: Boaz Harrosh <ooo@xxxxxxxxxxxxxxx>

Al please take via your tree
> ---
>  fs/exofs/common.h | 12 ------------
>  fs/exofs/dir.c    | 34 ++--------------------------------
>  2 files changed, 2 insertions(+), 44 deletions(-)
> 
> diff --git a/fs/exofs/common.h b/fs/exofs/common.h
> index 7d88ef5..917decc9 100644
> --- a/fs/exofs/common.h
> +++ b/fs/exofs/common.h
> @@ -204,18 +204,6 @@ struct exofs_dir_entry {
>  	char		name[EXOFS_NAME_LEN];	/* file name              */
>  };
>  
> -enum {
> -	EXOFS_FT_UNKNOWN,
> -	EXOFS_FT_REG_FILE,
> -	EXOFS_FT_DIR,
> -	EXOFS_FT_CHRDEV,
> -	EXOFS_FT_BLKDEV,
> -	EXOFS_FT_FIFO,
> -	EXOFS_FT_SOCK,
> -	EXOFS_FT_SYMLINK,
> -	EXOFS_FT_MAX
> -};
> -
>  #define EXOFS_DIR_PAD			4
>  #define EXOFS_DIR_ROUND			(EXOFS_DIR_PAD - 1)
>  #define EXOFS_DIR_REC_LEN(name_len) \
> diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
> index 42f9a0a..55fd31c 100644
> --- a/fs/exofs/dir.c
> +++ b/fs/exofs/dir.c
> @@ -203,33 +203,10 @@ exofs_validate_entry(char *base, unsigned offset, unsigned mask)
>  	return (char *)p - base;
>  }
>  
> -static unsigned char exofs_filetype_table[EXOFS_FT_MAX] = {
> -	[EXOFS_FT_UNKNOWN]	= DT_UNKNOWN,
> -	[EXOFS_FT_REG_FILE]	= DT_REG,
> -	[EXOFS_FT_DIR]		= DT_DIR,
> -	[EXOFS_FT_CHRDEV]	= DT_CHR,
> -	[EXOFS_FT_BLKDEV]	= DT_BLK,
> -	[EXOFS_FT_FIFO]		= DT_FIFO,
> -	[EXOFS_FT_SOCK]		= DT_SOCK,
> -	[EXOFS_FT_SYMLINK]	= DT_LNK,
> -};
> -
> -#define S_SHIFT 12
> -static unsigned char exofs_type_by_mode[S_IFMT >> S_SHIFT] = {
> -	[S_IFREG >> S_SHIFT]	= EXOFS_FT_REG_FILE,
> -	[S_IFDIR >> S_SHIFT]	= EXOFS_FT_DIR,
> -	[S_IFCHR >> S_SHIFT]	= EXOFS_FT_CHRDEV,
> -	[S_IFBLK >> S_SHIFT]	= EXOFS_FT_BLKDEV,
> -	[S_IFIFO >> S_SHIFT]	= EXOFS_FT_FIFO,
> -	[S_IFSOCK >> S_SHIFT]	= EXOFS_FT_SOCK,
> -	[S_IFLNK >> S_SHIFT]	= EXOFS_FT_SYMLINK,
> -};
> -
>  static inline
>  void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode)
>  {
> -	umode_t mode = inode->i_mode;
> -	de->file_type = exofs_type_by_mode[(mode & S_IFMT) >> S_SHIFT];
> +	de->file_type = fs_umode_to_ftype(inode->i_mode);
>  }
>  
>  static int
> @@ -279,16 +256,9 @@ exofs_readdir(struct file *file, struct dir_context *ctx)
>  				return -EIO;
>  			}
>  			if (de->inode_no) {
> -				unsigned char t;
> -
> -				if (de->file_type < EXOFS_FT_MAX)
> -					t = exofs_filetype_table[de->file_type];
> -				else
> -					t = DT_UNKNOWN;
> -
>  				if (!dir_emit(ctx, de->name, de->name_len,
>  						le64_to_cpu(de->inode_no),
> -						t)) {
> +						fs_dtype(de->file_type))) {
>  					exofs_put_page(page);
>  					return 0;
>  				}
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux