diff mbox series

[f2fs-dev,2/2] f2fs_io: Define _FILE_OFFSET_BITS=64

Message ID 20221222022830.976309-2-raj.khem@gmail.com (mailing list archive)
State New
Headers show
Series [f2fs-dev,1/2] f2fs_io: Fix out of tree builds | expand

Commit Message

Khem Raj Dec. 22, 2022, 2:28 a.m. UTC
Remove _LARGEFILE64_SOURCE, this is redundant when _FILE_OFFSET_BITS=64
additionally it fixes build with musl because the detection logic for
lseek64 fails because when using _LARGEFILE64_SOURCE musl also define's
lseek64 as an alias to lseek

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 lib/libf2fs_io.c        | 4 +++-
 tools/f2fs_io/f2fs_io.c | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Jaegeuk Kim Dec. 23, 2022, 12:14 a.m. UTC | #1
On 12/21, Khem Raj wrote:
> Remove _LARGEFILE64_SOURCE, this is redundant when _FILE_OFFSET_BITS=64
> additionally it fixes build with musl because the detection logic for
> lseek64 fails because when using _LARGEFILE64_SOURCE musl also define's
> lseek64 as an alias to lseek
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  lib/libf2fs_io.c        | 4 +++-
>  tools/f2fs_io/f2fs_io.c | 4 ++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
> index 1a8167d..abb43a3 100644
> --- a/lib/libf2fs_io.c
> +++ b/lib/libf2fs_io.c
> @@ -11,7 +11,9 @@
>   *
>   * Dual licensed under the GPL or LGPL version 2 licenses.
>   */
> -#define _LARGEFILE64_SOURCE
> +#ifndef _FILE_OFFSET_BITS
> +#define _FILE_OFFSET_BITS 64
> +#endif

This fails to build in x86_64/gcc.

libf2fs_io.c:87:8: error: unknown type name 'off64_t'
   87 | static off64_t  *dcache_blk; /* which block it cached */
      |        ^~~~~~~


>  
>  #include <stdio.h>
>  #include <stdlib.h>
> diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
> index 6dcd840..cb99039 100644
> --- a/tools/f2fs_io/f2fs_io.c
> +++ b/tools/f2fs_io/f2fs_io.c
> @@ -12,8 +12,8 @@
>  #ifndef _LARGEFILE_SOURCE
>  #define _LARGEFILE_SOURCE
>  #endif
> -#ifndef _LARGEFILE64_SOURCE
> -#define _LARGEFILE64_SOURCE
> +#ifndef _FILE_OFFSET_BITS
> +#define _FILE_OFFSET_BITS 64
>  #endif
>  #ifndef O_LARGEFILE
>  #define O_LARGEFILE 0
> -- 
> 2.39.0
> 
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
diff mbox series

Patch

diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 1a8167d..abb43a3 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -11,7 +11,9 @@ 
  *
  * Dual licensed under the GPL or LGPL version 2 licenses.
  */
-#define _LARGEFILE64_SOURCE
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index 6dcd840..cb99039 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -12,8 +12,8 @@ 
 #ifndef _LARGEFILE_SOURCE
 #define _LARGEFILE_SOURCE
 #endif
-#ifndef _LARGEFILE64_SOURCE
-#define _LARGEFILE64_SOURCE
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
 #endif
 #ifndef O_LARGEFILE
 #define O_LARGEFILE 0