Linux-EROFS Archive on lore.kernel.org
 help / color / Atom feed
From: Gao Xiang via Linux-erofs <linux-erofs@lists.ozlabs.org>
To: linux-erofs@lists.ozlabs.org, Li Guifu <bluce.liguifu@huawei.com>,
	Li GuiFu <bluce.lee@aliyun.com>
Subject: [PATCH] erofs-utils: avoid PAGE_SIZE redefinition
Date: Wed, 25 Mar 2020 16:29:30 +0800
Message-ID: <20200325082930.2025-1-hsiangkao@aol.com> (raw)
In-Reply-To: <20200325082930.2025-1-hsiangkao.ref@aol.com>

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
Signed-off-by: Gao Xiang <hsiangkao@aol.com>
---
 include/erofs/internal.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

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)
-- 
2.20.1


       reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200325082930.2025-1-hsiangkao.ref@aol.com>
2020-03-25  8:29 ` Gao Xiang via Linux-erofs [this message]
2020-03-26 16:19   ` Li GuiFu via Linux-erofs
2020-03-27  7:42   ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200325082930.2025-1-hsiangkao@aol.com \
    --to=linux-erofs@lists.ozlabs.org \
    --cc=bluce.lee@aliyun.com \
    --cc=bluce.liguifu@huawei.com \
    --cc=hsiangkao@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-EROFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-erofs/0 linux-erofs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-erofs linux-erofs/ https://lore.kernel.org/linux-erofs \
		linux-erofs@lists.ozlabs.org linux-erofs@ozlabs.org
	public-inbox-index linux-erofs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linux-erofs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git