lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8736qyd2sp.fsf@mail.parknet.co.jp>
Date:   Sun, 16 Dec 2018 04:10:14 +0900
From:   OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To:     Carmeli Tamir <carmeli.tamir@...il.com>
Cc:     linux-kernel@...r.kernel.org, jthumshirn@...e.de,
        sergey.senozhatsky@...il.com, akpm@...ux-foundation.org,
        bvanassche@....org, axboe@...nel.dk, martin.petersen@...cle.com,
        sfr@...b.auug.org.au
Subject: Re: [PATCH v2 2/3] fat: Moved MAX_FAT to fat.h and changed it to inline function

Carmeli Tamir <carmeli.tamir@...il.com> writes:

> MAX_FAT is useless in msdos_fs.h, since it uses the MSDOS_SB function
> that is defined in fat.h. So really, this macro can be only called
> from code that already includes fat.h.
>
> Hence, this patch moves it to fat.h, right after MSDOS_SB is defined.
> I also changed it to an inline function in order to save the double call
> to MSDOS_SB. This was suggested by joe@...ches.com in the previous
> version.
>
> This patch is required for the next in the series, in which the variant
> (whether this is FAT12, FAT16 or FAT32) checks are replaced with new 
> macros.

Could you use lower case chars for inline functions? Yeah, MSDOS_SB() is
upper case though, it is historical reason.

Thanks.

> Signed-off-by: Carmeli Tamir <carmeli.tamir@...il.com>
> ---
>  fs/fat/fat.h                  | 9 +++++++++
>  include/uapi/linux/msdos_fs.h | 2 --
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index 4e1b2f6..11bc4a2 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -142,6 +142,15 @@ static inline struct msdos_sb_info *MSDOS_SB(struct super_block *sb)
>  	return sb->s_fs_info;
>  }
>  
> +/* Maximum number of clusters */
> +static inline u32 MAX_FAT(struct super_block *sb)
> +{
> +	struct msdos_sb_info *sbi = MSDOS_SB(sb);
> +
> +	return sbi->fat_bits == 32 ? MAX_FAT32 :
> +		sbi->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12;
> +}
> +
>  static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
>  {
>  	return container_of(inode, struct msdos_inode_info, vfs_inode);
> diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h
> index 833c707..a577389 100644
> --- a/include/uapi/linux/msdos_fs.h
> +++ b/include/uapi/linux/msdos_fs.h
> @@ -65,8 +65,6 @@
>  #define MAX_FAT12	0xFF4
>  #define MAX_FAT16	0xFFF4
>  #define MAX_FAT32	0x0FFFFFF6
> -#define MAX_FAT(s)	(MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \
> -	MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
>  
>  /* bad cluster mark */
>  #define BAD_FAT12	0xFF7

-- 
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ