KVM: MMU: invalidate and flush on spte small->large page size change
[safe/jmp/linux-2.6] / fs / adfs / super.c
index b36695a..4a3af70 100644 (file)
@@ -8,28 +8,21 @@
  * published by the Free Software Foundation.
  */
 #include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/adfs_fs.h>
-#include <linux/slab.h>
-#include <linux/time.h>
-#include <linux/stat.h>
-#include <linux/string.h>
 #include <linux/init.h>
 #include <linux/buffer_head.h>
-#include <linux/vfs.h>
 #include <linux/parser.h>
-#include <linux/bitops.h>
-
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <stdarg.h>
-
+#include <linux/mount.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/smp_lock.h>
+#include <linux/statfs.h>
 #include "adfs.h"
 #include "dir_f.h"
 #include "dir_fplus.h"
 
+#define ADFS_DEFAULT_OWNER_MASK S_IRWXU
+#define ADFS_DEFAULT_OTHER_MASK (S_IRWXG | S_IRWXO)
+
 void __adfs_error(struct super_block *sb, const char *function, const char *fmt, ...)
 {
        char error_buf[128];
@@ -127,16 +120,36 @@ static void adfs_put_super(struct super_block *sb)
        int i;
        struct adfs_sb_info *asb = ADFS_SB(sb);
 
+       lock_kernel();
+
        for (i = 0; i < asb->s_map_size; i++)
                brelse(asb->s_map[i].dm_bh);
        kfree(asb->s_map);
        kfree(asb);
        sb->s_fs_info = NULL;
+
+       unlock_kernel();
+}
+
+static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt)
+{
+       struct adfs_sb_info *asb = ADFS_SB(mnt->mnt_sb);
+
+       if (asb->s_uid != 0)
+               seq_printf(seq, ",uid=%u", asb->s_uid);
+       if (asb->s_gid != 0)
+               seq_printf(seq, ",gid=%u", asb->s_gid);
+       if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK)
+               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);
+
+       return 0;
 }
 
 enum {Opt_uid, Opt_gid, Opt_ownmask, Opt_othmask, Opt_err};
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
        {Opt_ownmask, "ownmask=%o"},
@@ -198,16 +211,20 @@ static int adfs_remount(struct super_block *sb, int *flags, char *data)
 
 static int adfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-       struct adfs_sb_info *asb = ADFS_SB(dentry->d_sb);
+       struct super_block *sb = dentry->d_sb;
+       struct adfs_sb_info *sbi = ADFS_SB(sb);
+       u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
 
        buf->f_type    = ADFS_SUPER_MAGIC;
-       buf->f_namelen = asb->s_namelen;
-       buf->f_bsize   = dentry->d_sb->s_blocksize;
-       buf->f_blocks  = asb->s_size;
-       buf->f_files   = asb->s_ids_per_zone * asb->s_map_size;
+       buf->f_namelen = sbi->s_namelen;
+       buf->f_bsize   = sb->s_blocksize;
+       buf->f_blocks  = sbi->s_size;
+       buf->f_files   = sbi->s_ids_per_zone * sbi->s_map_size;
        buf->f_bavail  =
-       buf->f_bfree   = adfs_map_free(dentry->d_sb);
+       buf->f_bfree   = adfs_map_free(sb);
        buf->f_ffree   = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks;
+       buf->f_fsid.val[0] = (u32)id;
+       buf->f_fsid.val[1] = (u32)(id >> 32);
 
        return 0;
 }
@@ -228,7 +245,7 @@ static void adfs_destroy_inode(struct inode *inode)
        kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
 }
 
-static void init_once(struct kmem_cache *cachep, void *foo)
+static void init_once(void *foo)
 {
        struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
 
@@ -259,6 +276,7 @@ static const struct super_operations adfs_sops = {
        .put_super      = adfs_put_super,
        .statfs         = adfs_statfs,
        .remount_fs     = adfs_remount,
+       .show_options   = adfs_show_options,
 };
 
 static struct adfs_discmap *adfs_read_map(struct super_block *sb, struct adfs_discrecord *dr)
@@ -344,8 +362,8 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
        /* set default options */
        asb->s_uid = 0;
        asb->s_gid = 0;
-       asb->s_owner_mask = S_IRWXU;
-       asb->s_other_mask = S_IRWXG | S_IRWXO;
+       asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK;
+       asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK;
 
        if (parse_options(sb, data))
                goto error;
@@ -504,3 +522,4 @@ static void __exit exit_adfs_fs(void)
 
 module_init(init_adfs_fs)
 module_exit(exit_adfs_fs)
+MODULE_LICENSE("GPL");