summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@aol.com>2020-03-25 15:42:22 +0800
committerGao Xiang <hsiangkao@aol.com>2020-03-28 17:18:30 +0800
commitbdbabe54112d04c05819ebebf4e6f88ae863d436 (patch)
tree93e3e01dc3752ad150398b4241d64fd6cb019e0b
parent989947348dddf03a8292b5e32bca538f0a325cd9 (diff)
erofs-utils: avoid PAGE_SIZE redefinition
Buildroot autobuild reported a PAGE_SIZE redefinition with toolchain using musl, on x86 (32- or 64-bit) platforms [1] [2] [3]. (I didn't notice such report from erofs-utils travis CI or distribution builds before.) In file included from config.c:11: ../include/erofs/internal.h:27: error: "PAGE_SIZE" redefined [-Werror] #define PAGE_SIZE (1U << PAGE_SHIFT) In file included from ../include/erofs/defs.h:17, from ../include/erofs/config.h:12, from ../include/erofs/print.h:12, from config.c:10: .../sysroot/usr/include/limits.h:89: note: this is the location of the previous definition #define PAGE_SIZE PAGESIZE cc1: all warnings being treated as errors Fix it now. [1] http://autobuild.buildroot.net/results/340b98caa45bafd43f109002be9da59ba7f6d971 [2] http://autobuild.buildroot.net/results/42cd24535ab38cb9b416b730a034a1dbe3293bf5 [3] http://autobuild.buildroot.net/results/260cdb3203e9141e674f38a2acd127d10320f8fa Link: https://lore.kernel.org/r/20200325082930.2025-1-hsiangkao@aol.com Reviewed-by: Li Guifu <bluce.lee@aliyun.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Gao Xiang <hsiangkao@aol.com>
-rw-r--r--include/erofs/internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index e7d5a64..41da189 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -23,8 +23,18 @@ typedef unsigned short umode_t;
#define PATH_MAX 4096 /* # chars in a path name including nul */
#endif
+#ifndef PAGE_SHIFT
#define PAGE_SHIFT (12)
+#endif
+
+#ifndef PAGE_SIZE
#define PAGE_SIZE (1U << PAGE_SHIFT)
+#endif
+
+/* no obvious reason to support explicit PAGE_SIZE != 4096 for now */
+#if PAGE_SIZE != 4096
+#error incompatible PAGE_SIZE is already defined
+#endif
#define LOG_BLOCK_SIZE (12)
#define EROFS_BLKSIZ (1U << LOG_BLOCK_SIZE)