Skip to contentSkip to conversation

erofs-utils: avoid PAGE_SIZE redefinition

PATCH In review Gao Xiang via Linux-erofs 2 participants 3 messages Mar 25, 2020 – Mar 27, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 erofs-utils: avoid PAGE_SIZE redefinition

Buildroot autobuild reported a PAGE_SIZE redefinition with some configrations on i586 toolchain [1] (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

---
 include/erofs/internal.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/erofs/internal.h +10 -0
index e7d5a64..41da189 100644
@@ -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)
Signature · 1 line
2.20.1
author Reviewed-by Li Guifu on v1 1/1
#2 lore raw
Quoted 15 lines · Gao Xiang

Buildroot autobuild reported a PAGE_SIZE redefinition with some configrations on i586 toolchain [1] (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

Quoted 6 lines

cc1: all warnings being treated as errors

Fix it now.

[1] http://autobuild.buildroot.net/results/340b98caa45bafd43f109002be9da59ba7f6d971

It looks good

Thanks

Reviewed-by on v1 1/1
#3 lore raw
In reply to Gao Xiang via Linux-erofs
Quoted 15 lines · Gao Xiang via Linux-erofs

Buildroot autobuild reported a PAGE_SIZE redefinition with some configrations on i586 toolchain [1] (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

Quoted 6 lines

cc1: all warnings being treated as errors

Fix it now.

[1] http://autobuild.buildroot.net/results/340b98caa45bafd43f109002be9da59ba7f6d971

Thanks,