summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/fs/ext2fs/ext2_fs.h4
-rw-r--r--sys/gnu/fs/ext2fs/ext2_fs_sb.h2
-rw-r--r--sys/gnu/fs/ext2fs/ext2_inode.c2
-rw-r--r--sys/gnu/fs/ext2fs/ext2_linux_ialloc.c4
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c10
5 files changed, 14 insertions, 8 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_fs.h b/sys/gnu/fs/ext2fs/ext2_fs.h
index 1b2f3c2..c1d6ffd 100644
--- a/sys/gnu/fs/ext2fs/ext2_fs.h
+++ b/sys/gnu/fs/ext2fs/ext2_fs.h
@@ -150,8 +150,8 @@
#else /* !notyet */
#define EXT2_INODES_PER_BLOCK(s) ((s)->s_inodes_per_block)
/* Should be sizeof(struct ext2_inode): */
-#define EXT2_INODE_SIZE 128
-#define EXT2_FIRST_INO 11
+#define EXT2_INODE_SIZE(s) ((s)->s_inode_size)
+#define EXT2_FIRST_INO(s) ((s)->s_first_inode)
#endif /* notyet */
/*
diff --git a/sys/gnu/fs/ext2fs/ext2_fs_sb.h b/sys/gnu/fs/ext2fs/ext2_fs_sb.h
index 89d829e..ae5c268 100644
--- a/sys/gnu/fs/ext2fs/ext2_fs_sb.h
+++ b/sys/gnu/fs/ext2fs/ext2_fs_sb.h
@@ -63,6 +63,8 @@ struct ext2_sb_info {
unsigned long s_db_per_group; /* Number of descriptor blocks per group */
unsigned long s_desc_per_block; /* Number of group descriptors per block */
unsigned long s_groups_count; /* Number of groups in the fs */
+ unsigned long s_first_inode; /* First inode on fs */
+ unsigned int s_inode_size; /* Size for inode with extra data */
struct buffer_head * s_sbh; /* Buffer containing the super block */
struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
struct buffer_head ** s_group_desc;
diff --git a/sys/gnu/fs/ext2fs/ext2_inode.c b/sys/gnu/fs/ext2fs/ext2_inode.c
index e0b79ba..0a62c30 100644
--- a/sys/gnu/fs/ext2fs/ext2_inode.c
+++ b/sys/gnu/fs/ext2fs/ext2_inode.c
@@ -91,7 +91,7 @@ ext2_update(vp, waitfor)
return (error);
}
ext2_i2ei(ip, (struct ext2_inode *)((char *)bp->b_data +
- EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)));
+ EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)));
if (waitfor && (vp->v_mount->mnt_kern_flag & MNTK_ASYNC) == 0)
return (bwrite(bp));
else {
diff --git a/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c b/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c
index d617014..b3263b4 100644
--- a/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c
+++ b/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c
@@ -225,7 +225,7 @@ void ext2_free_inode (struct inode * inode)
sb = inode->i_e2fs;
lock_super (DEVVP(inode));
- if (inode->i_number < EXT2_FIRST_INO ||
+ if (inode->i_number < EXT2_FIRST_INO(sb) ||
inode->i_number > sb->s_es->s_inodes_count) {
printf ("free_inode reserved inode or nonexistent inode");
unlock_super (DEVVP(inode));
@@ -435,7 +435,7 @@ repeat:
goto repeat;
}
j += i * EXT2_INODES_PER_GROUP(sb) + 1;
- if (j < EXT2_FIRST_INO || j > es->s_inodes_count) {
+ if (j < EXT2_FIRST_INO(sb) || j > es->s_inodes_count) {
printf ( "ext2_new_inode:"
"reserved inode or inode > inodes count - "
"block_group = %d,inode=%d", i, j);
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index c196fa9..6d81111 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -424,7 +424,11 @@ static int compute_sb_data(devvp, es, fs)
V(s_frags_per_group)
fs->s_inodes_per_group = es->s_inodes_per_group;
V(s_inodes_per_group)
- fs->s_inodes_per_block = fs->s_blocksize / EXT2_INODE_SIZE;
+ fs->s_inode_size = es->s_inode_size;
+ V(s_inode_size)
+ fs->s_first_inode = es->s_first_ino;
+ V(s_first_inode);
+ fs->s_inodes_per_block = fs->s_blocksize / EXT2_INODE_SIZE(fs);
V(s_inodes_per_block)
fs->s_itb_per_group = fs->s_inodes_per_group /fs->s_inodes_per_block;
V(s_itb_per_group)
@@ -578,7 +582,7 @@ loop:
return (error);
}
ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data +
- EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)), ip);
+ EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip);
brelse(bp);
VOP_UNLOCK(vp, 0);
vrele(vp);
@@ -1012,7 +1016,7 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino)));
return (error);
}
/* convert ext2 inode to dinode */
- ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE *
+ ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE(fs) *
ino_to_fsbo(fs, ino)), ip);
ip->i_block_group = ino_to_cg(fs, ino);
ip->i_next_alloc_block = 0;
OpenPOWER on IntegriCloud