summaryrefslogtreecommitdiffstats
path: root/fs/minix/inode.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
commitc7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch)
tree3682407a599b8f9f03fc096298134cafba1c9b2f /fs/minix/inode.c
parent1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff)
o Merge with Linux 2.1.116.
o New Newport console code. o New G364 console code.
Diffstat (limited to 'fs/minix/inode.c')
-rw-r--r--fs/minix/inode.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 8934dc012..46ae5c11c 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -63,9 +63,9 @@ void minix_put_super(struct super_block *sb)
sb->u.minix_sb.s_ms->s_state = sb->u.minix_sb.s_mount_state;
mark_buffer_dirty(sb->u.minix_sb.s_sbh, 1);
}
- for(i = 0 ; i < MINIX_I_MAP_SLOTS ; i++)
+ for (i = 0; i < sb->u.minix_sb.s_imap_blocks; i++)
brelse(sb->u.minix_sb.s_imap[i]);
- for(i = 0 ; i < MINIX_Z_MAP_SLOTS ; i++)
+ for (i = 0; i < sb->u.minix_sb.s_zmap_blocks; i++)
brelse(sb->u.minix_sb.s_zmap[i]);
brelse (sb->u.minix_sb.s_sbh);
kfree(sb->u.minix_sb.s_imap);
@@ -122,7 +122,7 @@ int minix_remount (struct super_block * sb, int * flags, char * data)
/*
* Check the root directory of the filesystem to make sure
- * it really _is_ a minix filesystem, and to check the size
+ * it really _is_ a Minix filesystem, and to check the size
* of the directory entry.
*/
static const char * minix_checkroot(struct super_block *s, struct inode *dir)
@@ -173,7 +173,8 @@ struct super_block *minix_read_super(struct super_block *s, void *data,
const char * errmsg;
struct inode *root_inode;
- /* N.B. These should be compile-time tests */
+ /* N.B. These should be compile-time tests.
+ Unfortunately that is impossible. */
if (32 != sizeof (struct minix_inode))
panic("bad V1 i-node size");
if (64 != sizeof(struct minix2_inode))
@@ -203,33 +204,37 @@ struct super_block *minix_read_super(struct super_block *s, void *data,
s->u.minix_sb.s_version = MINIX_V1;
s->u.minix_sb.s_dirsize = 16;
s->u.minix_sb.s_namelen = 14;
+ s->u.minix_sb.s_link_max = MINIX_LINK_MAX;
} else if (s->s_magic == MINIX_SUPER_MAGIC2) {
s->u.minix_sb.s_version = MINIX_V1;
s->u.minix_sb.s_dirsize = 32;
s->u.minix_sb.s_namelen = 30;
+ s->u.minix_sb.s_link_max = MINIX_LINK_MAX;
} else if (s->s_magic == MINIX2_SUPER_MAGIC) {
s->u.minix_sb.s_version = MINIX_V2;
+ s->u.minix_sb.s_nzones = ms->s_zones;
s->u.minix_sb.s_dirsize = 16;
s->u.minix_sb.s_namelen = 14;
+ s->u.minix_sb.s_link_max = MINIX2_LINK_MAX;
} else if (s->s_magic == MINIX2_SUPER_MAGIC2) {
s->u.minix_sb.s_version = MINIX_V2;
+ s->u.minix_sb.s_nzones = ms->s_zones;
s->u.minix_sb.s_dirsize = 32;
s->u.minix_sb.s_namelen = 30;
+ s->u.minix_sb.s_link_max = MINIX2_LINK_MAX;
} else
goto out_no_fs;
- if (s->u.minix_sb.s_zmap_blocks > MINIX_Z_MAP_SLOTS)
- goto out_too_big;
/*
* Allocate the buffer map to keep the superblock small.
*/
- i = (MINIX_I_MAP_SLOTS + MINIX_Z_MAP_SLOTS) * sizeof(bh);
+ i = (s->u.minix_sb.s_imap_blocks + s->u.minix_sb.s_zmap_blocks) * sizeof(bh);
map = kmalloc(i, GFP_KERNEL);
if (!map)
goto out_no_map;
memset(map, 0, i);
s->u.minix_sb.s_imap = &map[0];
- s->u.minix_sb.s_zmap = &map[MINIX_I_MAP_SLOTS];
+ s->u.minix_sb.s_zmap = &map[s->u.minix_sb.s_imap_blocks];
block=2;
for (i=0 ; i < s->u.minix_sb.s_imap_blocks ; i++) {
@@ -242,8 +247,6 @@ struct super_block *minix_read_super(struct super_block *s, void *data,
goto out_no_bitmap;
block++;
}
- if (block != 2+s->u.minix_sb.s_imap_blocks+s->u.minix_sb.s_zmap_blocks)
- goto out_no_bitmap;
minix_set_bit(0,s->u.minix_sb.s_imap[0]->b_data);
minix_set_bit(0,s->u.minix_sb.s_zmap[0]->b_data);
@@ -263,6 +266,8 @@ struct super_block *minix_read_super(struct super_block *s, void *data,
if (!s->s_root)
goto out_iput;
+ s->s_root->d_op = &minix_dentry_operations;
+
if (!(s->s_flags & MS_RDONLY)) {
ms->s_state &= ~MINIX_VALID_FS;
mark_buffer_dirty(bh, 1);
@@ -292,9 +297,9 @@ out_no_root:
out_no_bitmap:
printk("MINIX-fs: bad superblock or unable to read bitmaps\n");
out_freemap:
- for(i=0;i<MINIX_I_MAP_SLOTS;i++)
+ for (i = 0; i < s->u.minix_sb.s_imap_blocks; i++)
brelse(s->u.minix_sb.s_imap[i]);
- for(i=0;i<MINIX_Z_MAP_SLOTS;i++)
+ for (i = 0; i < s->u.minix_sb.s_zmap_blocks; i++)
brelse(s->u.minix_sb.s_zmap[i]);
kfree(s->u.minix_sb.s_imap);
goto out_release;
@@ -304,14 +309,9 @@ out_no_map:
printk ("MINIX-fs: can't allocate map\n");
goto out_release;
-out_too_big:
- if (!silent)
- printk ("MINIX-fs: filesystem too big\n");
- goto out_release;
-
out_no_fs:
if (!silent)
- printk("VFS: Can't find a minix or minix V2 filesystem on dev "
+ printk("VFS: Can't find a Minix or Minix V2 filesystem on device "
"%s.\n", kdevname(dev));
out_release:
brelse(bh);
@@ -729,7 +729,7 @@ static void V1_minix_read_inode(struct inode * inode)
ino = inode->i_ino;
inode->i_op = NULL;
inode->i_mode = 0;
- if (!ino || ino >= inode->i_sb->u.minix_sb.s_ninodes) {
+ if (!ino || ino > inode->i_sb->u.minix_sb.s_ninodes) {
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
@@ -783,7 +783,7 @@ static void V2_minix_read_inode(struct inode * inode)
ino = inode->i_ino;
inode->i_op = NULL;
inode->i_mode = 0;
- if (!ino || ino >= inode->i_sb->u.minix_sb.s_ninodes) {
+ if (!ino || ino > inode->i_sb->u.minix_sb.s_ninodes) {
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
@@ -848,7 +848,7 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
int ino, block;
ino = inode->i_ino;
- if (!ino || ino >= inode->i_sb->u.minix_sb.s_ninodes) {
+ if (!ino || ino > inode->i_sb->u.minix_sb.s_ninodes) {
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
@@ -886,7 +886,7 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
int ino, block;
ino = inode->i_ino;
- if (!ino || ino >= inode->i_sb->u.minix_sb.s_ninodes) {
+ if (!ino || ino > inode->i_sb->u.minix_sb.s_ninodes) {
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);