[PATCH] hpfs: fix coding style of fs/hpfs/inode.c

From: Tetsuo Handa

Date: Wed Jul 01 2026 - 11:03:44 EST


No functional change intended.

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
---
This is an attempt to get sashiko's review. If the reason of "Failed To Apply" is
due to coding style, we need to fix coding style first.

fs/hpfs/inode.c | 81 +++++++++++++++++++++++++++++++++----------------
1 file changed, 55 insertions(+), 26 deletions(-)

diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 1b4fcf760aad..86ccaffe9b55 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -21,7 +21,7 @@ void hpfs_init_inode(struct inode *i)
i->i_mode = hpfs_sb(sb)->sb_mode;
i->i_size = -1;
i->i_blocks = -1;
-
+
hpfs_inode->i_dno = 0;
hpfs_inode->i_n_secs = 0;
hpfs_inode->i_file_sec = 0;
@@ -50,31 +50,37 @@ void hpfs_read_inode(struct inode *i)
void *ea;
int ea_size;

- if (!(fnode = hpfs_map_fnode(sb, i->i_ino, &bh))) {
- /*i->i_mode |= S_IFREG;
+ fnode = hpfs_map_fnode(sb, i->i_ino, &bh);
+ if (!fnode) {
+ /*
+ i->i_mode |= S_IFREG;
i->i_mode &= ~0111;
i->i_op = &hpfs_file_iops;
i->i_fop = &hpfs_file_ops;
- clear_nlink(i);*/
+ clear_nlink(i);
+ */
make_bad_inode(i);
return;
}
if (hpfs_sb(i->i_sb)->sb_eas) {
- if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) {
+ ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size);
+ if (ea) {
if (ea_size == 2) {
- i_uid_write(i, le16_to_cpu(*(__le16*)ea));
+ i_uid_write(i, le16_to_cpu(*(__le16 *)ea));
hpfs_inode->i_ea_uid = 1;
}
kfree(ea);
}
- if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) {
+ ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size);
+ if (ea) {
if (ea_size == 2) {
- i_gid_write(i, le16_to_cpu(*(__le16*)ea));
+ i_gid_write(i, le16_to_cpu(*(__le16 *)ea));
hpfs_inode->i_ea_gid = 1;
}
kfree(ea);
}
- if ((ea = hpfs_get_ea(i->i_sb, fnode, "SYMLINK", &ea_size))) {
+ ea = hpfs_get_ea(i->i_sb, fnode, "SYMLINK", &ea_size);
+ if (ea) {
kfree(ea);
i->i_mode = S_IFLNK | 0777;
i->i_op = &page_symlink_inode_operations;
@@ -86,19 +92,22 @@ void hpfs_read_inode(struct inode *i)
brelse(bh);
return;
}
- if ((ea = hpfs_get_ea(i->i_sb, fnode, "MODE", &ea_size))) {
+ ea = hpfs_get_ea(i->i_sb, fnode, "MODE", &ea_size);
+ if (ea) {
int rdev = 0;
umode_t mode = hpfs_sb(sb)->sb_mode;
+
if (ea_size == 2) {
- mode = le16_to_cpu(*(__le16*)ea);
+ mode = le16_to_cpu(*(__le16 *)ea);
hpfs_inode->i_ea_mode = 1;
}
kfree(ea);
i->i_mode = mode;
if (S_ISBLK(mode) || S_ISCHR(mode)) {
- if ((ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size))) {
+ ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size);
+ if (ea) {
if (ea_size == 4)
- rdev = le32_to_cpu(*(__le32*)ea);
+ rdev = le32_to_cpu(*(__le32 *)ea);
kfree(ea);
}
}
@@ -115,6 +124,7 @@ void hpfs_read_inode(struct inode *i)
}
if (fnode_is_dir(fnode)) {
int n_dnodes, n_subdirs;
+
i->i_mode |= S_IFDIR;
i->i_op = &hpfs_dir_iops;
i->i_fop = &hpfs_dir_ops;
@@ -122,7 +132,9 @@ void hpfs_read_inode(struct inode *i)
hpfs_inode->i_dno = le32_to_cpu(fnode->u.external[0].disk_secno);
if (hpfs_sb(sb)->sb_chk >= 2) {
struct buffer_head *bh0;
- if (hpfs_map_fnode(sb, hpfs_inode->i_parent_dir, &bh0)) brelse(bh0);
+
+ if (hpfs_map_fnode(sb, hpfs_inode->i_parent_dir, &bh0))
+ brelse(bh0);
}
n_dnodes = 0; n_subdirs = 0;
hpfs_count_dnodes(i->i_sb, hpfs_inode->i_dno, &n_dnodes, &n_subdirs, NULL);
@@ -131,7 +143,8 @@ void hpfs_read_inode(struct inode *i)
set_nlink(i, 2 + n_subdirs);
} else {
i->i_mode |= S_IFREG;
- if (!hpfs_inode->i_ea_mode) i->i_mode &= ~0111;
+ if (!hpfs_inode->i_ea_mode)
+ i->i_mode &= ~0111;
i->i_op = &hpfs_file_iops;
i->i_fop = &hpfs_file_ops;
set_nlink(i, 1);
@@ -146,15 +159,19 @@ void hpfs_read_inode(struct inode *i)
static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode)
{
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
- /*if (le32_to_cpu(fnode->acl_size_l) || le16_to_cpu(fnode->acl_size_s)) {
+ /*
+ if (le32_to_cpu(fnode->acl_size_l) || le16_to_cpu(fnode->acl_size_s)) {
Some unknown structures like ACL may be in fnode,
we'd better not overwrite them
hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 structures", i->i_ino);
- } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) {
+ } else
+ */
+ if (hpfs_sb(i->i_sb)->sb_eas >= 2) {
__le32 ea;
+
if (!uid_eq(i->i_uid, hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) {
ea = cpu_to_le32(i_uid_read(i));
- hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2);
+ hpfs_set_ea(i, fnode, "UID", (char *)&ea, 2);
hpfs_inode->i_ea_uid = 1;
}
if (!gid_eq(i->i_gid, hpfs_sb(i->i_sb)->sb_gid) || hpfs_inode->i_ea_gid) {
@@ -183,7 +200,9 @@ void hpfs_write_inode(struct inode *i)
{
struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
struct inode *parent;
- if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return;
+
+ if (i->i_ino == hpfs_sb(i->i_sb)->sb_root)
+ return;
if (hpfs_inode->i_rddir_off && !icount_read_once(i)) {
if (*hpfs_inode->i_rddir_off)
pr_err("write_inode: some position still there\n");
@@ -213,20 +232,29 @@ void hpfs_write_inode_nolock(struct inode *i)
struct fnode *fnode;
struct quad_buffer_head qbh;
struct hpfs_dirent *de;
- if (i->i_ino == hpfs_sb(i->i_sb)->sb_root) return;
- if (!(fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) return;
+
+ if (i->i_ino == hpfs_sb(i->i_sb)->sb_root)
+ return;
+ fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh);
+ if (!fnode)
+ return;
if (i->i_ino != hpfs_sb(i->i_sb)->sb_root && i->i_nlink) {
- if (!(de = map_fnode_dirent(i->i_sb, i->i_ino, fnode, &qbh))) {
+ de = map_fnode_dirent(i->i_sb, i->i_ino, fnode, &qbh);
+ if (!de) {
brelse(bh);
return;
}
- } else de = NULL;
+ } else {
+ de = NULL;
+ }
if (S_ISREG(i->i_mode)) {
fnode->file_size = cpu_to_le32(i->i_size);
- if (de) de->file_size = cpu_to_le32(i->i_size);
+ if (de)
+ de->file_size = cpu_to_le32(i->i_size);
} else if (S_ISDIR(i->i_mode)) {
fnode->file_size = cpu_to_le32(0);
- if (de) de->file_size = cpu_to_le32(0);
+ if (de)
+ de->file_size = cpu_to_le32(0);
}
hpfs_write_inode_ea(i, fnode);
if (de) {
@@ -239,7 +267,8 @@ void hpfs_write_inode_nolock(struct inode *i)
hpfs_brelse4(&qbh);
}
if (S_ISDIR(i->i_mode)) {
- if ((de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh))) {
+ de = map_dirent(i, hpfs_inode->i_dno, "\001\001", 2, NULL, &qbh);
+ if (de) {
de->write_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_mtime_sec(i)));
de->read_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_atime_sec(i)));
de->creation_date = cpu_to_le32(gmt_to_local(i->i_sb, inode_get_ctime_sec(i)));
--
2.54.0