diff options
author | 2007-05-19 20:12:50 +0000 | |
---|---|---|
committer | 2007-05-19 20:12:50 +0000 | |
commit | 5d5f5f996440e8fb53cbb35e3248917f2093e372 (patch) | |
tree | e130622428432182dd0e448998a6f3c0456f3532 /sbin/newfs/mkfs.c | |
parent | (disabled) option for PCIAGP. at least lets i945 chipsets work (diff) | |
download | wireguard-openbsd-5d5f5f996440e8fb53cbb35e3248917f2093e372.tar.xz wireguard-openbsd-5d5f5f996440e8fb53cbb35e3248917f2093e372.zip |
Now that the amd64 floppy and cd image -c setting have been fixed,
recommit the -c changes. For now, we warn only if we cannot honour -c.
ok millert@ deraadt@
Diffstat (limited to 'sbin/newfs/mkfs.c')
-rw-r--r-- | sbin/newfs/mkfs.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index c19e0cfd755..317260128a0 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.62 2007/05/19 01:28:15 deraadt Exp $ */ +/* $OpenBSD: mkfs.c,v 1.63 2007/05/19 20:12:50 otto Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -88,7 +88,7 @@ extern int fssize; /* file system size */ extern int sectorsize; /* bytes/sector */ extern int fsize; /* fragment size */ extern int bsize; /* block size */ -extern int maxblkspercg; /* maximum blocks per cylinder group */ +extern int maxfrgspercg; /* maximum fragments per cylinder group */ extern int minfree; /* free space threshold */ extern int opt; /* optimization preference (space or time) */ extern int density; /* number of bytes per inode */ @@ -359,8 +359,8 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo, mode_t mfsmode, * install media which needs to pack 2 files very tightly. */ mincylgrps = MINCYLGRPS; - if (maxblkspercg != INT_MAX) { - i = sblock.fs_size / maxblkspercg; + if (maxfrgspercg != INT_MAX) { + i = sblock.fs_size / maxfrgspercg; if (i < MINCYLGRPS) mincylgrps = i <= 0 ? 1 : i; } @@ -370,25 +370,21 @@ mkfs(struct partition *pp, char *fsys, int fi, int fo, mode_t mfsmode, * grow any larger, the number of cylinder groups drops below * mincylgrps, or we reach the requested size. */ - for (; sblock.fs_fpg < maxblkspercg; sblock.fs_fpg += sblock.fs_frag) { + for (;;) { + sblock.fs_fpg += sblock.fs_frag; sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), INOPB(&sblock)); - if (sblock.fs_size / sblock.fs_fpg < mincylgrps) - break; - - if (CGSIZE(&sblock) < (unsigned long)sblock.fs_bsize) - continue; - - if (CGSIZE(&sblock) == (unsigned long)sblock.fs_bsize) + if (sblock.fs_fpg > maxfrgspercg || + sblock.fs_size / sblock.fs_fpg < mincylgrps || + CGSIZE(&sblock) > (unsigned long)sblock.fs_bsize) break; - - sblock.fs_fpg -= sblock.fs_frag; - sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), - INOPB(&sblock)); - - break; } + sblock.fs_fpg -= sblock.fs_frag; + sblock.fs_ipg = roundup(howmany(sblock.fs_fpg, fragsperinode), + INOPB(&sblock)); + if (sblock.fs_fpg > maxfrgspercg) + warnx("can't honour -c: minimum is %d", sblock.fs_fpg); /* * Check to be sure that the last cylinder group has enough blocks to |