patch-2.1.45 linux/fs/minix/inode.c
Next file: linux/fs/minix/namei.c
Previous file: linux/fs/minix/file.c
Back to the patch index
Back to the overall index
- Lines: 135
- Date:
Wed Jul 16 08:07:44 1997
- Orig file:
v2.1.44/linux/fs/minix/inode.c
- Orig date:
Mon Jun 16 16:35:57 1997
diff -u --recursive --new-file v2.1.44/linux/fs/minix/inode.c linux/fs/minix/inode.c
@@ -125,15 +125,13 @@
* it really _is_ a minix filesystem, and to check the size
* of the directory entry.
*/
-static const char * minix_checkroot(struct super_block *s)
+static const char * minix_checkroot(struct super_block *s, struct inode *dir)
{
- struct inode * dir;
struct buffer_head *bh;
struct minix_dir_entry *de;
const char * errmsg;
int dirsize;
- dir = s->s_mounted;
if (!S_ISDIR(dir->i_mode))
return "root directory is not a directory";
@@ -172,7 +170,8 @@
int i, block;
kdev_t dev = s->s_dev;
const char * errmsg;
-
+ struct inode *root_inode;
+
if (32 != sizeof (struct minix_inode))
panic("bad V1 i-node size");
if (64 != sizeof(struct minix2_inode))
@@ -272,8 +271,9 @@
/* set up enough so that it can read an inode */
s->s_dev = dev;
s->s_op = &minix_sops;
- s->s_mounted = iget(s,MINIX_ROOT_INO);
- if (!s->s_mounted) {
+ root_inode = iget(s,MINIX_ROOT_INO);
+ s->s_root = d_alloc_root(root_inode, NULL);
+ if (!s->s_root) {
s->s_dev = 0;
brelse(bh);
if (!silent)
@@ -282,11 +282,11 @@
return NULL;
}
- errmsg = minix_checkroot(s);
+ errmsg = minix_checkroot(s, root_inode);
if (errmsg) {
if (!silent)
printk("MINIX-fs: %s\n", errmsg);
- iput (s->s_mounted);
+ d_delete(s->s_root); /* XXX Is this enough? */
s->s_dev = 0;
brelse (bh);
MOD_DEC_USE_COUNT;
@@ -307,7 +307,7 @@
return s;
}
-void minix_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
+int minix_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
{
struct statfs tmp;
@@ -319,7 +319,7 @@
tmp.f_files = sb->u.minix_sb.s_ninodes;
tmp.f_ffree = minix_count_free_inodes(sb);
tmp.f_namelen = sb->u.minix_sb.s_namelen;
- copy_to_user(buf, &tmp, bufsiz);
+ return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
}
/*
@@ -472,7 +472,7 @@
}
*p = tmp;
inode->i_ctime = CURRENT_TIME;
- inode->i_dirt = 1;
+ mark_inode_dirty(inode);
return result;
}
@@ -585,7 +585,7 @@
}
*p = tmp;
inode->i_ctime = CURRENT_TIME;
- inode->i_dirt = 1;
+ mark_inode_dirty(inode);
return result;
}
@@ -833,14 +833,12 @@
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
- inode->i_dirt = 0;
return 0;
}
block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
(ino-1)/MINIX_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE))) {
printk("unable to read i-node block\n");
- inode->i_dirt = 0;
return 0;
}
raw_inode = ((struct minix_inode *)bh->b_data) +
@@ -855,7 +853,6 @@
raw_inode->i_zone[0] = kdev_t_to_nr(inode->i_rdev);
else for (block = 0; block < 9; block++)
raw_inode->i_zone[block] = inode->u.minix_i.u.i1_data[block];
- inode->i_dirt=0;
mark_buffer_dirty(bh, 1);
return bh;
}
@@ -874,14 +871,12 @@
printk("Bad inode number on dev %s"
": %d is out of range\n",
kdevname(inode->i_dev), ino);
- inode->i_dirt = 0;
return 0;
}
block = 2 + inode->i_sb->u.minix_sb.s_imap_blocks + inode->i_sb->u.minix_sb.s_zmap_blocks +
(ino-1)/MINIX2_INODES_PER_BLOCK;
if (!(bh=bread(inode->i_dev, block, BLOCK_SIZE))) {
printk("unable to read i-node block\n");
- inode->i_dirt = 0;
return 0;
}
raw_inode = ((struct minix2_inode *)bh->b_data) +
@@ -898,7 +893,6 @@
raw_inode->i_zone[0] = kdev_t_to_nr(inode->i_rdev);
else for (block = 0; block < 10; block++)
raw_inode->i_zone[block] = inode->u.minix_i.u.i2_data[block];
- inode->i_dirt=0;
mark_buffer_dirty(bh, 1);
return bh;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov