From ef83971929711ccd17fc0e4be09754cb3219b3cf Mon Sep 17 00:00:00 2001 From: "qinglin.li" Date: Tue, 16 Jul 2024 20:57:59 +0800 Subject: [PATCH] ntfs3: ntfs3 fs_umode_to_dtype not in abi list [1/1] PD#SWPL-169224 Problem: ntfs3 fs_umode_to_dtype not in abi list Solution: ntfs3 fs_umode_to_dtype not in abi list Verify: local Change-Id: Ibf190585f7606539b5df98151e8dd617ad66c9da Signed-off-by: qinglin.li --- fs/ntfs3/dir.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c index 72cdfa8727d3..fcde05be3ecb 100644 --- a/fs/ntfs3/dir.c +++ b/fs/ntfs3/dir.c @@ -272,6 +272,18 @@ out: return err == -ENOENT ? NULL : err ? ERR_PTR(err) : inode; } +#if IS_MODULE(CONFIG_NTFS3_FS) +static const unsigned char fs_ftype_by_dtype[DT_MAX] = { + [DT_REG] = FT_REG_FILE, + [DT_DIR] = FT_DIR, + [DT_LNK] = FT_SYMLINK, + [DT_CHR] = FT_CHRDEV, + [DT_BLK] = FT_BLKDEV, + [DT_FIFO] = FT_FIFO, + [DT_SOCK] = FT_SOCK, +}; +#endif + static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni, const struct NTFS_DE *e, u8 *name, struct dir_context *ctx) @@ -330,7 +342,11 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni, ino != ni->mi.rno) { struct inode *inode = ntfs_iget5(sbi->sb, &e->ref, NULL); if (!IS_ERR_OR_NULL(inode)) { +#if IS_MODULE(CONFIG_NTFS3_FS) + dt_type = fs_ftype_to_dtype(fs_ftype_by_dtype[S_DT(inode->i_mode)]); +#else dt_type = fs_umode_to_dtype(inode->i_mode); +#endif iput(inode); } }