diff -urN linux/fs/minix/inode.c linux2/fs/minix/inode.c
--- linux/fs/minix/inode.c Thu Mar 7 09:39:46 2002
+++ linux2/fs/minix/inode.c Thu Mar 7 10:12:22 2002
@@ -70,6 +70,8 @@
brelse(sbi->s_zmap[i]);
brelse (sbi->s_sbh);
kfree(sbi->s_imap);
+ sb->u.generic_sbp = NULL;
+ kfree(sbi);
return;
}
@@ -170,7 +172,12 @@
struct minix_super_block *ms;
int i, block;
struct inode *root_inode;
- struct minix_sb_info *sbi = minix_sb(s);
+ struct minix_sb_info *sbi;
+
+ sbi = kmalloc(sizeof(struct minix_sb_info), GFP_KERNEL);
+ if (!sbi)
+ return -ENOMEM;
+ s->u.generic_sbp = sbi;
/* N.B. These should be compile-time tests.
Unfortunately that is impossible. */
@@ -313,6 +320,8 @@
out_bad_sb:
printk("MINIX-fs: unable to read superblock\n");
out:
+ s->u.generic_sbp = NULL;
+ kfree(sbi);
return -EINVAL;
}
diff -urN linux/include/linux/fs.h linux2/include/linux/fs.h
--- linux/include/linux/fs.h Thu Mar 7 09:55:00 2002
+++ linux2/include/linux/fs.h Thu Mar 7 10:11:08 2002
@@ -650,7 +650,6 @@
#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
#define MNT_DETACH 0x00000002 /* Just detach from the tree */
-#include <linux/minix_fs_sb.h>
#include <linux/ext2_fs_sb.h>
#include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h>
@@ -708,7 +707,6 @@
char s_id[32]; /* Informational name */
union {
- struct minix_sb_info minix_sb;
struct ext2_sb_info ext2_sb;
struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb;
diff -urN linux/include/linux/minix_fs.h linux2/include/linux/minix_fs.h
--- linux/include/linux/minix_fs.h Thu Mar 7 09:54:58 2002
+++ linux2/include/linux/minix_fs.h Thu Mar 7 09:58:42 2002
@@ -134,7 +134,7 @@
static inline struct minix_sb_info *minix_sb(struct super_block *sb)
{
- return &sb->u.minix_sb;
+ return sb->u.generic_sbp;
}
static inline struct minix_inode_info *minix_i(struct inode *inode)
On March 11, 2002 11:59 pm, Brian Gerst wrote:
> These two patches are the start of cleaning up the union of
> filesystem-specific structures in struct super_block. The goal is to
> remove dependence on filesystem headers in fs.h. The first patch
> abstracts the access to the minix_sb_info structure through the function
> minix_sb(). The second patch switches to using kmalloc to allocate the
> structure.
Nice to see it happening, even if it got there by a twisty path ;-)
--
Daniel