diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1997-10-06 15:34:00 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 1997-10-06 15:34:00 +0000 |
commit | d45df835e0222044e4c8968f7b4e974002d7d0f9 (patch) | |
tree | 1c06de61891da6e3fdfe50ec117af17b0dc256d1 /sbin/fsck_ffs/utilities.c | |
parent | e676b3b5ac1041891584dd10c6bde24b82ebb2f2 (diff) |
VFS Lite2 Changes
Diffstat (limited to 'sbin/fsck_ffs/utilities.c')
-rw-r--r-- | sbin/fsck_ffs/utilities.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index 92d4b69da80..3b6dfe2d017 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.4 1997/06/25 18:12:17 kstailey Exp $ */ +/* $OpenBSD: utilities.c,v 1.5 1997/10/06 15:33:36 csapuntz Exp $ */ /* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: utilities.c,v 1.4 1997/06/25 18:12:17 kstailey Exp $"; +static char rcsid[] = "$OpenBSD: utilities.c,v 1.5 1997/10/06 15:33:36 csapuntz Exp $"; #endif #endif /* not lint */ @@ -96,6 +96,7 @@ reply(question) printf("\n"); if (!persevere && (nflag || fswritefd < 0)) { printf("%s? no\n\n", question); + resolved = 0; return (0); } if (yflag || (persevere && nflag)) { @@ -106,13 +107,17 @@ reply(question) printf("%s? [yn] ", question); (void) fflush(stdout); c = getc(stdin); - while (c != '\n' && getc(stdin) != '\n') - if (feof(stdin)) + while (c != '\n' && getc(stdin) != '\n') { + if (feof(stdin)) { + resolved = 0; return (0); + } + } } while (c != 'y' && c != 'Y' && c != 'n' && c != 'N'); printf("\n"); if (c == 'y' || c == 'Y') return (1); + resolved = 0; return (0); } @@ -374,7 +379,8 @@ int allocblk(frags) long frags; { - register int i, j, k; + int i, j, k, cg, baseblk; + struct cg *cgp = &cgrp; if (frags <= 0 || frags > sblock.fs_frag) return (0); @@ -389,9 +395,21 @@ allocblk(frags) j += k; continue; } - for (k = 0; k < frags; k++) + cg = dtog(&sblock, i + j); + getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); + if (!cg_chkmagic(cgp)) + pfatal("CG %d: BAD MAGIC NUMBER\n", cg); + baseblk = dtogd(&sblock, i + j); + + for (k = 0; k < frags; k++) { setbmap(i + j + k); + clrbit(cg_blksfree(cgp), baseblk + k); + } n_blks += frags; + if (frags == sblock.fs_frag) + cgp->cg_cs.cs_nbfree--; + else + cgp->cg_cs.cs_nffree -= frags; return (i + j); } } |