Remove implementation of readpage from the hugetlbfs_aops
[safe/jmp/linux-2.6] / fs / adfs / super.c
index 9ade139..dd9becc 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/vfs.h>
 #include <linux/parser.h>
 #include <linux/bitops.h>
+#include <linux/mount.h>
+#include <linux/seq_file.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.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];
        va_list args;
 
        va_start(args, fmt);
-       vsprintf(error_buf, fmt, args);
+       vsnprintf(error_buf, sizeof(error_buf), fmt, args);
        va_end(args);
 
        printk(KERN_CRIT "ADFS-fs error (device %s)%s%s: %s\n",
@@ -134,9 +139,25 @@ static void adfs_put_super(struct super_block *sb)
        sb->s_fs_info = NULL;
 }
 
+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,26 +219,30 @@ 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;
 }
 
-static kmem_cache_t *adfs_inode_cachep;
+static struct kmem_cache *adfs_inode_cachep;
 
 static struct inode *adfs_alloc_inode(struct super_block *sb)
 {
        struct adfs_inode_info *ei;
-       ei = (struct adfs_inode_info *)kmem_cache_alloc(adfs_inode_cachep, SLAB_KERNEL);
+       ei = (struct adfs_inode_info *)kmem_cache_alloc(adfs_inode_cachep, GFP_KERNEL);
        if (!ei)
                return NULL;
        return &ei->vfs_inode;
@@ -228,22 +253,20 @@ static void adfs_destroy_inode(struct inode *inode)
        kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
 }
 
-static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
+static void init_once(void *foo)
 {
        struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
 
-       if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
-           SLAB_CTOR_CONSTRUCTOR)
-               inode_init_once(&ei->vfs_inode);
+       inode_init_once(&ei->vfs_inode);
 }
+
 static int init_inodecache(void)
 {
        adfs_inode_cachep = kmem_cache_create("adfs_inode_cache",
                                             sizeof(struct adfs_inode_info),
                                             0, (SLAB_RECLAIM_ACCOUNT|
                                                SLAB_MEM_SPREAD),
-                                            init_once, NULL);
+                                            init_once);
        if (adfs_inode_cachep == NULL)
                return -ENOMEM;
        return 0;
@@ -254,13 +277,14 @@ static void destroy_inodecache(void)
        kmem_cache_destroy(adfs_inode_cachep);
 }
 
-static struct super_operations adfs_sops = {
+static const struct super_operations adfs_sops = {
        .alloc_inode    = adfs_alloc_inode,
        .destroy_inode  = adfs_destroy_inode,
        .write_inode    = adfs_write_inode,
        .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)
@@ -346,8 +370,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;