New helper - current_umask()
[safe/jmp/linux-2.6] / fs / hpfs / super.c
index 1b95f39..c696d01 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/statfs.h>
 #include <linux/magic.h>
+#include <linux/sched.h>
 
 /* Mark the filesystem dirty, so that chkdsk checks it when os/2 booted */
 
@@ -172,24 +173,22 @@ static void hpfs_destroy_inode(struct inode *inode)
        kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
 }
 
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
+static void init_once(void *foo)
 {
        struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
 
-       if (flags & SLAB_CTOR_CONSTRUCTOR) {
-               mutex_init(&ei->i_mutex);
-               mutex_init(&ei->i_parent_mutex);
-               inode_init_once(&ei->vfs_inode);
-       }
+       mutex_init(&ei->i_mutex);
+       mutex_init(&ei->i_parent_mutex);
+       inode_init_once(&ei->vfs_inode);
 }
+
 static int init_inodecache(void)
 {
        hpfs_inode_cachep = kmem_cache_create("hpfs_inode_cache",
                                             sizeof(struct hpfs_inode_info),
                                             0, (SLAB_RECLAIM_ACCOUNT|
                                                SLAB_MEM_SPREAD),
-                                            init_once, NULL);
+                                            init_once);
        if (hpfs_inode_cachep == NULL)
                return -ENOMEM;
        return 0;
@@ -216,7 +215,7 @@ enum {
        Opt_timeshift, Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_help, "help"},
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
@@ -387,6 +386,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
        int lowercase, conv, eas, chk, errs, chkdsk, timeshift;
        int o;
        struct hpfs_sb_info *sbi = hpfs_sb(s);
+       char *new_opts = kstrdup(data, GFP_KERNEL);
        
        *flags |= MS_NOATIME;
        
@@ -399,15 +399,15 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
        if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv,
            &eas, &chk, &errs, &chkdsk, &timeshift))) {
                printk("HPFS: bad mount options.\n");
-               return 1;
+               goto out_err;
        }
        if (o == 2) {
                hpfs_help();
-               return 1;
+               goto out_err;
        }
        if (timeshift != sbi->sb_timeshift) {
                printk("HPFS: timeshift can't be changed using remount.\n");
-               return 1;
+               goto out_err;
        }
 
        unmark_dirty(s);
@@ -420,7 +420,14 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
 
        if (!(*flags & MS_RDONLY)) mark_dirty(s);
 
+       kfree(s->s_options);
+       s->s_options = new_opts;
+
        return 0;
+
+out_err:
+       kfree(new_opts);
+       return -EINVAL;
 }
 
 /* Super operations */
@@ -433,6 +440,7 @@ static const struct super_operations hpfs_sops =
        .put_super      = hpfs_put_super,
        .statfs         = hpfs_statfs,
        .remount_fs     = hpfs_remount_fs,
+       .show_options   = generic_show_options,
 };
 
 static int hpfs_fill_super(struct super_block *s, void *options, int silent)
@@ -455,6 +463,8 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
 
        int o;
 
+       save_mount_options(s, options);
+
        sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
@@ -465,9 +475,9 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
 
        init_MUTEX(&sbi->hpfs_creation_de);
 
-       uid = current->uid;
-       gid = current->gid;
-       umask = current->fs->umask;
+       uid = current_uid();
+       gid = current_gid();
+       umask = current_umask();
        lowercase = 0;
        conv = CONV_BINARY;
        eas = 2;