f2fs_fs.h: Use standard fixed width integer types

commit 7a5109ff62c97646276db38aa5cdf805e43ed8ea
category: bugfix
issue: #I6VAS0
CVE: NA

Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------

Use uint64_t instead of __u64 in the definitions of the endianness
conversion macros. This patch fixes the following compiler warning:

dir.c: In function ‘f2fs_create’:
dir.c:785:16: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 12 has type ‘long long unsigned int’ [-Wformat=]
  785 |         MSG(1, "Info: Create %s -> %s\n"
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
../include/f2fs_fs.h:252:32: note: in definition of macro ‘MSG’
  252 |                         printf(fmt, ##__VA_ARGS__);                     \
      |                                ^~~

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
Bart Van Assche 2022-04-21 15:18:17 -07:00 committed by dongsenhao
parent 94fcae1bcf
commit 445873df9c
2 changed files with 9 additions and 9 deletions

View File

@ -250,7 +250,7 @@ void print_inode_info(struct f2fs_sb_info *sbi,
MSG(0, " - File name : %s%s\n", en,
enc_name ? " <encrypted>" : "");
setlocale(LC_ALL, "");
MSG(0, " - File size : %'llu (bytes)\n",
MSG(0, " - File size : %'" PRIu64 " (bytes)\n",
le64_to_cpu(inode->i_size));
return;
}

View File

@ -188,12 +188,12 @@ static inline uint64_t bswap_64(uint64_t val)
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define le16_to_cpu(x) ((__u16)(x))
#define le32_to_cpu(x) ((__u32)(x))
#define le64_to_cpu(x) ((__u64)(x))
#define cpu_to_le16(x) ((__u16)(x))
#define cpu_to_le32(x) ((__u32)(x))
#define cpu_to_le64(x) ((__u64)(x))
#define le16_to_cpu(x) ((uint16_t)(x))
#define le32_to_cpu(x) ((uint32_t)(x))
#define le64_to_cpu(x) ((uint64_t)(x))
#define cpu_to_le16(x) ((uint16_t)(x))
#define cpu_to_le32(x) ((uint32_t)(x))
#define cpu_to_le64(x) ((uint64_t)(x))
#elif __BYTE_ORDER == __BIG_ENDIAN
#define le16_to_cpu(x) bswap_16(x)
#define le32_to_cpu(x) bswap_32(x)
@ -291,10 +291,10 @@ static inline uint64_t bswap_64(uint64_t val)
do { \
assert(sizeof((ptr)->member) == 8); \
if (c.layout) \
printf("%-30s %llu\n", \
printf("%-30s %" PRIu64 "\n", \
#member":", le64_to_cpu(((ptr)->member))); \
else \
printf("%-30s" "\t\t[0x%8llx : %llu]\n", \
printf("%-30s" "\t\t[0x%8" PRIx64 " : %" PRIu64 "]\n", \
#member, le64_to_cpu(((ptr)->member)), \
le64_to_cpu(((ptr)->member))); \
} while (0)