]> Pileus Git - ~andy/linux/blobdiff - fs/adfs/dir_fplus.c
adfs: add hexadecimal filetype suffix option
[~andy/linux] / fs / adfs / dir_fplus.c
index a7f41da8115b5b59cb33696af473ff4917e07f08..d9e3bee4e653ff2c6df48006ddcdb3119082233a 100644 (file)
@@ -197,6 +197,24 @@ adfs_fplus_getnext(struct adfs_dir *dir, struct object_info *obj)
                if (obj->name[i] == '/')
                        obj->name[i] = '.';
 
+       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 ((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)
+                       obj->name_len +=
+                               append_filetype_suffix(
+                                       &obj->name[obj->name_len],
+                                       obj->filetype);
+       }
+
        dir->pos += 1;
        ret = 0;
 out: