Skip to contentSkip to conversation

f2fs-tools: Build f2fs-tools with _FILE_OFFSET_BITS=64

PATCH In review Jaegeuk Kim via Linux-f2fs-devel 1 participant 6 messages Jul 2 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 f2fs-tools: Build f2fs-tools with _FILE_OFFSET_BITS=64

From: "xiuhong.wang" <[email protected]>

After commit b15b6cc56ac7("f2fs-tools: convert to lseek() and kill lseek64"), 32-bit Android should also be built with _FILE_OFFSET_BITS=64.

When calling the lseek function on arm32, if the offset exceeds 32 bits, lseek fails. Therefore, the flag _FILE_OFFSET_BITS=64 is added to support operations with offsets greater than 32 bits on arm32.

---
 tools/f2fs_io/Android.bp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/f2fs_io/Android.bp +2 -1
index 2cc81eb859d4..52cdb73f41d6 100644
@@ -1,7 +1,8 @@
 cc_defaults {
     name: "f2fs-io-defaults",
     cflags: [
-        "-Wno-unused-function"
+        "-D_FILE_OFFSET_BITS=64",
+        "-Wno-unused-function",
     ],
 }
 
Signature · 8 lines
2.55.0.rc0.799.gd6f94ed593-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
#1 lore raw

PATCH 2/3 f2fs_io: add include dir

From: Jaegeuk Kim <[email protected]>

---
 tools/f2fs_io/Android.bp | 3 +++
 1 file changed, 3 insertions(+)
tools/f2fs_io/Android.bp +3 -0
index 52cdb73f41d6..d507c63c4fd6 100644
@@ -4,6 +4,9 @@ cc_defaults {
         "-D_FILE_OFFSET_BITS=64",
         "-Wno-unused-function",
     ],
+    include_dirs: [
+       "external/f2fs-tools/include/",
+    ],
 }
 
 cc_binary {
Signature · 8 lines
2.55.0.rc0.799.gd6f94ed593-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author Reviewed-by Chao Yu on v1 2/3
#2 lore raw

Re: [f2fs-dev] [PATCH 2/3] f2fs_io: add include dir

Quoted 3 lines · On 7/2/26 14:56, Jaegeuk Kim via Linux-f2fs-devel wrote:

From: Jaegeuk Kim <[email protected]>

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

#3 lore raw

PATCH 3/3 f2fs-tools: fix build failure on mac

In reply to Jaegeuk Kim via Linux-f2fs-devel

external/f2fs-tools/lib/libf2fs.c:1019:12: error: use of undeclared identifier 'BLKFLSBUF'

 1019 |         ioctl(fd, BLKFLSBUF);
      |                   ^~~~~~~~~
Fixes c188a3e303d9 ("f2fs-tools: invalidate block device page cache before reading metadata")
---
 lib/libf2fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/libf2fs.c +2 -1
index 7f8b643d117d..93f36ca6a30c 100644
@@ -1016,8 +1016,9 @@ int get_device_info(int i)
 	}
 
 	dev->fd = fd;
+#ifdef BLKFLSBUF
 	ioctl(fd, BLKFLSBUF);
-
+#endif
 	if (c.sparse_mode && i == 0) {
 		if (f2fs_init_sparse_file()) {
 			free(stat_buf);
Signature · 8 lines
2.55.0.rc0.799.gd6f94ed593-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
author Reviewed-by Chao Yu on v1 3/3
#4 lore raw

Re: [f2fs-dev] [PATCH 3/3] f2fs-tools: fix build failure on mac

Quoted 6 lines · On 7/2/26 14:56, Jaegeuk Kim via Linux-f2fs-devel wrote:

external/f2fs-tools/lib/libf2fs.c:1019:12: error: use of undeclared identifier 'BLKFLSBUF'

  1019 |         ioctl(fd, BLKFLSBUF);
       |                   ^~~~~~~~~
Fixes c188a3e303d9 ("f2fs-tools: invalidate block device page cache before reading metadata")

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author Reviewed-by Chao Yu on v1 1/3
#5 lore raw
In reply to Jaegeuk Kim via Linux-f2fs-devel
Quoted 6 lines · On 7/2/26 14:56, Jaegeuk Kim via Linux-f2fs-devel wrote:

From: "xiuhong.wang" <[email protected]>

After commit b15b6cc56ac7("f2fs-tools: convert to lseek() and kill lseek64"), 32-bit Android should also be built with _FILE_OFFSET_BITS=64.

Quoted 8 lines

When calling the lseek function on arm32, if the offset exceeds 32 bits, lseek fails. Therefore, the flag _FILE_OFFSET_BITS=64 is added to support operations with offsets greater than 32 bits on arm32.

Thanks,

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel