diff options
Diffstat (limited to 'sbin/fsck_ext2fs')
-rw-r--r-- | sbin/fsck_ext2fs/inode.c | 17 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/pass2.c | 4 | ||||
-rw-r--r-- | sbin/fsck_ext2fs/setup.c | 4 |
3 files changed, 15 insertions, 10 deletions
diff --git a/sbin/fsck_ext2fs/inode.c b/sbin/fsck_ext2fs/inode.c index f3a78a8750d..1fa37e9a3cf 100644 --- a/sbin/fsck_ext2fs/inode.c +++ b/sbin/fsck_ext2fs/inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inode.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */ +/* $OpenBSD: inode.c,v 1.26 2016/04/28 12:17:15 krw Exp $ */ /* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */ /* @@ -358,7 +358,8 @@ getnextinode(ino_t inumber) { long size; daddr32_t dblk; - static struct ext2fs_dinode *dp; + struct ext2fs_dinode *dp; + static char *bp; if (inumber != nextino++ || inumber > maxino) errexit("bad inode number %llu to nextinode\n", @@ -374,9 +375,13 @@ getnextinode(ino_t inumber) lastinum += fullcnt; } (void)bread(fsreadfd, (char *)inodebuf, dblk, size); - dp = inodebuf; + bp = (char *)inodebuf; } - return (dp++); + + dp = (struct ext2fs_dinode *)bp; + bp += EXT2_DINODE_SIZE(&sblock); + + return (dp); } void @@ -388,10 +393,10 @@ resetinodebuf(void) lastinum = 1; readcnt = 0; inobufsize = blkroundup(&sblock, INOBUFSIZE); - fullcnt = inobufsize / sizeof(struct ext2fs_dinode); + fullcnt = inobufsize / EXT2_DINODE_SIZE(&sblock); readpercg = sblock.e2fs.e2fs_ipg / fullcnt; partialcnt = sblock.e2fs.e2fs_ipg % fullcnt; - partialsize = partialcnt * sizeof(struct ext2fs_dinode); + partialsize = partialcnt * EXT2_DINODE_SIZE(&sblock); if (partialcnt != 0) { readpercg++; } else { diff --git a/sbin/fsck_ext2fs/pass2.c b/sbin/fsck_ext2fs/pass2.c index b568d0888e5..5f8dce31d27 100644 --- a/sbin/fsck_ext2fs/pass2.c +++ b/sbin/fsck_ext2fs/pass2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass2.c,v 1.14 2015/01/16 06:39:57 deraadt Exp $ */ +/* $OpenBSD: pass2.c,v 1.15 2016/04/28 12:17:15 krw Exp $ */ /* $NetBSD: pass2.c,v 1.6 2000/01/28 16:01:46 bouyer Exp $ */ /* @@ -145,7 +145,7 @@ pass2(void) inodirty(); } } - memset(&dino, 0, sizeof(struct ext2fs_dinode)); + memset(&dino, 0, EXT2_DINODE_SIZE(&sblock)); dino.e2di_mode = htole16(IFDIR); inossize(&dino, inp->i_isize); memcpy(&dino.e2di_blocks[0], &inp->i_blks[0], (size_t)inp->i_numblks); diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c index 69800d6e45c..0adb5a50b89 100644 --- a/sbin/fsck_ext2fs/setup.c +++ b/sbin/fsck_ext2fs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.29 2015/10/15 15:11:10 semarie Exp $ */ +/* $OpenBSD: setup.c,v 1.30 2016/04/28 12:17:15 krw Exp $ */ /* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */ /* @@ -299,7 +299,7 @@ readsb(int listerr) sblock.e2fs_bmask = ~sblock.e2fs_qbmask; sblock.e2fs_ngdb = howmany(sblock.e2fs_ncg, sblock.e2fs_bsize / sizeof(struct ext2_gd)); - sblock.e2fs_ipb = sblock.e2fs_bsize / sizeof(struct ext2fs_dinode); + sblock.e2fs_ipb = sblock.e2fs_bsize / EXT2_DINODE_SIZE(&sblock); sblock.e2fs_itpg = sblock.e2fs.e2fs_ipg/sblock.e2fs_ipb; /* |