/* SPDX-License-Identifier: BSD-2-Clause */ /* * What erofs_fs.h, which is kept as it is in Linux, takes from Linux headers: * the integer and little-endian types, a few macros, and the file type * and magic definitions that Linux keeps elsewhere. */ #ifndef _FS_EROFS_COMPAT_H_ #define _FS_EROFS_COMPAT_H_ #include #include typedef uint8_t u8; typedef uint8_t __u8; typedef uint32_t __u32; typedef uint16_t __le16; typedef uint32_t __le32; typedef uint64_t __le64; #define le16_to_cpu(x) le16toh(x) #define cpu_to_le64(x) htole64(x) #define BIT(n) (1UL << (n)) #define BIT_ULL(n) (1ULL << (n)) #define round_up(x, y) roundup2((x), (y)) /* Fails to compile when the condition is true, as in Linux. */ #define BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) /* include/uapi/linux/magic.h */ #define EROFS_SUPER_MAGIC_V1 0xE0F5E1E2 /* * File types in directory entries; Linux uses the generic FT_* values from * include/linux/fs_types.h. */ #define EROFS_FT_UNKNOWN 0 #define EROFS_FT_REG_FILE 1 #define EROFS_FT_DIR 2 #define EROFS_FT_CHRDEV 3 #define EROFS_FT_BLKDEV 4 #define EROFS_FT_FIFO 5 #define EROFS_FT_SOCK 6 #define EROFS_FT_SYMLINK 7 #endif