From: Adarsh Das <adarshdas950@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Adarsh Das <adarshdas950@gmail.com>
Subject: [PATCH] ufs: replace d_type switch with fs_umode_to_dtype()
Date: Sat, 7 Feb 2026 14:54:21 +0530 [thread overview]
Message-ID: <20260207092421.85256-1-adarshdas950@gmail.com> (raw)
ufs_set_de_type() was setting d_type via a switch over S_IFMT.
Replace this with fs_umode_to_dtype(), which provides the same
mapping and is the standard VFS helper for this purpose.
This also resolves the existing TODO comment.
Signed-off-by: Adarsh Das <adarshdas950@gmail.com>
---
fs/ufs/util.h | 29 +----------------------------
1 file changed, 1 insertion(+), 28 deletions(-)
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 391bb4f11d74..055b4543ad2a 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -152,34 +152,7 @@ ufs_set_de_type(struct super_block *sb, struct ufs_dir_entry *de, int mode)
if ((UFS_SB(sb)->s_flags & UFS_DE_MASK) != UFS_DE_44BSD)
return;
- /*
- * TODO turn this into a table lookup
- */
- switch (mode & S_IFMT) {
- case S_IFSOCK:
- de->d_u.d_44.d_type = DT_SOCK;
- break;
- case S_IFLNK:
- de->d_u.d_44.d_type = DT_LNK;
- break;
- case S_IFREG:
- de->d_u.d_44.d_type = DT_REG;
- break;
- case S_IFBLK:
- de->d_u.d_44.d_type = DT_BLK;
- break;
- case S_IFDIR:
- de->d_u.d_44.d_type = DT_DIR;
- break;
- case S_IFCHR:
- de->d_u.d_44.d_type = DT_CHR;
- break;
- case S_IFIFO:
- de->d_u.d_44.d_type = DT_FIFO;
- break;
- default:
- de->d_u.d_44.d_type = DT_UNKNOWN;
- }
+ de->d_u.d_44.d_type = fs_umode_to_dtype(mode);
}
static inline u32
--
2.53.0
reply other threads:[~2026-02-07 9:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260207092421.85256-1-adarshdas950@gmail.com \
--to=adarshdas950@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox