Commit 93f7c8dc authored by Christoph Hellwig's avatar Christoph Hellwig

Make sysvfs use sb->u.generic_sbp.

parent d8f94035
...@@ -69,6 +69,8 @@ static void sysv_put_super(struct super_block *sb) ...@@ -69,6 +69,8 @@ static void sysv_put_super(struct super_block *sb)
brelse(sbi->s_bh1); brelse(sbi->s_bh1);
if (sbi->s_bh1 != sbi->s_bh2) if (sbi->s_bh1 != sbi->s_bh2)
brelse(sbi->s_bh2); brelse(sbi->s_bh2);
kfree(sbi);
} }
static int sysv_statfs(struct super_block *sb, struct statfs *buf) static int sysv_statfs(struct super_block *sb, struct statfs *buf)
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/sysv_fs.h> #include <linux/sysv_fs.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/slab.h>
/* /*
* The following functions try to recognize specific filesystems. * The following functions try to recognize specific filesystems.
...@@ -344,26 +345,32 @@ static int complete_read_super(struct super_block *sb, int silent, int size) ...@@ -344,26 +345,32 @@ static int complete_read_super(struct super_block *sb, int silent, int size)
static int sysv_fill_super(struct super_block *sb, void *data, int silent) static int sysv_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct sysv_sb_info *sbi = SYSV_SB(sb); struct buffer_head *bh1, *bh = NULL;
struct buffer_head *bh1; struct sysv_sb_info *sbi;
struct buffer_head *bh = NULL;
unsigned long blocknr; unsigned long blocknr;
int size = 0; int size = 0, i;
int i;
if (1024 != sizeof (struct xenix_super_block)) if (1024 != sizeof (struct xenix_super_block))
panic("Xenix FS: bad super-block size"); panic("Xenix FS: bad superblock size");
if ((512 != sizeof (struct sysv4_super_block)) if (512 != sizeof (struct sysv4_super_block))
|| (512 != sizeof (struct sysv2_super_block))) panic("SystemV FS: bad superblock size");
panic("SystemV FS: bad super-block size"); if (512 != sizeof (struct sysv2_super_block))
panic("SystemV FS: bad superblock size");
if (500 != sizeof (struct coh_super_block)) if (500 != sizeof (struct coh_super_block))
panic("Coherent FS: bad super-block size"); panic("Coherent FS: bad superblock size");
if (64 != sizeof (struct sysv_inode)) if (64 != sizeof (struct sysv_inode))
panic("sysv fs: bad i-node size"); panic("sysv fs: bad inode size");
sb_set_blocksize(sb, BLOCK_SIZE);
sbi = kmalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
if (!sbi)
return -ENOMEM;
memset(sbi, 0, sizeof(struct sysv_sb_info));
sbi->s_sb = sb; sbi->s_sb = sb;
sbi->s_block_base = 0; sbi->s_block_base = 0;
sb->u.generic_sbp = sbi;
sb_set_blocksize(sb, BLOCK_SIZE);
for (i = 0; i < sizeof(flavours)/sizeof(flavours[0]) && !size; i++) { for (i = 0; i < sizeof(flavours)/sizeof(flavours[0]) && !size; i++) {
brelse(bh); brelse(bh);
...@@ -409,6 +416,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) ...@@ -409,6 +416,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
sb_set_blocksize(sb, BLOCK_SIZE); sb_set_blocksize(sb, BLOCK_SIZE);
printk("oldfs: cannot read superblock\n"); printk("oldfs: cannot read superblock\n");
failed: failed:
kfree(sbi);
return -EINVAL; return -EINVAL;
Eunknown: Eunknown:
...@@ -427,7 +435,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) ...@@ -427,7 +435,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
static int v7_fill_super(struct super_block *sb, void *data, int silent) static int v7_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct sysv_sb_info *sbi = SYSV_SB(sb); struct sysv_sb_info *sbi;
struct buffer_head *bh, *bh2 = NULL; struct buffer_head *bh, *bh2 = NULL;
struct v7_super_block *v7sb; struct v7_super_block *v7sb;
struct sysv_inode *v7i; struct sysv_inode *v7i;
...@@ -437,11 +445,18 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent) ...@@ -437,11 +445,18 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
if (64 != sizeof (struct sysv_inode)) if (64 != sizeof (struct sysv_inode))
panic("sysv fs: bad i-node size"); panic("sysv fs: bad i-node size");
sbi = kmalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
if (!sbi)
return -ENOMEM;
memset(sbi, 0, sizeof(struct sysv_sb_info));
sbi->s_sb = sb; sbi->s_sb = sb;
sbi->s_block_base = 0;
sbi->s_type = FSTYPE_V7; sbi->s_type = FSTYPE_V7;
sbi->s_bytesex = BYTESEX_PDP; sbi->s_bytesex = BYTESEX_PDP;
sb->u.generic_sbp = sbi;
sb_set_blocksize(sb, 512);
sb_set_blocksize(sb, BLOCK_SIZE);
if ((bh = sb_bread(sb, 1)) == NULL) { if ((bh = sb_bread(sb, 1)) == NULL) {
if (!silent) if (!silent)
...@@ -476,6 +491,7 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent) ...@@ -476,6 +491,7 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
failed: failed:
brelse(bh2); brelse(bh2);
brelse(bh); brelse(bh);
kfree(sbi);
return -EINVAL; return -EINVAL;
} }
......
...@@ -647,7 +647,6 @@ struct quota_mount_options ...@@ -647,7 +647,6 @@ struct quota_mount_options
#include <linux/ext3_fs_sb.h> #include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h> #include <linux/hpfs_fs_sb.h>
#include <linux/ntfs_fs_sb.h> #include <linux/ntfs_fs_sb.h>
#include <linux/sysv_fs_sb.h>
#include <linux/ufs_fs_sb.h> #include <linux/ufs_fs_sb.h>
#include <linux/romfs_fs_sb.h> #include <linux/romfs_fs_sb.h>
#include <linux/adfs_fs_sb.h> #include <linux/adfs_fs_sb.h>
...@@ -691,7 +690,6 @@ struct super_block { ...@@ -691,7 +690,6 @@ struct super_block {
struct ext3_sb_info ext3_sb; struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb; struct hpfs_sb_info hpfs_sb;
struct ntfs_sb_info ntfs_sb; struct ntfs_sb_info ntfs_sb;
struct sysv_sb_info sysv_sb;
struct ufs_sb_info ufs_sb; struct ufs_sb_info ufs_sb;
struct romfs_sb_info romfs_sb; struct romfs_sb_info romfs_sb;
struct adfs_sb_info adfs_sb; struct adfs_sb_info adfs_sb;
......
...@@ -30,7 +30,7 @@ static inline struct sysv_inode_info *SYSV_I(struct inode *inode) ...@@ -30,7 +30,7 @@ static inline struct sysv_inode_info *SYSV_I(struct inode *inode)
static inline struct sysv_sb_info *SYSV_SB(struct super_block *sb) static inline struct sysv_sb_info *SYSV_SB(struct super_block *sb)
{ {
return &sb->u.sysv_sb; return sb->u.generic_sbp;
} }
......
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