From b4ed8f75c82876342b3399942427392ba5f3bbb5 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 4 Jun 2019 14:50:24 +0100 Subject: fs/adfs: add time stamp and file type helpers Add some helpers to check whether the inode has a time stamp and file type, and to parse the file type from the load address. Signed-off-by: Russell King Signed-off-by: Al Viro --- fs/adfs/dir.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'fs/adfs/dir.c') diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 01ffd47c7461..77503d12f7ee 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -38,20 +38,14 @@ void adfs_object_fixup(struct adfs_dir *dir, struct object_info *obj) if (obj->name_len <= 2 && dots == obj->name_len) obj->name[0] = '^'; - obj->filetype = -1; - /* - * object is a file and is filetyped and timestamped? - * RISC OS 12-bit filetype is stored in load_address[19:8] + * If the object is a file, and the user requested the ,xyz hex + * filetype suffix to the name, check the filetype and append. */ - if ((0 == (obj->attr & ADFS_NDA_DIRECTORY)) && - (0xfff00000 == (0xfff00000 & obj->loadaddr))) { - obj->filetype = (__u16) ((0x000fff00 & obj->loadaddr) >> 8); - - /* optionally append the ,xyz hex filetype suffix */ - if (ADFS_SB(dir->sb)->s_ftsuffix) { - __u16 filetype = obj->filetype; + if (!(obj->attr & ADFS_NDA_DIRECTORY) && ADFS_SB(dir->sb)->s_ftsuffix) { + u16 filetype = adfs_filetype(obj->loadaddr); + if (filetype != ADFS_FILETYPE_NONE) { 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); -- cgit v1.2.3