Merge branch 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git...
[safe/jmp/linux-2.6] / fs / hfsplus / options.c
index cca0818..3fcbb0e 100644 (file)
@@ -22,10 +22,10 @@ enum {
        opt_umask, opt_uid, opt_gid,
        opt_part, opt_session, opt_nls,
        opt_nodecompose, opt_decompose,
-       opt_err
+       opt_force, opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        { opt_creator, "creator=%s" },
        { opt_type, "type=%s" },
        { opt_umask, "umask=%o" },
@@ -36,6 +36,7 @@ static match_table_t tokens = {
        { opt_nls, "nls=%s" },
        { opt_decompose, "decompose" },
        { opt_nodecompose, "nodecompose" },
+       { opt_force, "force" },
        { opt_err, NULL }
 };
 
@@ -47,9 +48,9 @@ void hfsplus_fill_defaults(struct hfsplus_sb_info *opts)
 
        opts->creator = HFSPLUS_DEF_CR_TYPE;
        opts->type = HFSPLUS_DEF_CR_TYPE;
-       opts->umask = current->fs->umask;
-       opts->uid = current->uid;
-       opts->gid = current->gid;
+       opts->umask = current_umask();
+       opts->uid = current_uid();
+       opts->gid = current_gid();
        opts->part = -1;
        opts->session = -1;
 }
@@ -82,58 +83,59 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
                switch (token) {
                case opt_creator:
                        if (match_fourchar(&args[0], &sbi->creator)) {
-                               printk("HFS+-fs: creator requires a 4 character value\n");
+                               printk(KERN_ERR "hfs: creator requires a 4 character value\n");
                                return 0;
                        }
                        break;
                case opt_type:
                        if (match_fourchar(&args[0], &sbi->type)) {
-                               printk("HFS+-fs: type requires a 4 character value\n");
+                               printk(KERN_ERR "hfs: type requires a 4 character value\n");
                                return 0;
                        }
                        break;
                case opt_umask:
                        if (match_octal(&args[0], &tmp)) {
-                               printk("HFS+-fs: umask requires a value\n");
+                               printk(KERN_ERR "hfs: umask requires a value\n");
                                return 0;
                        }
                        sbi->umask = (umode_t)tmp;
                        break;
                case opt_uid:
                        if (match_int(&args[0], &tmp)) {
-                               printk("HFS+-fs: uid requires an argument\n");
+                               printk(KERN_ERR "hfs: uid requires an argument\n");
                                return 0;
                        }
                        sbi->uid = (uid_t)tmp;
                        break;
                case opt_gid:
                        if (match_int(&args[0], &tmp)) {
-                               printk("HFS+-fs: gid requires an argument\n");
+                               printk(KERN_ERR "hfs: gid requires an argument\n");
                                return 0;
                        }
                        sbi->gid = (gid_t)tmp;
                        break;
                case opt_part:
                        if (match_int(&args[0], &sbi->part)) {
-                               printk("HFS+-fs: part requires an argument\n");
+                               printk(KERN_ERR "hfs: part requires an argument\n");
                                return 0;
                        }
                        break;
                case opt_session:
                        if (match_int(&args[0], &sbi->session)) {
-                               printk("HFS+-fs: session requires an argument\n");
+                               printk(KERN_ERR "hfs: session requires an argument\n");
                                return 0;
                        }
                        break;
                case opt_nls:
                        if (sbi->nls) {
-                               printk("HFS+-fs: unable to change nls mapping\n");
+                               printk(KERN_ERR "hfs: unable to change nls mapping\n");
                                return 0;
                        }
                        p = match_strdup(&args[0]);
-                       sbi->nls = load_nls(p);
+                       if (p)
+                               sbi->nls = load_nls(p);
                        if (!sbi->nls) {
-                               printk("HFS+-fs: unable to load nls mapping \"%s\"\n", p);
+                               printk(KERN_ERR "hfs: unable to load nls mapping \"%s\"\n", p);
                                kfree(p);
                                return 0;
                        }
@@ -145,6 +147,9 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
                case opt_nodecompose:
                        sbi->flags |= HFSPLUS_SB_NODECOMPOSE;
                        break;
+               case opt_force:
+                       sbi->flags |= HFSPLUS_SB_FORCE;
+                       break;
                default:
                        return 0;
                }