Re: [PATCH 02/15] ext2fs, e2fsck: add kernel endian-ness conversion macros

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

 



On Fri, Nov 20, 2020 at 11:15:53AM -0800, Harshad Shirwadkar wrote:
> diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
> index 505b3c9c..3c7b2496 100644
> --- a/lib/ext2fs/bitops.h
> +++ b/lib/ext2fs/bitops.h
> @@ -247,6 +247,14 @@ extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap
>  #endif /* __STDC_VERSION__ >= 199901L */
>  #endif /* INCLUDE_INLINE_FUNCS */
>  
> +/* Macros for kernel compatibility */
> +#define be32_to_cpu(x)		ext2fs_be32_to_cpu(x)
> +#define le32_to_cpu(x)		ext2fs_le32_to_cpu(x)
> +#define le16_to_cpu(x)		ext2fs_le16_to_cpu(x)
> +
> +#define cpu_to_be32(x)		ext2fs_cpu_to_be32(x)
> +#define cpu_to_be16(x)		ext2fs_cpu_to_be16(x)
> +#define cpu_to_le16(x)		ext2fs_cpu_to_le16(x)
>  /*
>   * Fast bit set/clear functions that doesn't need to return the
>   * previous bit value.

Kernel compatibility #define's should be in e2fsck/jfs_user.h.

The problem with putting them in lib/ext2fs/bitops.h is that this a
published header file which will be pulled in by external userspace
applications which #include <ext2fs/ext2fs.h>.  And we don't want to
have namespace leakage which might interfere with other header files
or the application's definition of these cpp macros.

						- Ted



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux