aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-04-21 15:18:19 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2022-04-22 11:43:13 -0700
commitcdefef0d077de556bc30e79e1bdd527b9bad6bb9 (patch)
treef65e8f7de1f03e1e4b77b8d2b2aefae13f97a500
parent1612bf99de322e2554a90dced7337ff2d8d1ded6 (diff)
downloadf2fs-tools-cdefef0d077de556bc30e79e1bdd527b9bad6bb9.tar.gz
Move the be32_to_cpu() definition
Move the be32_to_cpu() definition next to the little endian conversion functions. This patch improves portability since the MinGW ntohl() function exists in another library than the C library. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fsck/quotaio.h2
-rw-r--r--include/f2fs_fs.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/fsck/quotaio.h b/fsck/quotaio.h
index 999e800..0024fe5 100644
--- a/fsck/quotaio.h
+++ b/fsck/quotaio.h
@@ -197,8 +197,6 @@ struct quotafile_ops {
#define __force
#endif
-#define be32_to_cpu(n) ntohl(n)
-
/* Open existing quotafile of given type (and verify its format) on given
* filesystem. */
errcode_t quota_file_open(struct f2fs_sb_info *sbi, struct quota_handle *h,
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 0cadb93..568573a 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -194,6 +194,7 @@ static inline uint64_t bswap_64(uint64_t val)
#define cpu_to_le16(x) ((uint16_t)(x))
#define cpu_to_le32(x) ((uint32_t)(x))
#define cpu_to_le64(x) ((uint64_t)(x))
+#define be32_to_cpu(x) __builtin_bswap64(x)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define le16_to_cpu(x) bswap_16(x)
#define le32_to_cpu(x) bswap_32(x)
@@ -201,6 +202,7 @@ static inline uint64_t bswap_64(uint64_t val)
#define cpu_to_le16(x) bswap_16(x)
#define cpu_to_le32(x) bswap_32(x)
#define cpu_to_le64(x) bswap_64(x)
+#define be32_to_cpu(x) ((uint64_t)(x))
#endif
#define typecheck(type,x) \