Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/linux-dm
[cascardo/linux.git] / fs / adfs / super.c
index 06d7388..c8bf36a 100644 (file)
@@ -138,17 +138,20 @@ static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt)
                seq_printf(seq, ",ownmask=%o", asb->s_owner_mask);
        if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK)
                seq_printf(seq, ",othmask=%o", asb->s_other_mask);
+       if (asb->s_ftsuffix != 0)
+               seq_printf(seq, ",ftsuffix=%u", asb->s_ftsuffix);
 
        return 0;
 }
 
-enum {Opt_uid, Opt_gid, Opt_ownmask, Opt_othmask, Opt_err};
+enum {Opt_uid, Opt_gid, Opt_ownmask, Opt_othmask, Opt_ftsuffix, Opt_err};
 
 static const match_table_t tokens = {
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
        {Opt_ownmask, "ownmask=%o"},
        {Opt_othmask, "othmask=%o"},
+       {Opt_ftsuffix, "ftsuffix=%u"},
        {Opt_err, NULL}
 };
 
@@ -189,6 +192,11 @@ static int parse_options(struct super_block *sb, char *options)
                                return -EINVAL;
                        asb->s_other_mask = option;
                        break;
+               case Opt_ftsuffix:
+                       if (match_int(args, &option))
+                               return -EINVAL;
+                       asb->s_ftsuffix = option;
+                       break;
                default:
                        printk("ADFS-fs: unrecognised mount option \"%s\" "
                                        "or missing value\n", p);
@@ -366,6 +374,7 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
        asb->s_gid = 0;
        asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK;
        asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK;
+       asb->s_ftsuffix = 0;
 
        if (parse_options(sb, data))
                goto error;
@@ -445,11 +454,13 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
 
        root_obj.parent_id = root_obj.file_id = le32_to_cpu(dr->root);
        root_obj.name_len  = 0;
-       root_obj.loadaddr  = 0;
-       root_obj.execaddr  = 0;
+       /* Set root object date as 01 Jan 1987 00:00:00 */
+       root_obj.loadaddr  = 0xfff0003f;
+       root_obj.execaddr  = 0xec22c000;
        root_obj.size      = ADFS_NEWDIR_SIZE;
        root_obj.attr      = ADFS_NDA_DIRECTORY   | ADFS_NDA_OWNER_READ |
                             ADFS_NDA_OWNER_WRITE | ADFS_NDA_PUBLIC_READ;
+       root_obj.filetype  = -1;
 
        /*
         * If this is a F+ disk with variable length directories,
@@ -463,6 +474,12 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
                asb->s_dir     = &adfs_f_dir_ops;
                asb->s_namelen = ADFS_F_NAME_LEN;
        }
+       /*
+        * ,xyz hex filetype suffix may be added by driver
+        * to files that have valid RISC OS filetype
+        */
+       if (asb->s_ftsuffix)
+               asb->s_namelen += 4;
 
        sb->s_d_op = &adfs_dentry_operations;
        root = adfs_iget(sb, &root_obj);