Skip to contentSkip to conversation

f2fs-tools: quick fix for Android build

PATCH In review Jaegeuk Kim 2 participants 2 messages Jul 17, 2023 – Jul 18, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: quick fix for Android build

In file included from external/f2fs-tools/lib/nls_utf8.c:29:
external/f2fs-tools/include/f2fs_fs.h:1781:44: error: call to undeclared function 'S_ISDIR'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

        raw_node->i.i_current_depth = cpu_to_le32(S_ISDIR(mode) ? 1 : 0);
---
 include/f2fs_fs.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/f2fs_fs.h +4 -2
index 2f632593696a..7e7db229b9a4 100644
@@ -1359,7 +1359,9 @@ enum FILE_TYPE {
 
 #define LINUX_S_IFMT  00170000
 #define LINUX_S_IFREG  0100000
+#define LINUX_S_IFDIR  0040000
 #define LINUX_S_ISREG(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
+#define LINUX_S_ISDIR(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
 
 /* from f2fs/segment.h */
 enum {
@@ -1778,10 +1780,10 @@ static inline void f2fs_init_inode(struct f2fs_super_block *sb,
 	raw_node->i.i_generation = 0;
 	raw_node->i.i_xattr_nid = 0;
 	raw_node->i.i_flags = 0;
-	raw_node->i.i_current_depth = cpu_to_le32(S_ISDIR(mode) ? 1 : 0);
+	raw_node->i.i_current_depth = cpu_to_le32(LINUX_S_ISDIR(mode) ? 1 : 0);
 	raw_node->i.i_dir_level = DEF_DIR_LEVEL;
 	raw_node->i.i_mode = cpu_to_le16(mode);
-	raw_node->i.i_links = cpu_to_le32(S_ISDIR(mode) ? 2 : 1);
+	raw_node->i.i_links = cpu_to_le32(LINUX_S_ISDIR(mode) ? 2 : 1);
 
 	/* for dentry block in directory */
 	raw_node->i.i_size = cpu_to_le64(1 << get_sb(log_blocksize));
Signature · 8 lines
2.41.0.255.g8b1d071c50-goog



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jaegeuk Kim

In file included from external/f2fs-tools/lib/nls_utf8.c:29:
external/f2fs-tools/include/f2fs_fs.h:1781:44: error: call to undeclared function 'S_ISDIR'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

         raw_node->i.i_current_depth = cpu_to_le32(S_ISDIR(mode) ? 1 : 0);

Thanks,

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