diff options
author | 2008-11-23 23:52:35 +0000 | |
---|---|---|
committer | 2008-11-23 23:52:35 +0000 | |
commit | 25e19cd89054e4ff3a468b1ffc680916a9531bc2 (patch) | |
tree | 23db4d93f7acdff0fa825dfaa6a0444f60222bff /sys | |
parent | softraid support for ata over ethernet (aoe). this includes a client and (diff) | |
download | wireguard-openbsd-25e19cd89054e4ff3a468b1ffc680916a9531bc2.tar.xz wireguard-openbsd-25e19cd89054e4ff3a468b1ffc680916a9531bc2.zip |
fancy new ext2fs can have big inodes. we can possibly still read them
though if no new features are in play. diff from Wouter Godefroy
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_dinode.h | 4 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_inode.c | 4 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_vfsops.c | 24 |
3 files changed, 18 insertions, 14 deletions
diff --git a/sys/ufs/ext2fs/ext2fs_dinode.h b/sys/ufs/ext2fs/ext2fs_dinode.h index 7d9e9def84f..1e823b62cd9 100644 --- a/sys/ufs/ext2fs/ext2fs_dinode.h +++ b/sys/ufs/ext2fs/ext2fs_dinode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_dinode.h,v 1.10 2005/10/06 17:51:27 pedro Exp $ */ +/* $OpenBSD: ext2fs_dinode.h,v 1.11 2008/11/23 23:52:35 tedu Exp $ */ /* $NetBSD: ext2fs_dinode.h,v 1.6 2000/01/26 16:21:33 bouyer Exp $ */ /* @@ -118,7 +118,7 @@ struct ext2fs_dinode { #define EXT2_NODUMP 0x00000040 /* do not dump file */ /* Size of on-disk inode. */ -#define EXT2_DINODE_SIZE (sizeof(struct ext2fs_dinode)) /* 128 */ +#define EXT2_DINODE_SIZE(s) (s)->e2fs.e2fs_inode_size /* * The e2di_blocks fields may be overlaid with other information for diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index 62a0f438814..5a90e6eafcc 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_inode.c,v 1.42 2008/06/12 06:58:40 deraadt Exp $ */ +/* $OpenBSD: ext2fs_inode.c,v 1.43 2008/11/23 23:52:35 tedu Exp $ */ /* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */ /* @@ -187,7 +187,7 @@ ext2fs_update(struct inode *ip, struct timespec *atime, struct timespec *mtime, } ip->i_flag &= ~(IN_MODIFIED); cp = (caddr_t)bp->b_data + - (ino_to_fsbo(fs, ip->i_number) * EXT2_DINODE_SIZE); + (ino_to_fsbo(fs, ip->i_number) * EXT2_DINODE_SIZE(fs)); /* * See note about 16-bit UID/GID limitation in ext2fs_vget(). Now diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 5b5e6bc046c..050d4903271 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.50 2008/09/12 12:27:27 blambert Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.51 2008/11/23 23:52:35 tedu Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -363,7 +363,7 @@ ext2fs_reload_vnode(struct vnode *vp, void *args) return (error); } cp = (caddr_t)bp->b_data + - (ino_to_fsbo(era->fs, ip->i_number) * EXT2_DINODE_SIZE); + (ino_to_fsbo(era->fs, ip->i_number) * EXT2_DINODE_SIZE(era->fs)); e2fs_iload((struct ext2fs_dinode *)cp, ip->i_e2din); brelse(bp); vput(vp); @@ -438,7 +438,7 @@ ext2fs_reload(struct mount *mountp, struct ucred *cred, struct proc *p) fs->e2fs_bmask = ~fs->e2fs_qbmask; fs->e2fs_ngdb = howmany(fs->e2fs_ncg, fs->e2fs_bsize / sizeof(struct ext2_gd)); - fs->e2fs_ipb = fs->e2fs_bsize / EXT2_DINODE_SIZE; + fs->e2fs_ipb = fs->e2fs_bsize / EXT2_DINODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs.e2fs_ipg/fs->e2fs_ipb; /* @@ -512,8 +512,7 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) ump = NULL; #ifdef DEBUG_EXT2 - printf("sb size: %d ino size %d\n", sizeof(struct ext2fs), - EXT2_DINODE_SIZE); + printf("ext2 sb size: %d\n", sizeof(struct ext2fs)); #endif error = bread(devvp, (SBOFF / DEV_BSIZE), SBSIZE, cred, &bp); if (error) @@ -531,6 +530,10 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) m_fs = ump->um_e2fs; m_fs->e2fs_ronly = ronly; ump->um_fstype = UM_EXT2FS; + +#ifdef DEBUG_EXT2 + printf("ext2 ino size %d\n", EXT2_DINODE_SIZE(m_fs)); +#endif if (ronly == 0) { if (m_fs->e2fs.e2fs_state == E2FS_ISCLEAN) m_fs->e2fs.e2fs_state = 0; @@ -551,7 +554,7 @@ ext2fs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) m_fs->e2fs_bmask = ~m_fs->e2fs_qbmask; m_fs->e2fs_ngdb = howmany(m_fs->e2fs_ncg, m_fs->e2fs_bsize / sizeof(struct ext2_gd)); - m_fs->e2fs_ipb = m_fs->e2fs_bsize / EXT2_DINODE_SIZE; + m_fs->e2fs_ipb = m_fs->e2fs_bsize / EXT2_DINODE_SIZE(m_fs); m_fs->e2fs_itpg = m_fs->e2fs.e2fs_ipg/m_fs->e2fs_ipb; m_fs->e2fs_gd = malloc(m_fs->e2fs_ngdb * m_fs->e2fs_bsize, @@ -872,7 +875,9 @@ ext2fs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) return (error); } - dp = (struct ext2fs_dinode *) bp->b_data + ino_to_fsbo(fs, ino); + dp = (struct ext2fs_dinode *) ((char *)bp->b_data + + EXT2_DINODE_SIZE(fs) * ino_to_fsbo(fs, ino)); + ip->i_e2din = pool_get(&ext2fs_dinode_pool, PR_WAITOK); e2fs_iload(dp, ip->i_e2din); brelse(bp); @@ -1059,9 +1064,8 @@ ext2fs_checksb(struct ext2fs *fs, int ronly) return (EIO); /* XXX needs translation */ } if (fs2h32(fs->e2fs_rev) > E2FS_REV0) { - if (fs2h32(fs->e2fs_first_ino) != EXT2_FIRSTINO || - fs2h16(fs->e2fs_inode_size) != EXT2_DINODE_SIZE) { - printf("Ext2 fs: unsupported inode size\n"); + if (fs2h32(fs->e2fs_first_ino) != EXT2_FIRSTINO) { + printf("Ext2 fs: unsupported first inode position"); return (EINVAL); /* XXX needs translation */ } if (fs2h32(fs->e2fs_features_incompat) & |