summaryrefslogtreecommitdiff
path: root/fs/adfs/dir_f.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-03-24 13:22:28 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2019-05-31 10:30:57 +0100
commitadb514a4e0f6d87ff43d1bc0a948c38530a0dc83 (patch)
treea02ad23959cab97dc61b30e96eb925dc16d1eaed /fs/adfs/dir_f.c
parent411c49bcf32d36b9988dc27968a92f3edf8ebed1 (diff)
fs/adfs: factor out filename fixup
Move the filename fixup to adfs_object_fixup() so we only have one implementation of this. Acked-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'fs/adfs/dir_f.c')
-rw-r--r--fs/adfs/dir_f.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c
index 1bab896918ed..033884541a63 100644
--- a/fs/adfs/dir_f.c
+++ b/fs/adfs/dir_f.c
@@ -41,21 +41,6 @@ static inline void adfs_writeval(unsigned char *p, int len, unsigned int val)
}
}
-static inline int adfs_readname(char *buf, char *ptr, int maxlen)
-{
- char *old_buf = buf;
-
- while ((unsigned char)*ptr >= ' ' && maxlen--) {
- if (*ptr == '/')
- *buf++ = '.';
- else
- *buf++ = *ptr;
- ptr++;
- }
-
- return buf - old_buf;
-}
-
#define ror13(v) ((v >> 13) | (v << 19))
#define dir_u8(idx) \
@@ -210,7 +195,16 @@ static inline void
adfs_dir2obj(struct adfs_dir *dir, struct object_info *obj,
struct adfs_direntry *de)
{
- obj->name_len = adfs_readname(obj->name, de->dirobname, ADFS_F_NAME_LEN);
+ unsigned int name_len;
+
+ for (name_len = 0; name_len < ADFS_F_NAME_LEN; name_len++) {
+ if (de->dirobname[name_len] < ' ')
+ break;
+
+ obj->name[name_len] = de->dirobname[name_len];
+ }
+
+ obj->name_len = name_len;
obj->file_id = adfs_readval(de->dirinddiscadd, 3);
obj->loadaddr = adfs_readval(de->dirload, 4);
obj->execaddr = adfs_readval(de->direxec, 4);