diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-05-05 22:17:35 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-05-05 22:17:35 +0000 |
commit | 2986368226c208e8b7f8b03ff25b4fb031a886e4 (patch) | |
tree | 3a5a3217a948e943aab088a44f43dc4cd31fe56f | |
parent | d2a77b7e39f33f0ca6d4526c9a2c636dbd12adbd (diff) |
Do not rely on fs_cpg; this is especially important for ffs2 which
does not use fs_cpg at all. From FreeBSD. OK otto@
-rw-r--r-- | sbin/fsck_ffs/pass5.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index b954bcc7532..19f07101346 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass5.c,v 1.29 2007/04/23 10:18:30 pedro Exp $ */ +/* $OpenBSD: pass5.c,v 1.30 2007/05/05 22:17:34 millert Exp $ */ /* $NetBSD: pass5.c,v 1.16 1996/09/27 22:45:18 christos Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94"; #else -static const char rcsid[] = "$OpenBSD: pass5.c,v 1.29 2007/04/23 10:18:30 pedro Exp $"; +static const char rcsid[] = "$OpenBSD: pass5.c,v 1.30 2007/05/05 22:17:34 millert Exp $"; #endif #endif /* not lint */ @@ -146,12 +146,10 @@ pass5(void) newcg->cg_iusedoff = newcg->cg_boff + fs->fs_cpg * fs->fs_nrpos * sizeof(int16_t); } - newcg->cg_freeoff = newcg->cg_iusedoff + - howmany(fs->fs_ipg, NBBY); - inomapsize = newcg->cg_freeoff - newcg->cg_iusedoff; - newcg->cg_nextfreeoff = newcg->cg_freeoff + - howmany(fs->fs_cpg * fs->fs_spc / NSPF(fs), NBBY); - blkmapsize = newcg->cg_nextfreeoff - newcg->cg_freeoff; + inomapsize = howmany(fs->fs_ipg, CHAR_BIT); + newcg->cg_freeoff = newcg->cg_iusedoff + inomapsize; + blkmapsize = howmany(fs->fs_fpg, CHAR_BIT); + newcg->cg_nextfreeoff = newcg->cg_freeoff + blkmapsize; if (fs->fs_contigsumsize > 0) { newcg->cg_clustersumoff = newcg->cg_nextfreeoff - sizeof(int32_t); @@ -160,7 +158,7 @@ pass5(void) newcg->cg_clusteroff = newcg->cg_clustersumoff + (fs->fs_contigsumsize + 1) * sizeof(int32_t); newcg->cg_nextfreeoff = newcg->cg_clusteroff + - howmany(fs->fs_cpg * fs->fs_spc / NSPB(fs), NBBY); + howmany(fragstoblks(fs, fs->fs_fpg), CHAR_BIT); } newcg->cg_magic = CG_MAGIC; basesize = sizeof(struct cg); |