diff mbox series

[f2fs-dev] f2fs-tools: quick fix for Android build

Message ID 20230717181805.285894-1-jaegeuk@kernel.org (mailing list archive)
State New
Headers show
Series [f2fs-dev] f2fs-tools: quick fix for Android build | expand

Commit Message

Jaegeuk Kim July 17, 2023, 6:18 p.m. UTC
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);

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 include/f2fs_fs.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Chao Yu July 18, 2023, 12:50 a.m. UTC | #1
On 2023/7/18 2:18, Jaegeuk Kim wrote:
> 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);
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,
diff mbox series

Patch

diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index 2f632593696a..7e7db229b9a4 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -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));