Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gao Xiang <xiang@kernel.org>
To: Khem Raj <raj.khem@gmail.com>
Cc: linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH 2/3] erofs_fs.h: Make LFS mandatory for all usecases
Date: Thu, 8 Dec 2022 22:18:48 +0800	[thread overview]
Message-ID: <Y5HySDMzY8CSLQeJ@debian> (raw)
In-Reply-To: <20221208085335.2884608-2-raj.khem@gmail.com>

Hi Khem,

On Thu, Dec 08, 2022 at 12:53:34AM -0800, Khem Raj wrote:
> erosfs depend on the consistent use of a 64bit offset

Thanks for your patch!

  ^ erofs

> type, force downstreams to use transparent LFS (_FILE_OFFSET_BITS=64),
> so that it becomes impossible for them to use 32bit interfaces.
> 
> include autoconf'ed config.h to get definition of _FILE_OFFSET_BITS
> which was detected by configure. This header needs to be included
> before any system headers are included to ensure they see the correct
> definition of _FILE_OFFSET_BITS for the platform
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---

...

> diff --git a/include/erofs/internal.h b/include/erofs/internal.h
> index 6a70f11..9cc20a8 100644
> --- a/include/erofs/internal.h
> +++ b/include/erofs/internal.h
> @@ -12,6 +12,7 @@ extern "C"
>  {
>  #endif
>  
> +#include <config.h>

could we use alternative way? since I'd like to make include/ as
liberofs later, and "config.h" autoconf seems weird to me...

>  #include "list.h"
>  #include "err.h"
>  
> diff --git a/include/erofs_fs.h b/include/erofs_fs.h
> index 08f9761..a3bd93c 100644
> --- a/include/erofs_fs.h
> +++ b/include/erofs_fs.h
> @@ -9,6 +9,8 @@
>  #ifndef __EROFS_FS_H
>  #define __EROFS_FS_H
>  
> +#include <sys/types.h>

Could you give more hints why we need this here? 

> +
>  #define EROFS_SUPER_MAGIC_V1    0xE0F5E1E2
>  #define EROFS_SUPER_OFFSET      1024
>  
> @@ -410,6 +412,10 @@ enum {
>  
>  #define EROFS_NAME_LEN      255
>  
> +
> +/* make sure that any user of the erofs headers has atleast 64bit off_t type */
> +extern int eros_assert_largefile[sizeof(off_t)-8];

erofs? also you could add this into erofs/internal.h...

This file is just the on-disk definition...

> +
>  /* check the EROFS on-disk layout strictly at compile time */
>  static inline void erofs_check_ondisk_layout_definitions(void)
>  {
> diff --git a/lib/Makefile.am b/lib/Makefile.am
> index 3fad357..88400ed 100644
> --- a/lib/Makefile.am
> +++ b/lib/Makefile.am
> @@ -28,7 +28,7 @@ noinst_HEADERS += compressor.h
>  liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \
>  		      namei.c data.c compress.c compressor.c zmap.c decompress.c \
>  		      compress_hints.c hashmap.c sha256.c blobchunk.c dir.c
> -liberofs_la_CFLAGS = -Wall -I$(top_srcdir)/include
> +liberofs_la_CFLAGS = -Wall -I$(top_builddir) -I$(top_srcdir)/include -include config.h

same here too...

Thanks,
Gao Xiang

>  if ENABLE_LZ4
>  liberofs_la_CFLAGS += ${LZ4_CFLAGS}
>  liberofs_la_SOURCES += compressor_lz4.c
> diff --git a/mkfs/main.c b/mkfs/main.c
> index d2c9830..0e601d9 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -5,6 +5,7 @@
>   * Created by Li Guifu <bluce.liguifu@huawei.com>
>   */
>  #define _GNU_SOURCE
> +#include "config.h"
>  #include <time.h>
>  #include <sys/time.h>
>  #include <stdlib.h>
> -- 
> 2.38.1
> 

  reply	other threads:[~2022-12-08 14:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  8:53 [PATCH 1/3] configure: use AC_SYS_LARGEFILE Khem Raj
2022-12-08  8:53 ` [PATCH 2/3] erofs_fs.h: Make LFS mandatory for all usecases Khem Raj
2022-12-08 14:18   ` Gao Xiang [this message]
2022-12-10  2:20     ` Khem Raj
2022-12-10 15:03       ` Gao Xiang
2022-12-10 19:49         ` Khem Raj
2022-12-15  4:12           ` Gao Xiang
2022-12-15  5:26             ` Khem Raj
2022-12-08  8:53 ` [PATCH 3/3] erosfs: replace [l]stat64 by equivalent [l]stat Khem Raj

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=Y5HySDMzY8CSLQeJ@debian \
    --to=xiang@kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=raj.khem@gmail.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox