Commit 36c69833 authored by Alexander Viro's avatar Alexander Viro Committed by Jeff Garzik

[PATCH] the rest of ->get_sb() switchover

Switch over ext3, ufs, reiserfs, msdos, vfat, isofs, qnx4, hpfs, efs,
udf, romfs, bfs, affs, hfs, adfs, cramfs, ntfs, jffs, jffs2 and freevxfs
to new ->get_sb(). 

Kill ->read_super() that is thus no longer used.
parent 34f53a63
......@@ -346,7 +346,7 @@ static inline unsigned long adfs_discsize(struct adfs_discrecord *dr, int block_
return discsize;
}
struct super_block *adfs_read_super(struct super_block *sb, void *data, int silent)
static int adfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct adfs_discrecord *dr;
struct buffer_head *bh;
......@@ -467,15 +467,26 @@ struct super_block *adfs_read_super(struct super_block *sb, void *data, int sile
goto error;
} else
sb->s_root->d_op = &adfs_dentry_operations;
return sb;
return 0;
error_free_bh:
brelse(bh);
error:
return NULL;
return -EINVAL;
}
static struct super_block *adfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super);
}
static DECLARE_FSTYPE_DEV(adfs_fs_type, "adfs", adfs_read_super);
static struct file_system_type adfs_fs_type = {
owner: THIS_MODULE,
name: "adfs",
get_sb: adfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_adfs_fs(void)
{
......
......@@ -265,8 +265,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
* hopefully have the guts to do so. Until then: sorry for the mess.
*/
static struct super_block *
affs_read_super(struct super_block *sb, void *data, int silent)
static int affs_fill_super(struct super_block *sb, void *data, int silent)
{
struct buffer_head *root_bh = NULL;
struct buffer_head *boot_bh;
......@@ -294,7 +293,7 @@ affs_read_super(struct super_block *sb, void *data, int silent)
&blocksize,&AFFS_SB->s_prefix,
AFFS_SB->s_volume, &mount_flags)) {
printk(KERN_ERR "AFFS: Error parsing options\n");
return NULL;
return -EINVAL;
}
/* N.B. after this point s_prefix must be released */
......@@ -462,7 +461,7 @@ affs_read_super(struct super_block *sb, void *data, int silent)
sb->s_root->d_op = &affs_dentry_operations;
pr_debug("AFFS: s_flags=%lX\n",sb->s_flags);
return sb;
return 0;
/*
* Begin the cascaded cleanup ...
......@@ -475,7 +474,7 @@ affs_read_super(struct super_block *sb, void *data, int silent)
affs_brelse(root_bh);
if (AFFS_SB->s_prefix)
kfree(AFFS_SB->s_prefix);
return NULL;
return -EINVAL;
}
static int
......@@ -533,7 +532,18 @@ affs_statfs(struct super_block *sb, struct statfs *buf)
return 0;
}
static DECLARE_FSTYPE_DEV(affs_fs_type, "affs", affs_read_super);
static struct super_block *affs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super);
}
static struct file_system_type affs_fs_type = {
owner: THIS_MODULE,
name: "affs",
get_sb: affs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_affs_fs(void)
{
......
......@@ -279,8 +279,7 @@ void dump_imap(const char *prefix, struct super_block * s)
#endif
}
static struct super_block * bfs_read_super(struct super_block * s,
void * data, int silent)
static int bfs_fill_super(struct super_block *s, void *data, int silent)
{
struct buffer_head * bh;
struct bfs_super_block * bfs_sb;
......@@ -355,14 +354,25 @@ static struct super_block * bfs_read_super(struct super_block * s,
s->s_dirt = 1;
}
dump_imap("read_super", s);
return s;
return 0;
out:
brelse(bh);
return NULL;
return -EINVAL;
}
static DECLARE_FSTYPE_DEV(bfs_fs_type, "bfs", bfs_read_super);
static struct super_block *bfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super);
}
static struct file_system_type bfs_fs_type = {
owner: THIS_MODULE,
name: "bfs",
get_sb: bfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_bfs_fs(void)
{
......
......@@ -188,12 +188,11 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
}
static struct super_block * cramfs_read_super(struct super_block *sb, void *data, int silent)
static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
{
int i;
struct cramfs_super super;
unsigned long root_offset;
struct super_block * retval = NULL;
sb_set_blocksize(sb, PAGE_CACHE_SIZE);
......@@ -252,9 +251,9 @@ static struct super_block * cramfs_read_super(struct super_block *sb, void *data
/* Set it all up.. */
sb->s_op = &cramfs_ops;
sb->s_root = d_alloc_root(get_cramfs_inode(sb, &super.root));
retval = sb;
return 0;
out:
return retval;
return -EINVAL;
}
static int cramfs_statfs(struct super_block *sb, struct statfs *buf)
......@@ -442,7 +441,18 @@ static struct super_operations cramfs_ops = {
statfs: cramfs_statfs,
};
static DECLARE_FSTYPE_DEV(cramfs_fs_type, "cramfs", cramfs_read_super);
static struct super_block *cramfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super);
}
static struct file_system_type cramfs_fs_type = {
owner: THIS_MODULE,
name: "cramfs",
get_sb: cramfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_cramfs_fs(void)
{
......
......@@ -14,7 +14,18 @@
#include <linux/efs_fs_sb.h>
#include <linux/slab.h>
static DECLARE_FSTYPE_DEV(efs_fs_type, "efs", efs_read_super);
static struct super_block *efs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super);
}
static struct file_system_type efs_fs_type = {
owner: THIS_MODULE,
name: "efs",
get_sb: efs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static kmem_cache_t * efs_inode_cachep;
......@@ -188,7 +199,8 @@ static int efs_validate_super(struct efs_sb_info *sb, struct efs_super *super) {
return 0;
}
struct super_block *efs_read_super(struct super_block *s, void *d, int silent) {
int efs_fill_super(struct super_block *s, void *d, int silent)
{
struct efs_sb_info *sb;
struct buffer_head *bh;
......@@ -246,11 +258,11 @@ struct super_block *efs_read_super(struct super_block *s, void *d, int silent) {
goto out_no_fs;
}
return(s);
return 0;
out_no_fs_ul:
out_no_fs:
return(NULL);
return -EINVAL;
}
int efs_statfs(struct super_block *s, struct statfs *buf) {
......
......@@ -934,8 +934,7 @@ static loff_t ext3_max_size(int bits)
return res;
}
struct super_block * ext3_read_super (struct super_block * sb, void * data,
int silent)
static int ext3_fill_super (struct super_block *sb, void *data, int silent)
{
struct buffer_head * bh;
struct ext3_super_block *es = 0;
......@@ -1054,7 +1053,7 @@ struct super_block * ext3_read_super (struct super_block * sb, void * data,
if (!bh) {
printk(KERN_ERR
"EXT3-fs: Can't read superblock on 2nd try.\n");
return NULL;
return -EINVAL;
}
es = (struct ext3_super_block *)(((char *)bh->b_data) + offset);
sbi->s_es = es;
......@@ -1252,7 +1251,7 @@ struct super_block * ext3_read_super (struct super_block * sb, void * data,
test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
"writeback");
return sb;
return 0;
failed_mount3:
journal_destroy(sbi->s_journal);
......@@ -1264,7 +1263,7 @@ struct super_block * ext3_read_super (struct super_block * sb, void * data,
ext3_blkdev_remove(sbi);
brelse(bh);
out_fail:
return NULL;
return -EINVAL;
}
static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum)
......@@ -1769,7 +1768,18 @@ int ext3_statfs (struct super_block * sb, struct statfs * buf)
return 0;
}
static DECLARE_FSTYPE_DEV(ext3_fs_type, "ext3", ext3_read_super);
static struct super_block *ext3_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super);
}
static struct file_system_type ext3_fs_type = {
owner: THIS_MODULE,
name: "ext3",
get_sb: ext3_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_ext3_fs(void)
{
......
......@@ -135,8 +135,7 @@ vxfs_statfs(struct super_block *sbp, struct statfs *bufp)
* Locking:
* We are under the bkl and @sbp->s_lock.
*/
static struct super_block *
vxfs_read_super(struct super_block *sbp, void *dp, int silent)
static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent)
{
struct vxfs_sb_info *infp;
struct vxfs_sb *rsbp;
......@@ -146,7 +145,7 @@ vxfs_read_super(struct super_block *sbp, void *dp, int silent)
infp = kmalloc(sizeof(*infp), GFP_KERNEL);
if (!infp) {
printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n");
return NULL;
return -ENOMEM;
}
memset(infp, 0, sizeof(*infp));
......@@ -213,7 +212,7 @@ vxfs_read_super(struct super_block *sbp, void *dp, int silent)
goto out_free_ilist;
}
return (sbp);
return 0;
out_free_ilist:
vxfs_put_fake_inode(infp->vsi_fship);
......@@ -222,13 +221,24 @@ vxfs_read_super(struct super_block *sbp, void *dp, int silent)
out:
brelse(bp);
kfree(infp);
return NULL;
return -EINVAL;
}
/*
* The usual module blurb.
*/
static DECLARE_FSTYPE_DEV(vxfs_fs_type, "vxfs", vxfs_read_super);
static struct super_block *vxfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super);
}
static struct file_system_type vxfs_fs_type = {
owner: THIS_MODULE,
name: "vxfs",
get_sb: vxfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init
vxfs_init(void)
......
......@@ -95,7 +95,18 @@ static struct super_operations hfs_super_operations = {
/*================ File-local variables ================*/
static DECLARE_FSTYPE_DEV(hfs_fs, "hfs", hfs_read_super);
static struct super_block *hfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super);
}
static struct file_system_type hfs_fs = {
owner: THIS_MODULE,
name: "hfs",
get_sb: hfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
/*================ File-local functions ================*/
......@@ -429,8 +440,7 @@ static int parse_options(char *options, struct hfs_sb_info *hsb, int *part)
* hfs_btree_init() to get the necessary data about the extents and
* catalog B-trees and, finally, reading the root inode into memory.
*/
struct super_block *hfs_read_super(struct super_block *s, void *data,
int silent)
int hfs_fill_super(struct super_block *s, void *data, int silent)
{
struct hfs_mdb *mdb;
struct hfs_cat_key key;
......@@ -501,7 +511,7 @@ struct super_block *hfs_read_super(struct super_block *s, void *data,
s->s_root->d_op = &hfs_dentry_operations;
/* everything's okay */
return s;
return 0;
bail_no_root:
hfs_warn("hfs_fs: get root inode failed.\n");
......@@ -511,7 +521,7 @@ struct super_block *hfs_read_super(struct super_block *s, void *data,
bail2:
set_blocksize(dev, BLOCK_SIZE);
bail3:
return NULL;
return -EINVAL;
}
static int __init init_hfs_fs(void)
......
......@@ -405,8 +405,7 @@ int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
return 0;
}
struct super_block *hpfs_read_super(struct super_block *s, void *options,
int silent)
static int hpfs_fill_super(struct super_block *s, void *options, int silent)
{
struct buffer_head *bh0, *bh1, *bh2;
struct hpfs_boot_block *bootblock;
......@@ -598,7 +597,7 @@ struct super_block *hpfs_read_super(struct super_block *s, void *options,
}
if (de) hpfs_brelse4(&qbh);
return s;
return 0;
bail4: brelse(bh2);
bail3: brelse(bh1);
......@@ -607,10 +606,21 @@ bail2: brelse(bh0);
bail0:
if (s->s_hpfs_bmp_dir) kfree(s->s_hpfs_bmp_dir);
if (s->s_hpfs_cp_table) kfree(s->s_hpfs_cp_table);
return NULL;
return -EINVAL;
}
DECLARE_FSTYPE_DEV(hpfs_fs_type, "hpfs", hpfs_read_super);
static struct super_block *hpfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super);
}
static struct file_system_type hpfs_fs_type = {
owner: THIS_MODULE,
name: "hpfs",
get_sb: hpfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_hpfs_fs(void)
{
......
......@@ -510,8 +510,7 @@ static unsigned int isofs_get_last_session(struct super_block *sb,s32 session )
* Note: a check_disk_change() has been done immediately prior
* to this call, so we don't need to check again.
*/
static struct super_block *isofs_read_super(struct super_block *s, void *data,
int silent)
static int isofs_fill_super(struct super_block *s, void *data, int silent)
{
struct buffer_head * bh = NULL, *pri_bh = NULL;
struct hs_primary_descriptor * h_pri = NULL;
......@@ -843,16 +842,16 @@ static struct super_block *isofs_read_super(struct super_block *s, void *data,
if (opt.check == 'r') table++;
s->s_root->d_op = &isofs_dentry_ops[table];
return s;
return 0;
/*
* Display error messages and free resources.
*/
out_bad_root:
printk(KERN_WARNING "isofs_read_super: root inode not initialized\n");
printk(KERN_WARNING "isofs_fill_super: root inode not initialized\n");
goto out_iput;
out_no_root:
printk(KERN_WARNING "isofs_read_super: get root inode failed\n");
printk(KERN_WARNING "isofs_fill_super: get root inode failed\n");
out_iput:
iput(inode);
#ifdef CONFIG_JOLIET
......@@ -861,7 +860,7 @@ static struct super_block *isofs_read_super(struct super_block *s, void *data,
#endif
goto out_unlock;
out_no_read:
printk(KERN_WARNING "isofs_read_super: "
printk(KERN_WARNING "isofs_fill_super: "
"bread failed, dev=%s, iso_blknum=%d, block=%d\n",
s->s_id, iso_blknum, block);
goto out_unlock;
......@@ -885,7 +884,7 @@ static struct super_block *isofs_read_super(struct super_block *s, void *data,
out_freebh:
brelse(bh);
out_unlock:
return NULL;
return -EINVAL;
}
static int isofs_statfs (struct super_block *sb, struct statfs *buf)
......@@ -1395,7 +1394,18 @@ void leak_check_brelse(struct buffer_head * bh){
#endif
static DECLARE_FSTYPE_DEV(iso9660_fs_type, "iso9660", isofs_read_super);
static struct super_block *isofs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super);
}
static struct file_system_type iso9660_fs_type = {
owner: THIS_MODULE,
name: "iso9660",
get_sb: isofs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_iso9660_fs(void)
{
......
......@@ -71,8 +71,7 @@ kmem_cache_t *node_cache = NULL;
kmem_cache_t *fm_cache = NULL;
/* Called by the VFS at mount time to initialize the whole file system. */
static struct super_block *
jffs_read_super(struct super_block *sb, void *data, int silent)
static int jffs_fill_super(struct super_block *sb, void *data, int silent)
{
kdev_t dev = sb->s_dev;
struct inode *root_inode;
......@@ -84,7 +83,7 @@ jffs_read_super(struct super_block *sb, void *data, int silent)
if (major(dev) != MTD_BLOCK_MAJOR) {
printk(KERN_WARNING "JFFS: Trying to mount a "
"non-mtd device.\n");
return 0;
return -EINVAL;
}
sb->s_blocksize = PAGE_CACHE_SIZE;
......@@ -145,7 +144,7 @@ jffs_read_super(struct super_block *sb, void *data, int silent)
D1(printk(KERN_NOTICE "JFFS: Successfully mounted device %s.\n",
sb->s_id));
return sb;
return 0;
jffs_sb_err3:
iput(root_inode);
......@@ -154,7 +153,7 @@ jffs_read_super(struct super_block *sb, void *data, int silent)
jffs_sb_err1:
printk(KERN_WARNING "JFFS: Failed to mount device %s.\n",
sb->s_id);
return 0;
return -EINVAL;
}
......@@ -1730,8 +1729,18 @@ static struct super_operations jffs_ops =
statfs: jffs_statfs,
};
static struct super_block *jffs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, jffs_fill_super);
}
static DECLARE_FSTYPE_DEV(jffs_fs_type, "jffs", jffs_read_super);
static struct file_system_type jffs_fs_type = {
owner: THIS_MODULE,
name: "jffs",
get_sb: jffs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init
init_jffs_fs(void)
......
......@@ -195,7 +195,7 @@ static int jffs2_statfs(struct super_block *sb, struct statfs *buf)
return 0;
}
static struct super_block *jffs2_read_super(struct super_block *sb, void *data, int silent)
static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
{
struct jffs2_sb_info *c;
struct inode *root_i;
......@@ -206,7 +206,7 @@ static struct super_block *jffs2_read_super(struct super_block *sb, void *data,
if (major(sb->s_dev) != MTD_BLOCK_MAJOR) {
if (!silent)
printk(KERN_DEBUG "jffs2: attempt to mount non-MTD device %s\n", kdevname(sb->s_dev));
return NULL;
return -EINVAL;
}
c = JFFS2_SB_INFO(sb);
......@@ -215,7 +215,7 @@ static struct super_block *jffs2_read_super(struct super_block *sb, void *data,
c->mtd = get_mtd_device(NULL, minor(sb->s_dev));
if (!c->mtd) {
D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", MINOR(sb->s_dev)));
return NULL;
return -EINVAL;
}
c->sector_size = c->mtd->erasesize;
c->free_size = c->flash_size = c->mtd->size;
......@@ -275,7 +275,7 @@ static struct super_block *jffs2_read_super(struct super_block *sb, void *data,
sb->s_magic = JFFS2_SUPER_MAGIC;
if (!(sb->s_flags & MS_RDONLY))
jffs2_start_garbage_collect_thread(c);
return sb;
return 0;
out_root_i:
iput(root_i);
......@@ -285,7 +285,7 @@ static struct super_block *jffs2_read_super(struct super_block *sb, void *data,
kfree(c->blocks);
out_mtd:
put_mtd_device(c->mtd);
return NULL;
return -EINVAL;
}
void jffs2_put_super (struct super_block *sb)
......@@ -340,8 +340,18 @@ void jffs2_write_super (struct super_block *sb)
jffs2_mark_erased_blocks(c);
}
static struct super_block *jffs2_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, jffs2_fill_super);
}
static DECLARE_FSTYPE_DEV(jffs2_fs_type, "jffs2", jffs2_read_super);
static struct file_system_type jffs2_fs_type = {
owner: THIS_MODULE,
name: "jffs2",
get_sb: jffs2_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_jffs2_fs(void)
{
......
......@@ -25,7 +25,18 @@ EXPORT_SYMBOL(msdos_rmdir);
EXPORT_SYMBOL(msdos_unlink);
EXPORT_SYMBOL(msdos_put_super);
static DECLARE_FSTYPE_DEV(msdos_fs_type, "msdos", msdos_read_super);
static struct super_block *msdos_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super);
}
static struct file_system_type msdos_fs_type = {
owner: THIS_MODULE,
name: "msdos",
get_sb: msdos_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_msdos_fs(void)
{
......
......@@ -579,21 +579,21 @@ struct inode_operations msdos_dir_inode_operations = {
setattr: fat_notify_change,
};
struct super_block *msdos_read_super(struct super_block *sb,void *data, int silent)
int msdos_fill_super(struct super_block *sb,void *data, int silent)
{
struct super_block *res;
MSDOS_SB(sb)->options.isvfat = 0;
res = fat_read_super(sb, data, silent, &msdos_dir_inode_operations);
if (IS_ERR(res))
return NULL;
return PTR_ERR(res);
if (res == NULL) {
if (!silent)
printk(KERN_INFO "VFS: Can't find a valid"
" MSDOS filesystem on dev %s.\n", sb->s_id);
return NULL;
return -EINVAL;
}
sb->s_root->d_op = &msdos_dentry_operations;
return res;
return 0;
}
......@@ -453,7 +453,7 @@ static int __init root_nfs_get_handle(void)
/*
* Get the NFS port numbers and file handle, and return the prepared 'data'
* argument for ->read_super() if everything went OK. Return NULL otherwise.
* argument for mount() if everything went OK. Return NULL otherwise.
*/
void * __init nfs_root_data(void)
{
......
......@@ -1050,8 +1050,7 @@ static int is_boot_sector_ntfs(ntfs_u8 *b)
*
* NOTE : A context switch can happen in kernel code only if the code blocks
* (= calls schedule() in kernel/sched.c). */
struct super_block *ntfs_read_super(struct super_block *sb, void *options,
int silent)
static int ntfs_fill_super(struct super_block *sb, void *options, int silent)
{
ntfs_volume *vol;
struct buffer_head *bh;
......@@ -1142,19 +1141,28 @@ struct super_block *ntfs_read_super(struct super_block *sb, void *options,
ntfs_error("Could not get root dir inode\n");
goto ntfs_read_super_mft;
}
ntfs_read_super_ret:
ntfs_debug(DEBUG_OTHER, "read_super: done\n");
return sb;
return 0;
ntfs_read_super_mft:
ntfs_free(vol->mft);
ntfs_read_super_unl:
ntfs_read_super_vol:
sb = NULL;
goto ntfs_read_super_ret;
ntfs_debug(DEBUG_OTHER, "read_super: done\n");
return -EINVAL;
}
/* Define the filesystem */
static DECLARE_FSTYPE_DEV(ntfs_fs_type, "ntfs", ntfs_read_super);
static struct super_block *ntfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super);
}
static struct file_system_type ntfs_fs_type = {
owner: THIS_MODULE,
name: "ntfs",
get_sb: ntfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_ntfs_fs(void)
{
......
......@@ -119,7 +119,6 @@ static void qnx4_write_inode(struct inode *inode, int unused)
#endif
static struct super_block *qnx4_read_super(struct super_block *, void *, int);
static void qnx4_put_super(struct super_block *sb);
static struct inode *qnx4_alloc_inode(struct super_block *sb);
static void qnx4_destroy_inode(struct inode *inode);
......@@ -337,8 +336,7 @@ static const char *qnx4_checkroot(struct super_block *sb)
return NULL;
}
static struct super_block *qnx4_read_super(struct super_block *s,
void *data, int silent)
static int qnx4_fill_super(struct super_block *s, void *data, int silent)
{
struct buffer_head *bh;
struct inode *root;
......@@ -396,7 +394,7 @@ static struct super_block *qnx4_read_super(struct super_block *s,
brelse(bh);
return s;
return 0;
outi:
iput(root);
......@@ -404,7 +402,7 @@ static struct super_block *qnx4_read_super(struct super_block *s,
brelse(bh);
outnobh:
return NULL;
return -EINVAL;
}
static void qnx4_put_super(struct super_block *sb)
......@@ -541,7 +539,18 @@ static void destroy_inodecache(void)
"qnx4_inode_cache: not all structures were freed\n");
}
static DECLARE_FSTYPE_DEV(qnx4_fs_type, "qnx4", qnx4_read_super);
static struct super_block *qnx4_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super);
}
static struct file_system_type qnx4_fs_type = {
owner: THIS_MODULE,
name: "qnx4",
get_sb: qnx4_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_qnx4_fs(void)
{
......
......@@ -965,7 +965,7 @@ int function2code (hashf_t func)
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static struct super_block * reiserfs_read_super (struct super_block * s, void * data, int silent)
static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
{
int size;
struct inode *root_inode;
......@@ -981,12 +981,12 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
memset (&s->u.reiserfs_sb, 0, sizeof (struct reiserfs_sb_info));
jdev_name = NULL;
if (parse_options ((char *) data, &(s->u.reiserfs_sb.s_mount_opt), &blocks, &jdev_name) == 0) {
return NULL;
return -EINVAL;
}
if (blocks) {
printk("reserfs: resize option for remount only\n");
return NULL;
return -EINVAL;
}
size = block_size(s->s_dev);
......@@ -997,14 +997,14 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
old_format = 1;
/* try new format (64-th 1k block), which can contain reiserfs super block */
else if (read_super_block (s, REISERFS_DISK_OFFSET_IN_BYTES)) {
printk("sh-2021: reiserfs_read_super: can not find reiserfs on %s\n", s->s_id);
printk("sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", s->s_id);
goto error;
}
s->u.reiserfs_sb.s_mount_state = SB_REISERFS_STATE(s);
s->u.reiserfs_sb.s_mount_state = REISERFS_VALID_FS ;
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
printk ("reiserfs_read_super: unable to read bitmap\n");
printk ("reiserfs_fill_super: unable to read bitmap\n");
goto error;
}
#ifdef CONFIG_REISERFS_CHECK
......@@ -1014,7 +1014,7 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
// set_device_ro(s->s_dev, 1) ;
if( journal_init(s, jdev_name, old_format) ) {
printk("sh-2022: reiserfs_read_super: unable to initialize journal space\n") ;
printk("sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
goto error ;
} else {
jinit_done = 1 ; /* once this is set, journal_release must be called
......@@ -1022,7 +1022,7 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
*/
}
if (reread_meta_blocks(s)) {
printk("reiserfs_read_super: unable to reread meta blocks after journal init\n") ;
printk("reiserfs_fill_super: unable to reread meta blocks after journal init\n") ;
goto error ;
}
......@@ -1036,7 +1036,7 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
args.objectid = REISERFS_ROOT_PARENT_OBJECTID ;
root_inode = iget4 (s, REISERFS_ROOT_OBJECTID, 0, (void *)(&args));
if (!root_inode) {
printk ("reiserfs_read_super: get root inode failed\n");
printk ("reiserfs_fill_super: get root inode failed\n");
goto error;
}
......@@ -1115,7 +1115,7 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
reiserfs_proc_register( s, "journal", reiserfs_journal_in_proc );
init_waitqueue_head (&(s->u.reiserfs_sb.s_wait));
return s;
return 0;
error:
if (jinit_done) { /* kill the commit thread, free journal ram */
......@@ -1132,7 +1132,7 @@ static struct super_block * reiserfs_read_super (struct super_block * s, void *
if (SB_BUFFER_WITH_SB (s))
brelse(SB_BUFFER_WITH_SB (s));
return NULL;
return -EINVAL;
}
......@@ -1159,7 +1159,18 @@ static int reiserfs_statfs (struct super_block * s, struct statfs * buf)
return 0;
}
static DECLARE_FSTYPE_DEV(reiserfs_fs_type,"reiserfs",reiserfs_read_super);
static struct super_block *reiserfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super);
}
static struct file_system_type reiserfs_fs_type = {
owner: THIS_MODULE,
name: "reiserfs",
get_sb: reiserfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
//
// this is exactly what 2.3.99-pre9's init_ext2_fs is
......
......@@ -92,8 +92,7 @@ romfs_checksum(void *data, int size)
static struct super_operations romfs_ops;
static struct super_block *
romfs_read_super(struct super_block *s, void *data, int silent)
static int romfs_fill_super(struct super_block *s, void *data, int silent)
{
struct buffer_head *bh;
struct romfs_super_block *rsb;
......@@ -150,10 +149,10 @@ romfs_read_super(struct super_block *s, void *data, int silent)
out:
brelse(bh);
outnobh:
s = NULL;
return -EINVAL;
}
return s;
return 0;
}
/* That's simple too. */
......@@ -529,7 +528,18 @@ static struct super_operations romfs_ops = {
statfs: romfs_statfs,
};
static DECLARE_FSTYPE_DEV(romfs_fs_type, "romfs", romfs_read_super);
static struct super_block *romfs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, romfs_fill_super);
}
static struct file_system_type romfs_fs_type = {
owner: THIS_MODULE,
name: "romfs",
get_sb: romfs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_romfs_fs(void)
{
......
......@@ -597,11 +597,8 @@ static void put_anon_dev(kdev_t dev)
*
* Rather than duplicating all that logics every time when
* we want something that doesn't fit "nodev" and "single" we pull
* the relevant code into common helper and let get_sb_...() call
* the relevant code into common helper and let ->get_sb() call
* it.
*
* NB: get_sb_...() is going to become an fs type method, with
* current ->read_super() becoming a callback used by common instances.
*/
struct super_block *get_anon_super(struct file_system_type *type,
int (*compare)(struct super_block *,void *), void *data)
......@@ -787,17 +784,6 @@ struct super_block *get_sb_single(struct file_system_type *fs_type,
return s;
}
/* Will go away */
static int fill_super(struct super_block *sb, void *data, int verbose)
{
return sb->s_type->read_super(sb, data, verbose) ? 0 : -EINVAL;
}
static struct super_block *__get_sb_bdev(struct file_system_type *fs_type,
int flags, char *dev_name, void * data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, fill_super);
}
struct vfsmount *
do_kern_mount(const char *fstype, int flags, char *name, void *data)
{
......@@ -811,10 +797,7 @@ do_kern_mount(const char *fstype, int flags, char *name, void *data)
mnt = alloc_vfsmnt(name);
if (!mnt)
goto out;
if (type->get_sb)
sb = type->get_sb(type, flags, name, data);
else if (type->fs_flags & FS_REQUIRES_DEV)
sb = __get_sb_bdev(type, flags, name, data);
sb = type->get_sb(type, flags, name, data);
if (IS_ERR(sb))
goto out_mnt;
if (type->fs_flags & FS_NOMOUNT)
......
......@@ -76,7 +76,7 @@
static char error_buf[1024];
/* These are the "meat" - everything else is stuffing */
static struct super_block *udf_read_super(struct super_block *, void *, int);
static int udf_fill_super(struct super_block *, void *, int);
static void udf_put_super(struct super_block *);
static void udf_write_super(struct super_block *);
static int udf_remount_fs(struct super_block *, int *, char *);
......@@ -96,7 +96,18 @@ static unsigned int udf_count_free(struct super_block *);
static int udf_statfs(struct super_block *, struct statfs *);
/* UDF filesystem type */
static DECLARE_FSTYPE_DEV(udf_fstype, "udf", udf_read_super);
static struct super_block *udf_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super);
}
static struct file_system_type udf_fstype = {
owner: THIS_MODULE,
name: "udf",
get_sb: udf_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static kmem_cache_t * udf_inode_cachep;
......@@ -1387,8 +1398,7 @@ static void udf_close_lvid(struct super_block *sb)
* July 1, 1997 - Andrew E. Mileski
* Written, tested, and released.
*/
static struct super_block *
udf_read_super(struct super_block *sb, void *options, int silent)
static int udf_fill_super(struct super_block *sb, void *options, int silent)
{
int i;
struct inode *inode=NULL;
......@@ -1545,7 +1555,7 @@ udf_read_super(struct super_block *sb, void *options, int silent)
goto error_out;
}
sb->s_maxbytes = MAX_LFS_FILESIZE;
return sb;
return 0;
error_out:
if (UDF_SB_VAT(sb))
......@@ -1588,7 +1598,7 @@ udf_read_super(struct super_block *sb, void *options, int silent)
udf_close_lvid(sb);
udf_release_data(UDF_SB_LVIDBH(sb));
UDF_SB_FREE(sb);
return NULL;
return -EINVAL;
}
void udf_error(struct super_block *sb, const char *function,
......
......@@ -434,8 +434,7 @@ void ufs_put_cylinder_structures (struct super_block * sb) {
UFSD(("EXIT\n"))
}
struct super_block * ufs_read_super (struct super_block * sb, void * data,
int silent)
static int ufs_fill_super(struct super_block *sb, void *data, int silent)
{
struct ufs_sb_private_info * uspi;
struct ufs_super_block_first * usb1;
......@@ -807,7 +806,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
goto failed;
UFSD(("EXIT\n"))
return(sb);
return 0;
dalloc_failed:
iput(inode);
......@@ -815,7 +814,7 @@ struct super_block * ufs_read_super (struct super_block * sb, void * data,
if (ubh) ubh_brelse_uspi (uspi);
if (uspi) kfree (uspi);
UFSD(("EXIT (FAILED)\n"))
return(NULL);
return -EINVAL;
}
void ufs_write_super (struct super_block * sb) {
......@@ -1009,7 +1008,18 @@ static struct super_operations ufs_super_ops = {
remount_fs: ufs_remount,
};
static DECLARE_FSTYPE_DEV(ufs_fs_type, "ufs", ufs_read_super);
static struct super_block *ufs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super);
}
static struct file_system_type ufs_fs_type = {
owner: THIS_MODULE,
name: "ufs",
get_sb: ufs_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
static int __init init_ufs_fs(void)
{
......
......@@ -1254,20 +1254,19 @@ struct inode_operations vfat_dir_inode_operations = {
setattr: fat_notify_change,
};
struct super_block *vfat_read_super(struct super_block *sb,void *data,
int silent)
int vfat_fill_super(struct super_block *sb, void *data, int silent)
{
struct super_block *res;
MSDOS_SB(sb)->options.isvfat = 1;
res = fat_read_super(sb, data, silent, &vfat_dir_inode_operations);
if (IS_ERR(res))
return NULL;
return PTR_ERR(res);
if (res == NULL) {
if (!silent)
printk(KERN_INFO "VFS: Can't find a valid"
" VFAT filesystem on dev %s.\n", sb->s_id);
return NULL;
return -EINVAL;
}
if (parse_options((char *) data, &(MSDOS_SB(sb)->options))) {
......@@ -1281,6 +1280,5 @@ struct super_block *vfat_read_super(struct super_block *sb,void *data,
sb->s_root->d_op = &vfat_dentry_ops[2];
}
}
return res;
return 0;
}
......@@ -11,14 +11,24 @@
#include <linux/mm.h>
#include <linux/msdos_fs.h>
DECLARE_FSTYPE_DEV(vfat_fs_type, "vfat", vfat_read_super);
static struct super_block *vfat_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super);
}
static struct file_system_type vfat_fs_type = {
owner: THIS_MODULE,
name: "vfat",
get_sb: vfat_get_sb,
fs_flags: FS_REQUIRES_DEV,
};
EXPORT_SYMBOL(vfat_create);
EXPORT_SYMBOL(vfat_unlink);
EXPORT_SYMBOL(vfat_mkdir);
EXPORT_SYMBOL(vfat_rmdir);
EXPORT_SYMBOL(vfat_rename);
EXPORT_SYMBOL(vfat_read_super);
EXPORT_SYMBOL(vfat_lookup);
static int __init init_vfat_fs(void)
......
......@@ -47,7 +47,7 @@ extern struct inode_operations efs_dir_inode_operations;
extern struct file_operations efs_dir_operations;
extern struct address_space_operations efs_symlink_aops;
extern struct super_block *efs_read_super(struct super_block *, void *, int);
extern int efs_fill_super(struct super_block *, void *, int);
extern int efs_statfs(struct super_block *, struct statfs *);
extern void efs_read_inode(struct inode *);
......
......@@ -671,7 +671,6 @@ extern void ext3_write_super (struct super_block *);
extern void ext3_write_super_lockfs (struct super_block *);
extern void ext3_unlockfs (struct super_block *);
extern int ext3_remount (struct super_block *, int *, char *);
extern struct super_block * ext3_read_super (struct super_block *,void *,int);
extern int ext3_statfs (struct super_block *, struct statfs *);
#define ext3_std_error(sb, errno) \
......
......@@ -934,21 +934,10 @@ struct dquot_operations {
int (*transfer) (struct inode *, struct iattr *);
};
/*
* NOTE NOTE NOTE
*
* ->read_super() is going to die. New method (->get_sb) should replace
* it. The only reason why ->read_super() is left for _SHORT_ transition
* period is to avoid a single patch touching every fs. They will be
* converted one-by-one and ONCE THAT IS DONE OR TWO WEEKS HAD PASSED
* (whatever sooner) ->read_super() WILL DISAPPEAR.
*/
struct file_system_type {
const char *name;
int fs_flags;
struct super_block *(*get_sb) (struct file_system_type *, int, char *, void *);
struct super_block *(*read_super) (struct super_block *, void *, int);
struct module *owner;
struct file_system_type * next;
struct list_head fs_supers;
......@@ -964,14 +953,6 @@ struct super_block *get_sb_nodev(struct file_system_type *fs_type,
int flags, void *data,
int (*fill_super)(struct super_block *, void *, int));
#define DECLARE_FSTYPE_DEV(var,type,read) \
struct file_system_type var = { \
name: type, \
read_super: read, \
fs_flags: FS_REQUIRES_DEV, \
owner: THIS_MODULE, \
}
/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
#define fops_get(fops) \
(((fops) && (fops)->owner) \
......
......@@ -301,7 +301,7 @@ extern void hfs_nat_ifill(struct inode *, ino_t, const int);
extern void hfs_sngl_ifill(struct inode *, ino_t, const int);
/* super.c */
extern struct super_block *hfs_read_super(struct super_block *,void *,int);
extern int hfs_fill_super(struct super_block *,void *,int);
/* trans.c */
extern void hfs_colon2mac(struct hfs_name *, const char *, int);
......
......@@ -330,8 +330,7 @@ extern int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode);
extern int msdos_unlink(struct inode *dir, struct dentry *dentry);
extern int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry);
extern struct super_block *msdos_read_super(struct super_block *sb,
void *data, int silent);
extern int msdos_fill_super(struct super_block *sb, void *data, int silent);
/* vfat/namei.c - these are for dmsdos */
extern struct dentry *vfat_lookup(struct inode *dir, struct dentry *);
......@@ -341,8 +340,7 @@ extern int vfat_unlink(struct inode *dir, struct dentry *dentry);
extern int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode);
extern int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry);
extern struct super_block *vfat_read_super(struct super_block *sb, void *data,
int silent);
extern int vfat_fill_super(struct super_block *sb, void *data, int silent);
/* vfat/vfatfs_syms.c */
extern struct file_system_type vfat_fs_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment