From: Russell King <rmk+kernel@armlinux.org.uk>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 6/7] fs/adfs: move append_filetype_suffix() into adfs_object_fixup()
Date: Mon, 20 May 2019 15:13:29 +0100 [thread overview]
Message-ID: <E1hSj2f-0000Lz-71@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20190520141227.krqowhs3yg7hpige@shell.armlinux.org.uk>
append_filetype_suffix() is now only used in adfs_object_fixup(), so
move it there.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
fs/adfs/adfs.h | 13 -------------
fs/adfs/dir.c | 13 ++++++++-----
2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h
index 1097bee65fa9..804c6a77c5db 100644
--- a/fs/adfs/adfs.h
+++ b/fs/adfs/adfs.h
@@ -113,19 +113,6 @@ struct object_info {
__u16 filetype;
};
-/* RISC OS 12-bit filetype converts to ,xyz hex filename suffix */
-static inline int append_filetype_suffix(char *buf, __u16 filetype)
-{
- if (filetype == 0xffff) /* no explicit 12-bit file type was set */
- return 0;
-
- *buf++ = ',';
- *buf++ = hex_asc_lo(filetype >> 8);
- *buf++ = hex_asc_lo(filetype >> 4);
- *buf++ = hex_asc_lo(filetype >> 0);
- return 4;
-}
-
struct adfs_dir_ops {
int (*read)(struct super_block *sb, unsigned int id, unsigned int sz, struct adfs_dir *dir);
int (*setpos)(struct adfs_dir *dir, unsigned int fpos);
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 5d88108339df..51ed80ff10a5 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -42,11 +42,14 @@ void adfs_object_fixup(struct adfs_dir *dir, struct object_info *obj)
obj->filetype = (__u16) ((0x000fff00 & obj->loadaddr) >> 8);
/* optionally append the ,xyz hex filetype suffix */
- if (ADFS_SB(dir->sb)->s_ftsuffix)
- obj->name_len +=
- append_filetype_suffix(
- &obj->name[obj->name_len],
- obj->filetype);
+ if (ADFS_SB(dir->sb)->s_ftsuffix) {
+ __u16 filetype = obj->filetype;
+
+ obj->name[obj->name_len++] = ',';
+ obj->name[obj->name_len++] = hex_asc_lo(filetype >> 8);
+ obj->name[obj->name_len++] = hex_asc_lo(filetype >> 4);
+ obj->name[obj->name_len++] = hex_asc_lo(filetype >> 0);
+ }
}
}
--
2.7.4
next prev parent reply other threads:[~2019-05-20 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 14:12 [PATCH 0/7] fs/adfs fixes Russell King - ARM Linux admin
2019-05-20 14:13 ` [PATCH 1/7] fs/adfs: factor out filename comparison Russell King
2019-05-20 14:13 ` [PATCH 2/7] fs/adfs: factor out filename case lowering Russell King
2019-05-20 14:13 ` [PATCH 3/7] fs/adfs: factor out object fixups Russell King
2019-05-20 14:13 ` [PATCH 4/7] fs/adfs: factor out filename fixup Russell King
2019-05-20 14:13 ` [PATCH 5/7] fs/adfs: remove truncated filename hashing Russell King
2019-05-20 14:13 ` Russell King [this message]
2019-05-20 14:13 ` [PATCH 7/7] fs/adfs: fix filename fixup handling for "/" and "//" names Russell King
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=E1hSj2f-0000Lz-71@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).