- fixed all printf formats [there were a lot of %l? <-> %? mistakes]

- added missing prototypes, and made local functions static
- removed parallel preening code; this is part of fsck(8)
- use printing utilities from fsck(8)
- Makefile does not make links to fsck and fsck.8
- removed -l maxparallel option. It has no meaning anymore.
This commit is contained in:
christos 1996-09-23 16:18:31 +00:00
parent fdf6ea6c50
commit 5528d37484
15 changed files with 193 additions and 616 deletions

View File

@ -1,17 +1,15 @@
# $NetBSD: Makefile,v 1.11 1996/04/05 01:45:21 cgd Exp $
# $NetBSD: Makefile,v 1.12 1996/09/23 16:18:31 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
PROG= fsck_ffs
MAN= fsck_ffs.8
SRCS= dir.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
pass5.c preen.c setup.c utilities.c ffs_subr.c ffs_tables.c
.PATH: ${.CURDIR}/../../sys/ufs/ffs
pass5.c util.c setup.c utilities.c ffs_subr.c ffs_tables.c
.PATH: ${.CURDIR}/../../sys/ufs/ffs ${.CURDIR}/../fsck
CFLAGS= -I${.CURDIR}/../fsck
.if make(install)
SUBDIR+= SMM.doc
.endif
LINKS= ${BINDIR}/fsck_ffs ${BINDIR}/fsck
MLINKS= fsck_ffs.8 fsck.8
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.18 1996/06/11 07:07:52 mycroft Exp $ */
/* $NetBSD: dir.c,v 1.19 1996/09/23 16:18:31 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.5 (Berkeley) 12/8/94";
#else
static char rcsid[] = "$NetBSD: dir.c,v 1.18 1996/06/11 07:07:52 mycroft Exp $";
static char rcsid[] = "$NetBSD: dir.c,v 1.19 1996/09/23 16:18:31 christos Exp $";
#endif
#endif /* not lint */
@ -52,6 +52,7 @@ static char rcsid[] = "$NetBSD: dir.c,v 1.18 1996/06/11 07:07:52 mycroft Exp $";
#include <string.h>
#include "fsck.h"
#include "util.h"
#include "extern.h"
char *lfname = "lost+found";
@ -66,11 +67,13 @@ struct odirtemplate odirhead = {
0, DIRBLKSIZ - 12, 2, ".."
};
int expanddir __P((struct dinode *, char *));
void freedir __P((ino_t, ino_t));
struct direct *fsck_readdir();
struct bufarea *getdirblk();
int lftempname __P((char *, ino_t));
static int expanddir __P((struct dinode *, char *));
static void freedir __P((ino_t, ino_t));
static struct direct *fsck_readdir __P((struct inodesc *));
static struct bufarea *getdirblk __P((daddr_t, long));
static int lftempname __P((char *, ino_t));
static int mkentry __P((struct inodesc *));
static int chgino __P((struct inodesc *));
/*
* Propagate connected state through the tree.
@ -173,7 +176,7 @@ dirscan(idesc)
/*
* get next entry in a directory.
*/
struct direct *
static struct direct *
fsck_readdir(idesc)
register struct inodesc *idesc;
{
@ -343,7 +346,7 @@ adjust(idesc, lcnt)
}
}
int
static int
mkentry(idesc)
struct inodesc *idesc;
{
@ -388,7 +391,7 @@ mkentry(idesc)
return (ALTERED|STOP);
}
int
static int
chgino(idesc)
struct inodesc *idesc;
{
@ -499,9 +502,9 @@ linkup(orphan, parentdir)
dp->di_nlink++;
inodirty();
lncntp[lfdir]++;
pwarn("DIR I=%lu CONNECTED. ", orphan);
pwarn("DIR I=%u CONNECTED. ", orphan);
if (parentdir != (ino_t)-1)
printf("PARENT WAS I=%lu\n", parentdir);
printf("PARENT WAS I=%u\n", parentdir);
if (preen == 0)
printf("\n");
}
@ -568,7 +571,7 @@ makeentry(parent, ino, name)
/*
* Attempt to expand the size of a directory
*/
int
static int
expanddir(dp, name)
register struct dinode *dp;
char *name;
@ -681,7 +684,7 @@ allocdir(parent, request, mode)
/*
* free a directory inode
*/
void
static void
freedir(ino, parent)
ino_t ino, parent;
{
@ -698,7 +701,7 @@ freedir(ino, parent)
/*
* generate a temporary name for the lost+found directory.
*/
int
static int
lftempname(bufp, ino)
char *bufp;
ino_t ino;
@ -725,7 +728,7 @@ lftempname(bufp, ino)
* Get a directory block.
* Insure that it is held until another is requested.
*/
struct bufarea *
static struct bufarea *
getdirblk(blkno, size)
daddr_t blkno;
long size;

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.4 1995/04/12 21:24:07 mycroft Exp $ */
/* $NetBSD: extern.h,v 1.5 1996/09/23 16:18:32 christos Exp $ */
/*
* Copyright (c) 1994 James A. Jegers
@ -24,47 +24,53 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
void adjust __P((struct inodesc *, short));
int allocblk __P((long));
int allocdir __P((ino_t, ino_t, int));
void blkerror __P((ino_t, char *, daddr_t));
int bread __P((int, char *, daddr_t, long));
void bufinit();
void bwrite __P((int, char *, daddr_t, long));
void cacheino __P((struct dinode *, ino_t));
int changeino __P((ino_t, char *, ino_t));
int checkfstab __P((int, int, int (*)(), int (*)() ));
int chkrange __P((daddr_t, int));
void ckfini __P((int));
int ckinode __P((struct dinode *, struct inodesc *));
void clri __P((struct inodesc *, char *, int));
int dircheck __P((struct inodesc *, struct direct *));
void direrror __P((ino_t, char *));
int dirscan __P((struct inodesc *));
int dofix __P((struct inodesc *, char *));
void fileerror __P((ino_t, ino_t, char *));
int findino __P((struct inodesc *));
int findname __P((struct inodesc *));
void flush __P((int, struct bufarea *));
void freeblk __P((daddr_t, long));
void freeino __P((ino_t));
void freeinodebuf();
int ftypeok __P((struct dinode *));
void getpathname __P((char *, ino_t, ino_t));
void inocleanup();
void inodirty();
int linkup __P((ino_t, ino_t));
int makeentry __P((ino_t, ino_t, char *));
void pass1();
void pass1b();
void pass2();
void pass3();
void pass4();
int pass4check();
void pass5();
void pinode __P((ino_t));
void propagate();
int reply __P((char *));
void resetinodebuf();
int setup __P((char *));
void adjust __P((struct inodesc *, short));
int allocblk __P((long));
int allocdir __P((ino_t, ino_t, int));
void blkerror __P((ino_t, char *, daddr_t));
int bread __P((int, char *, daddr_t, long));
void bufinit __P((void));
void bwrite __P((int, char *, daddr_t, long));
void cacheino __P((struct dinode *, ino_t));
int changeino __P((ino_t, char *, ino_t));
struct fstab;
int checkfstab __P((int, int, int (*)(struct fstab *),
int (*)(char *, char *, long, int)));
int chkrange __P((daddr_t, int));
void ckfini __P((int));
int ckinode __P((struct dinode *, struct inodesc *));
void clri __P((struct inodesc *, char *, int));
int dircheck __P((struct inodesc *, struct direct *));
void direrror __P((ino_t, char *));
int dirscan __P((struct inodesc *));
int dofix __P((struct inodesc *, char *));
void fileerror __P((ino_t, ino_t, char *));
int findino __P((struct inodesc *));
int findname __P((struct inodesc *));
void flush __P((int, struct bufarea *));
void freeblk __P((daddr_t, long));
void freeino __P((ino_t));
void freeinodebuf __P((void));
int ftypeok __P((struct dinode *));
void getpathname __P((char *, ino_t, ino_t));
void inocleanup __P((void));
void inodirty __P((void));
int linkup __P((ino_t, ino_t));
int makeentry __P((ino_t, ino_t, char *));
void pass1 __P((void));
void pass1b __P((void));
void pass2 __P((void));
void pass3 __P((void));
void pass4 __P((void));
int pass1check __P((struct inodesc *));
int pass4check __P((struct inodesc *));
void pass5 __P((void));
void pinode __P((ino_t));
void propagate __P((void));
int reply __P((char *));
void resetinodebuf __P((void));
int setup __P((char *));
struct dinode * getnextinode __P((ino_t));
void catch __P((int));
void catchquit __P((int));
void voidquit __P((int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.h,v 1.11 1996/06/11 07:07:53 mycroft Exp $ */
/* $NetBSD: fsck.h,v 1.12 1996/09/23 16:18:33 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -79,7 +79,7 @@ struct bufarea sblk; /* file system superblock */
struct bufarea cgblk; /* cylinder group blocks */
struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */
struct bufarea *getdatablk();
struct bufarea *getdatablk __P((daddr_t, long));
#define dirty(bp) (bp)->b_dirty = 1
#define initbarea(bp) \
@ -96,7 +96,8 @@ enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE};
struct inodesc {
enum fixstate id_fix; /* policy on fixing errors */
int (*id_func)(); /* function to be applied to blocks of inode */
int (*id_func) /* function to be applied to blocks of inode */
__P((struct inodesc *));
ino_t id_number; /* inode number described */
ino_t id_parent; /* for DATA nodes, their parent */
daddr_t id_blkno; /* current block number being examined */
@ -164,7 +165,6 @@ struct inoinfo {
} **inphead, **inpsort;
long numdirs, listmax, inplast;
char *cdevname; /* name of device being checked */
long dev_bsize; /* computed value of DEV_BSIZE */
long secsize; /* actual disk sector size */
char nflag; /* assume a no response */
@ -175,8 +175,7 @@ int cvtlevel; /* convert to newer file system format */
int doinglevel1; /* converting to new cylinder group format */
int doinglevel2; /* converting to new inode format */
int newinofmt; /* filesystem has new inode format */
char preen; /* just fix normal inconsistencies */
char hotroot; /* checking root device */
int preen; /* just fix normal inconsistencies */
char havesb; /* superblock has been read */
char skipclean; /* skip clean file systems if preening */
int fsmodified; /* 1 => write done to file system */
@ -211,8 +210,7 @@ struct dinode zino;
#define ALTERED 0x08
#define FOUND 0x10
time_t time();
struct dinode *ginode();
struct inoinfo *getinoinfo();
void getblk();
ino_t allocino();
struct dinode *ginode __P((ino_t));
struct inoinfo *getinoinfo __P((ino_t));
void getblk __P((struct bufarea *, daddr_t, long));
ino_t allocino __P((ino_t, int));

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fsck_ffs.8,v 1.11 1996/04/05 01:45:26 cgd Exp $
.\" $NetBSD: fsck_ffs.8,v 1.12 1996/09/23 16:18:34 christos Exp $
.\"
.\" Copyright (c) 1980, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -48,7 +48,6 @@
.Op Fl f
.Op Fl b Ar block#
.Op Fl c Ar level
.Op Fl l Ar maxparallel
.Op Fl y
.Op Fl n
.Op Fl m Ar mode
@ -164,12 +163,6 @@ to check the file system, regardless of the state of the clean flag.
Use the block specified immediately after the flag as
the super block for the filesystem. Block 32 is usually
an alternate super block.
.It Fl l
Limit the number of parallel checks to the number specified in the following
argument.
By default, the limit is the number of disks, running one process per disk.
If a smaller limit is given, the disks are checked round-robin, one filesystem
at a time.
.It Fl m
Use the mode specified in octal immediately after the flag as the
permission bits to use when creating the

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.20 1996/06/11 07:07:54 mycroft Exp $ */
/* $NetBSD: inode.c,v 1.21 1996/09/23 16:18:34 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95";
#else
static char rcsid[] = "$NetBSD: inode.c,v 1.20 1996/06/11 07:07:54 mycroft Exp $";
static char rcsid[] = "$NetBSD: inode.c,v 1.21 1996/09/23 16:18:34 christos Exp $";
#endif
#endif /* not lint */
@ -54,11 +54,12 @@ static char rcsid[] = "$NetBSD: inode.c,v 1.20 1996/06/11 07:07:54 mycroft Exp $
#include <string.h>
#include "fsck.h"
#include "util.h"
#include "extern.h"
static ino_t startinum;
int iblock __P((struct inodesc *, long, u_int64_t));
static int iblock __P((struct inodesc *, long, u_int64_t));
int
ckinode(dp, idesc)
@ -114,7 +115,7 @@ ckinode(dp, idesc)
return (KEEPON);
}
int
static int
iblock(idesc, ilevel, isize)
struct inodesc *idesc;
long ilevel;
@ -123,10 +124,9 @@ iblock(idesc, ilevel, isize)
register daddr_t *ap;
register daddr_t *aplim;
register struct bufarea *bp;
int i, n, (*func)(), nif;
int i, n, (*func) __P((struct inodesc *)), nif;
u_int64_t sizepb;
char buf[BUFSIZ];
extern int pass1check();
if (idesc->id_type == ADDR) {
func = idesc->id_func;
@ -149,7 +149,7 @@ iblock(idesc, ilevel, isize)
for (ap = &bp->b_un.b_indir[nif]; ap < aplim; ap++) {
if (*ap == 0)
continue;
(void)sprintf(buf, "PARTIALLY TRUNCATED INODE I=%lu",
(void)sprintf(buf, "PARTIALLY TRUNCATED INODE I=%u",
idesc->id_number);
if (dofix(idesc, buf)) {
*ap = 0;
@ -194,9 +194,9 @@ chkrange(blk, cnt)
if (blk < cgdmin(&sblock, c)) {
if ((blk + cnt) > cgsblock(&sblock, c)) {
if (debug) {
printf("blk %ld < cgdmin %ld;",
printf("blk %d < cgdmin %d;",
blk, cgdmin(&sblock, c));
printf(" blk + cnt %ld > cgsbase %ld\n",
printf(" blk + cnt %d > cgsbase %d\n",
blk + cnt, cgsblock(&sblock, c));
}
return (1);
@ -204,9 +204,9 @@ chkrange(blk, cnt)
} else {
if ((blk + cnt) > cgbase(&sblock, c+1)) {
if (debug) {
printf("blk %ld >= cgdmin %ld;",
printf("blk %d >= cgdmin %d;",
blk, cgdmin(&sblock, c));
printf(" blk + cnt %ld > sblock.fs_fpg %ld\n",
printf(" blk + cnt %d > sblock.fs_fpg %d\n",
blk+cnt, sblock.fs_fpg);
}
return (1);
@ -456,7 +456,7 @@ pinode(ino)
struct passwd *pw;
time_t t;
printf(" I=%lu ", ino);
printf(" I=%u ", ino);
if (ino < ROOTINO || ino > maxino)
return;
dp = ginode(ino);
@ -469,7 +469,7 @@ pinode(ino)
printf("%u ", (unsigned)dp->di_uid);
printf("MODE=%o\n", dp->di_mode);
if (preen)
printf("%s: ", cdevname);
printf("%s: ", cdevname());
printf("SIZE=%qu ", dp->di_size);
t = dp->di_mtime;
p = ctime(&t);
@ -483,7 +483,7 @@ blkerror(ino, type, blk)
daddr_t blk;
{
pfatal("%ld %s I=%lu", blk, type, ino);
pfatal("%d %s I=%u", blk, type, ino);
printf("\n");
switch (statemap[ino]) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.19 1995/11/28 05:25:28 jtc Exp $ */
/* $NetBSD: main.c,v 1.20 1996/09/23 16:18:35 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
static char rcsid[] = "$NetBSD: main.c,v 1.19 1995/11/28 05:25:28 jtc Exp $";
static char rcsid[] = "$NetBSD: main.c,v 1.20 1996/09/23 16:18:35 christos Exp $";
#endif
#endif /* not lint */
@ -61,12 +61,13 @@ static char rcsid[] = "$NetBSD: main.c,v 1.19 1995/11/28 05:25:28 jtc Exp $";
#include "fsck.h"
#include "extern.h"
#include "util.h"
void catch(), catchquit(), voidquit();
int returntosingle;
int argtoi __P((int, char *, char *, int));
int checkfilesys __P((char *, char *, long, int));
int docheck __P((struct fstab *));
int argtoi __P((int, char *, char *, int));
int checkfilesys __P((char *, char *, long, int));
int docheck __P((struct fstab *));
int main __P((int, char *[]));
int
main(argc, argv)
@ -74,8 +75,8 @@ main(argc, argv)
char *argv[];
{
int ch;
int ret, maxrun = 0;
extern char *optarg, *blockcheck();
int ret = 0;
extern char *optarg;
extern int optind;
sync();
@ -105,10 +106,6 @@ main(argc, argv)
skipclean = 0;
break;
case 'l':
maxrun = argtoi('l', "number", optarg, 10);
break;
case 'm':
lfmode = argtoi('m', "mode", optarg, 8);
if (lfmode &~ 07777)
@ -138,14 +135,14 @@ main(argc, argv)
(void)signal(SIGINT, catch);
if (preen)
(void)signal(SIGQUIT, catchquit);
if (argc) {
if (argc)
while (argc-- > 0)
(void)checkfilesys(blockcheck(*argv++), 0, 0L, 0);
exit(0);
}
ret = checkfstab(preen, maxrun, docheck, checkfilesys);
if (returntosingle)
exit(2);
ret = 2;
exit(ret);
}
@ -198,7 +195,7 @@ checkfilesys(filesys, mntpt, auxdata, child)
if (preen && child)
(void)signal(SIGQUIT, voidquit);
cdevname = filesys;
setcdevname(filesys, preen);
if (debug && preen)
pwarn("starting\n");
switch (setup(filesys)) {
@ -213,7 +210,7 @@ checkfilesys(filesys, mntpt, auxdata, child)
*/
if (preen == 0) {
printf("** Last Mounted on %s\n", sblock.fs_fsmnt);
if (hotroot)
if (hotroot())
printf("** Root file system\n");
printf("** Phase 1 - Check Blocks and Sizes\n");
}
@ -262,31 +259,31 @@ checkfilesys(filesys, mntpt, auxdata, child)
*/
n_ffree = sblock.fs_cstotal.cs_nffree;
n_bfree = sblock.fs_cstotal.cs_nbfree;
pwarn("%ld files, %ld used, %ld free ",
pwarn("%d files, %d used, %d free ",
n_files, n_blks, n_ffree + sblock.fs_frag * n_bfree);
printf("(%ld frags, %ld blocks, %d.%d%% fragmentation)\n",
printf("(%d frags, %d blocks, %d.%d%% fragmentation)\n",
n_ffree, n_bfree, (n_ffree * 100) / sblock.fs_dsize,
((n_ffree * 1000 + sblock.fs_dsize / 2) / sblock.fs_dsize) % 10);
if (debug &&
(n_files -= maxino - ROOTINO - sblock.fs_cstotal.cs_nifree))
printf("%ld files missing\n", n_files);
printf("%d files missing\n", n_files);
if (debug) {
n_blks += sblock.fs_ncg *
(cgdmin(&sblock, 0) - cgsblock(&sblock, 0));
n_blks += cgsblock(&sblock, 0) - cgbase(&sblock, 0);
n_blks += howmany(sblock.fs_cssize, sblock.fs_fsize);
if (n_blks -= maxfsblock - (n_ffree + sblock.fs_frag * n_bfree))
printf("%ld blocks missing\n", n_blks);
printf("%d blocks missing\n", n_blks);
if (duplist != NULL) {
printf("The following duplicate blocks remain:");
for (dp = duplist; dp; dp = dp->next)
printf(" %ld,", dp->dup);
printf(" %d,", dp->dup);
printf("\n");
}
if (zlnhead != NULL) {
printf("The following zero link count inodes remain:");
for (zlnp = zlnhead; zlnp; zlnp = zlnp->next)
printf(" %lu,", zlnp->zlncnt);
printf(" %u,", zlnp->zlncnt);
printf("\n");
}
}
@ -314,7 +311,7 @@ checkfilesys(filesys, mntpt, auxdata, child)
return (0);
if (!preen)
printf("\n***** FILE SYSTEM WAS MODIFIED *****\n");
if (hotroot) {
if (hotroot()) {
struct statfs stfs_buf;
/*
* We modified the root. Do a mount update on

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass1.c,v 1.14 1996/01/18 21:55:27 mycroft Exp $ */
/* $NetBSD: pass1.c,v 1.15 1996/09/23 16:18:36 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)pass1.c 8.1 (Berkeley) 6/5/93";
#else
static char rcsid[] = "$NetBSD: pass1.c,v 1.14 1996/01/18 21:55:27 mycroft Exp $";
static char rcsid[] = "$NetBSD: pass1.c,v 1.15 1996/09/23 16:18:36 christos Exp $";
#endif
#endif /* not lint */
@ -53,12 +53,11 @@ static char rcsid[] = "$NetBSD: pass1.c,v 1.14 1996/01/18 21:55:27 mycroft Exp $
#include "fsck.h"
#include "extern.h"
#include "util.h"
static daddr_t badblk;
static daddr_t dupblk;
int pass1check();
struct dinode *getnextinode();
void checkinode __P((ino_t, struct inodesc *));
static void checkinode __P((ino_t, struct inodesc *));
void
pass1()
@ -102,7 +101,7 @@ pass1()
freeinodebuf();
}
void
static void
checkinode(inumber, idesc)
ino_t inumber;
register struct inodesc *idesc;
@ -119,7 +118,7 @@ checkinode(inumber, idesc)
if (memcmp(dp->di_db, zino.di_db, NDADDR * sizeof(daddr_t)) ||
memcmp(dp->di_ib, zino.di_ib, NIADDR * sizeof(daddr_t)) ||
dp->di_mode || dp->di_size) {
pfatal("PARTIALLY ALLOCATED INODE I=%lu", inumber);
pfatal("PARTIALLY ALLOCATED INODE I=%u", inumber);
if (reply("CLEAR") == 1) {
dp = ginode(inumber);
clearinode(dp);
@ -169,8 +168,8 @@ checkinode(inumber, idesc)
errexit("cannot read symlink");
if (debug) {
symbuf[dp->di_size] = 0;
printf("convert symlink %d(%s) of size %d\n",
inumber, symbuf, (long)dp->di_size);
printf("convert symlink %d(%s) of size %qd\n",
inumber, symbuf, dp->di_size);
}
dp = ginode(inumber);
memcpy(dp->di_shortlink, symbuf, (long)dp->di_size);
@ -195,7 +194,7 @@ checkinode(inumber, idesc)
for (j = ndb; j < NDADDR; j++)
if (dp->di_db[j] != 0) {
if (debug)
printf("bad direct addr: %ld\n", dp->di_db[j]);
printf("bad direct addr: %d\n", dp->di_db[j]);
goto unknown;
}
for (j = 0, ndb -= NDADDR; ndb > 0; j++)
@ -203,7 +202,7 @@ checkinode(inumber, idesc)
for (; j < NIADDR; j++)
if (dp->di_ib[j] != 0) {
if (debug)
printf("bad indirect addr: %ld\n",
printf("bad indirect addr: %d\n",
dp->di_ib[j]);
goto unknown;
}
@ -216,7 +215,7 @@ checkinode(inumber, idesc)
if (zlnp == NULL) {
pfatal("LINK COUNT TABLE OVERFLOW");
if (reply("CONTINUE") == 0)
errexit("");
errexit("%s", "");
} else {
zlnp->zlncnt = inumber;
zlnp->next = zlnhead;
@ -246,7 +245,7 @@ checkinode(inumber, idesc)
(void)ckinode(dp, idesc);
idesc->id_entryno *= btodb(sblock.fs_fsize);
if (dp->di_blocks != idesc->id_entryno) {
pwarn("INCORRECT BLOCK COUNT I=%lu (%ld should be %ld)",
pwarn("INCORRECT BLOCK COUNT I=%u (%d should be %d)",
inumber, dp->di_blocks, idesc->id_entryno);
if (preen)
printf(" (CORRECTED)\n");
@ -258,7 +257,7 @@ checkinode(inumber, idesc)
}
return;
unknown:
pfatal("UNKNOWN FILE TYPE I=%lu", inumber);
pfatal("UNKNOWN FILE TYPE I=%u", inumber);
statemap[inumber] = FCLEAR;
if (reply("CLEAR") == 1) {
statemap[inumber] = USTATE;
@ -281,12 +280,12 @@ pass1check(idesc)
if ((anyout = chkrange(blkno, idesc->id_numfrags)) != 0) {
blkerror(idesc->id_number, "BAD", blkno);
if (badblk++ >= MAXBAD) {
pwarn("EXCESSIVE BAD BLKS I=%lu",
pwarn("EXCESSIVE BAD BLKS I=%u",
idesc->id_number);
if (preen)
printf(" (SKIPPING)\n");
else if (reply("CONTINUE") == 0)
errexit("");
errexit("%s", "");
return (STOP);
}
}
@ -299,19 +298,19 @@ pass1check(idesc)
} else {
blkerror(idesc->id_number, "DUP", blkno);
if (dupblk++ >= MAXDUP) {
pwarn("EXCESSIVE DUP BLKS I=%lu",
pwarn("EXCESSIVE DUP BLKS I=%u",
idesc->id_number);
if (preen)
printf(" (SKIPPING)\n");
else if (reply("CONTINUE") == 0)
errexit("");
errexit("%s", "");
return (STOP);
}
new = (struct dups *)malloc(sizeof(struct dups));
if (new == NULL) {
pfatal("DUP TABLE OVERFLOW.");
if (reply("CONTINUE") == 0)
errexit("");
errexit("%s", "");
return (STOP);
}
new->dup = blkno;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass1b.c,v 1.9 1995/03/18 14:55:51 cgd Exp $ */
/* $NetBSD: pass1b.c,v 1.10 1996/09/23 16:18:37 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)pass1b.c 8.1 (Berkeley) 6/5/93";
#else
static char rcsid[] = "$NetBSD: pass1b.c,v 1.9 1995/03/18 14:55:51 cgd Exp $";
static char rcsid[] = "$NetBSD: pass1b.c,v 1.10 1996/09/23 16:18:37 christos Exp $";
#endif
#endif /* not lint */
@ -50,7 +50,7 @@ static char rcsid[] = "$NetBSD: pass1b.c,v 1.9 1995/03/18 14:55:51 cgd Exp $";
#include "fsck.h"
#include "extern.h"
int pass1bcheck();
static int pass1bcheck __P((struct inodesc *));
static struct dups *duphead;
void
@ -81,7 +81,7 @@ pass1b()
}
}
int
static int
pass1bcheck(idesc)
register struct inodesc *idesc;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass2.c,v 1.15 1996/06/11 07:07:56 mycroft Exp $ */
/* $NetBSD: pass2.c,v 1.16 1996/09/23 16:18:37 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.6 (Berkeley) 10/27/94";
#else
static char rcsid[] = "$NetBSD: pass2.c,v 1.15 1996/06/11 07:07:56 mycroft Exp $";
static char rcsid[] = "$NetBSD: pass2.c,v 1.16 1996/09/23 16:18:37 christos Exp $";
#endif
#endif /* not lint */
@ -50,12 +50,15 @@ static char rcsid[] = "$NetBSD: pass2.c,v 1.15 1996/06/11 07:07:56 mycroft Exp $
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fsck.h"
#include "util.h"
#include "extern.h"
#define MINDIRSIZE (sizeof (struct dirtemplate))
int pass2check(), blksort();
static int pass2check __P((struct inodesc *));
static int blksort __P((const void *, const void *));
void
pass2()
@ -72,7 +75,7 @@ pass2()
case USTATE:
pfatal("ROOT INODE UNALLOCATED");
if (reply("ALLOCATE") == 0)
errexit("");
errexit("%s", "");
if (allocdir(ROOTINO, ROOTINO, 0755) != ROOTINO)
errexit("CANNOT ALLOCATE ROOT INODE\n");
break;
@ -86,7 +89,7 @@ pass2()
break;
}
if (reply("CONTINUE") == 0)
errexit("");
errexit("%s", "");
break;
case FSTATE:
@ -99,7 +102,7 @@ pass2()
break;
}
if (reply("FIX") == 0)
errexit("");
errexit("%s", "");
dp = ginode(ROOTINO);
dp->di_mode &= ~IFMT;
dp->di_mode |= IFDIR;
@ -195,7 +198,7 @@ pass2()
propagate();
}
int
static int
pass2check(idesc)
struct inodesc *idesc;
{
@ -451,10 +454,10 @@ again:
/*
* Routine to sort disk blocks.
*/
int
static int
blksort(inpp1, inpp2)
struct inoinfo **inpp1, **inpp2;
const void *inpp1, *inpp2;
{
return ((*inpp1)->i_blks[0] - (*inpp2)->i_blks[0]);
return ((* (struct inoinfo **) inpp1)->i_blks[0] -
(* (struct inoinfo **) inpp2)->i_blks[0]);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass4.c,v 1.9 1995/03/18 14:55:56 cgd Exp $ */
/* $NetBSD: pass4.c,v 1.10 1996/09/23 16:18:38 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)pass4.c 8.1 (Berkeley) 6/5/93";
#else
static char rcsid[] = "$NetBSD: pass4.c,v 1.9 1995/03/18 14:55:56 cgd Exp $";
static char rcsid[] = "$NetBSD: pass4.c,v 1.10 1996/09/23 16:18:38 christos Exp $";
#endif
#endif /* not lint */
@ -47,6 +47,8 @@ static char rcsid[] = "$NetBSD: pass4.c,v 1.9 1995/03/18 14:55:56 cgd Exp $";
#include <ufs/ffs/fs.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include "fsck.h"
#include "extern.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass5.c,v 1.14 1995/03/21 01:30:16 cgd Exp $ */
/* $NetBSD: pass5.c,v 1.15 1996/09/23 16:18:39 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)pass5.c 8.6 (Berkeley) 11/30/94";
#else
static char rcsid[] = "$NetBSD: pass5.c,v 1.14 1995/03/21 01:30:16 cgd Exp $";
static char rcsid[] = "$NetBSD: pass5.c,v 1.15 1996/09/23 16:18:39 christos Exp $";
#endif
#endif /* not lint */
@ -45,7 +45,10 @@ static char rcsid[] = "$NetBSD: pass5.c,v 1.14 1995/03/21 01:30:16 cgd Exp $";
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <ufs/ffs/ffs_extern.h>
#include <string.h>
#include "util.h"
#include "fsck.h"
#include "extern.h"
@ -224,7 +227,7 @@ pass5()
default:
if (j < ROOTINO)
break;
errexit("BAD STATE %d FOR INODE I=%d",
errexit("BAD STATE %d FOR INODE I=%ld",
statemap[j], j);
}
}

View File

@ -1,375 +0,0 @@
/* $NetBSD: preen.c,v 1.12 1996/05/11 14:27:50 mycroft Exp $ */
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)preen.c 8.3 (Berkeley) 12/6/94";
#else
static char rcsid[] = "$NetBSD: preen.c,v 1.12 1996/05/11 14:27:50 mycroft Exp $";
#endif
#endif /* not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fstab.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
struct part {
struct part *next; /* forward link of partitions on disk */
char *name; /* device name */
char *fsname; /* mounted filesystem name */
long auxdata; /* auxillary data for application */
} *badlist, **badnext = &badlist;
struct disk {
char *name; /* disk base name */
struct disk *next; /* forward link for list of disks */
struct part *part; /* head of list of partitions on disk */
int pid; /* If != 0, pid of proc working on */
} *disks;
int nrun, ndisks;
char hotroot;
char *rawname(), *unrawname(), *blockcheck();
void addpart __P((char *, char *, long));
int startdisk __P((struct disk *, int (*)() ));
int
checkfstab(preen, maxrun, docheck, chkit)
int preen, maxrun;
int (*docheck)(), (*chkit)();
{
register struct fstab *fsp;
register struct disk *dk, *nextdisk;
register struct part *pt;
int ret, pid, retcode, passno, sumstatus, status;
long auxdata;
char *name;
sumstatus = 0;
for (passno = 1; passno <= 2; passno++) {
if (setfsent() == 0) {
fprintf(stderr, "Can't open checklist file: %s\n",
_PATH_FSTAB);
return (8);
}
while ((fsp = getfsent()) != 0) {
if ((auxdata = (*docheck)(fsp)) == 0)
continue;
if (preen == 0 || passno == 1 && fsp->fs_passno == 1) {
if (name = blockcheck(fsp->fs_spec)) {
if (sumstatus = (*chkit)(name,
fsp->fs_file, auxdata, 0))
return (sumstatus);
} else if (preen)
return (8);
} else if (passno == 2 && fsp->fs_passno > 1) {
if ((name = blockcheck(fsp->fs_spec)) == NULL) {
fprintf(stderr, "BAD DISK NAME %s\n",
fsp->fs_spec);
sumstatus |= 8;
continue;
}
addpart(name, fsp->fs_file, auxdata);
}
}
if (preen == 0)
return (0);
}
if (preen) {
if (maxrun == 0)
maxrun = ndisks;
if (maxrun > ndisks)
maxrun = ndisks;
nextdisk = disks;
for (passno = 0; passno < maxrun; ++passno) {
while (ret = startdisk(nextdisk, chkit) && nrun > 0)
sleep(10);
if (ret)
return (ret);
nextdisk = nextdisk->next;
}
while ((pid = wait(&status)) != -1) {
for (dk = disks; dk; dk = dk->next)
if (dk->pid == pid)
break;
if (dk == 0) {
printf("Unknown pid %d\n", pid);
continue;
}
if (WIFEXITED(status))
retcode = WEXITSTATUS(status);
else
retcode = 0;
if (WIFSIGNALED(status)) {
printf("%s (%s): EXITED WITH SIGNAL %d\n",
dk->part->name, dk->part->fsname,
WTERMSIG(status));
retcode = 8;
}
if (retcode != 0) {
sumstatus |= retcode;
*badnext = dk->part;
badnext = &dk->part->next;
dk->part = dk->part->next;
*badnext = NULL;
} else
dk->part = dk->part->next;
dk->pid = 0;
nrun--;
if (dk->part == NULL)
ndisks--;
if (nextdisk == NULL) {
if (dk->part) {
while (ret = startdisk(dk, chkit) &&
nrun > 0)
sleep(10);
if (ret)
return (ret);
}
} else if (nrun < maxrun && nrun < ndisks) {
for ( ;; ) {
if ((nextdisk = nextdisk->next) == NULL)
nextdisk = disks;
if (nextdisk->part != NULL &&
nextdisk->pid == 0)
break;
}
while (ret = startdisk(nextdisk, chkit) &&
nrun > 0)
sleep(10);
if (ret)
return (ret);
}
}
}
if (sumstatus) {
if (badlist == 0)
return (sumstatus);
fprintf(stderr, "THE FOLLOWING FILE SYSTEM%s HAD AN %s\n\t",
badlist->next ? "S" : "", "UNEXPECTED INCONSISTENCY:");
for (pt = badlist; pt; pt = pt->next)
fprintf(stderr, "%s (%s)%s", pt->name, pt->fsname,
pt->next ? ", " : "\n");
return (sumstatus);
}
(void)endfsent();
return (0);
}
struct disk *
finddisk(name)
char *name;
{
register struct disk *dk, **dkp;
register char *p;
size_t len;
for (p = name + strlen(name) - 1; p >= name; --p)
if (isdigit(*p)) {
len = p - name + 1;
break;
}
if (p < name)
len = strlen(name);
for (dk = disks, dkp = &disks; dk; dkp = &dk->next, dk = dk->next) {
if (strncmp(dk->name, name, len) == 0 &&
dk->name[len] == 0)
return (dk);
}
if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
fprintf(stderr, "out of memory");
exit (8);
}
dk = *dkp;
if ((dk->name = malloc(len + 1)) == NULL) {
fprintf(stderr, "out of memory");
exit (8);
}
(void)strncpy(dk->name, name, len);
dk->name[len] = '\0';
dk->part = NULL;
dk->next = NULL;
dk->pid = 0;
ndisks++;
return (dk);
}
void
addpart(name, fsname, auxdata)
char *name, *fsname;
long auxdata;
{
struct disk *dk = finddisk(name);
register struct part *pt, **ppt = &dk->part;
for (pt = dk->part; pt; ppt = &pt->next, pt = pt->next)
if (strcmp(pt->name, name) == 0) {
printf("%s in fstab more than once!\n", name);
return;
}
if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
fprintf(stderr, "out of memory");
exit (8);
}
pt = *ppt;
if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
fprintf(stderr, "out of memory");
exit (8);
}
(void)strcpy(pt->name, name);
if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
fprintf(stderr, "out of memory");
exit (8);
}
(void)strcpy(pt->fsname, fsname);
pt->next = NULL;
pt->auxdata = auxdata;
}
int
startdisk(dk, checkit)
register struct disk *dk;
int (*checkit)();
{
register struct part *pt = dk->part;
dk->pid = fork();
if (dk->pid < 0) {
perror("fork");
return (8);
}
if (dk->pid == 0)
exit((*checkit)(pt->name, pt->fsname, pt->auxdata, 1));
nrun++;
return (0);
}
char *
blockcheck(origname)
char *origname;
{
struct stat stslash, stblock, stchar;
char *newname, *raw;
struct fstab *fsp;
int retried = 0;
hotroot = 0;
if (stat("/", &stslash) < 0) {
perror("/");
printf("Can't stat root\n");
return (origname);
}
newname = origname;
retry:
if (stat(newname, &stblock) < 0) {
perror(newname);
printf("Can't stat %s\n", newname);
return (origname);
}
if (S_ISBLK(stblock.st_mode)) {
if (stslash.st_dev == stblock.st_rdev)
hotroot++;
raw = rawname(newname);
if (stat(raw, &stchar) < 0) {
perror(raw);
printf("Can't stat %s\n", raw);
return (origname);
}
if (S_ISCHR(stchar.st_mode)) {
return (raw);
} else {
printf("%s is not a character device\n", raw);
return (origname);
}
} else if (S_ISCHR(stblock.st_mode) && !retried) {
newname = unrawname(newname);
retried++;
goto retry;
} else if ((fsp = getfsfile(newname)) != 0 && !retried) {
newname = fsp->fs_spec;
retried++;
goto retry;
}
/*
* Not a block or character device, just return name and
* let the user decide whether to use it.
*/
return (origname);
}
char *
unrawname(name)
char *name;
{
char *dp;
struct stat stb;
if ((dp = strrchr(name, '/')) == 0)
return (name);
if (stat(name, &stb) < 0)
return (name);
if (!S_ISCHR(stb.st_mode))
return (name);
if (dp[1] != 'r')
return (name);
(void)strcpy(&dp[1], &dp[2]);
return (name);
}
char *
rawname(name)
char *name;
{
static char rawbuf[32];
char *dp;
if ((dp = strrchr(name, '/')) == 0)
return (0);
*dp = 0;
(void)strcpy(rawbuf, name);
*dp = '/';
(void)strcat(rawbuf, "/r");
(void)strcat(rawbuf, &dp[1]);
return (rawbuf);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: setup.c,v 1.25 1996/05/21 17:36:21 mycroft Exp $ */
/* $NetBSD: setup.c,v 1.26 1996/09/23 16:18:41 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
static char rcsid[] = "$NetBSD: setup.c,v 1.25 1996/05/21 17:36:21 mycroft Exp $";
static char rcsid[] = "$NetBSD: setup.c,v 1.26 1996/09/23 16:18:41 christos Exp $";
#endif
#endif /* not lint */
@ -56,8 +56,10 @@ static char rcsid[] = "$NetBSD: setup.c,v 1.25 1996/05/21 17:36:21 mycroft Exp $
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "fsck.h"
#include "extern.h"
#include "util.h"
struct bufarea asblk;
#define altsblock (*asblk.b_un.b_fs)
@ -65,8 +67,8 @@ struct bufarea asblk;
void badsb __P((int, char *));
int calcsb __P((char *, int, struct fs *));
struct disklabel *getdisklabel();
int readsb __P((int));
static struct disklabel *getdisklabel __P((char *, int));
static int readsb __P((int));
int
setup(dev)
@ -115,7 +117,7 @@ setup(dev)
asblk.b_un.b_buf = malloc(SBSIZE);
if (sblk.b_un.b_buf == NULL || asblk.b_un.b_buf == NULL)
errexit("cannot allocate space for superblock\n");
if (lp = getdisklabel((char *)NULL, fsreadfd))
if ((lp = getdisklabel((char *)NULL, fsreadfd)) != NULL)
dev_bsize = secsize = lp->d_secsize;
else
dev_bsize = secsize = DEV_BSIZE;
@ -334,7 +336,7 @@ setup(dev)
size) != 0 && !asked) {
pfatal("BAD SUMMARY INFORMATION");
if (reply("CONTINUE") == 0)
errexit("");
errexit("%s", "");
asked++;
}
}
@ -389,7 +391,7 @@ badsblabel:
/*
* Read in the super block and its summary info.
*/
int
static int
readsb(listerr)
int listerr;
{
@ -477,7 +479,7 @@ readsb(listerr)
for ( ; olp < endlp; olp++, nlp++) {
if (*olp == *nlp)
continue;
printf("offset %d, original %d, alternate %d\n",
printf("offset %d, original %ld, alternate %ld\n",
olp - (long *)&sblock, *olp, *nlp);
}
}
@ -498,7 +500,7 @@ badsb(listerr, s)
if (!listerr)
return;
if (preen)
printf("%s: ", cdevname);
printf("%s: ", cdevname());
pfatal("BAD SUPER BLOCK: %s\n", s);
}
@ -520,7 +522,7 @@ calcsb(dev, devfd, fs)
int i;
cp = strchr(dev, '\0') - 1;
if (cp == (char *)-1 || (*cp < 'a' || *cp > 'h') && !isdigit(*cp)) {
if ((cp == (char *)-1 || (*cp < 'a' || *cp > 'h')) && !isdigit(*cp)) {
pfatal("%s: CANNOT FIGURE OUT FILE SYSTEM PARTITION\n", dev);
return (0);
}
@ -562,7 +564,7 @@ calcsb(dev, devfd, fs)
return (1);
}
struct disklabel *
static struct disklabel *
getdisklabel(s, fd)
char *s;
int fd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: utilities.c,v 1.16 1996/04/05 01:45:33 cgd Exp $ */
/* $NetBSD: utilities.c,v 1.17 1996/09/23 16:18:41 christos Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93";
#else
static char rcsid[] = "$NetBSD: utilities.c,v 1.16 1996/04/05 01:45:33 cgd Exp $";
static char rcsid[] = "$NetBSD: utilities.c,v 1.17 1996/09/23 16:18:41 christos Exp $";
#endif
#endif /* not lint */
@ -52,11 +52,14 @@ static char rcsid[] = "$NetBSD: utilities.c,v 1.16 1996/04/05 01:45:33 cgd Exp $
#include <ctype.h>
#include <unistd.h>
#include "util.h"
#include "fsck.h"
#include "extern.h"
long diskreads, totalreads; /* Disk cache statistics */
static void rwerror __P((char *, daddr_t));
int
ftypeok(dp)
struct dinode *dp;
@ -226,7 +229,7 @@ flush(fd, bp)
}
}
void
static void
rwerror(mesg, blk)
char *mesg;
daddr_t blk;
@ -234,7 +237,7 @@ rwerror(mesg, blk)
if (preen == 0)
printf("\n");
pfatal("CANNOT %s: BLK %ld", mesg, blk);
pfatal("CANNOT %s: BLK %d", mesg, blk);
if (reply("CONTINUE") == 0)
errexit("Program terminated\n");
}
@ -469,7 +472,8 @@ getpathname(namebuf, curdir, ino)
}
void
catch()
catch(n)
int n;
{
if (!doinglevel2)
ckfini(0);
@ -482,7 +486,8 @@ catch()
* so that reboot sequence may be interrupted.
*/
void
catchquit()
catchquit(n)
int n;
{
extern returntosingle;
@ -496,7 +501,8 @@ catchquit()
* Used by child processes in preen.
*/
void
voidquit()
voidquit(n)
int n;
{
sleep(1);
@ -544,61 +550,3 @@ dofix(idesc, msg)
}
/* NOTREACHED */
}
/* VARARGS1 */
errexit(s1, s2, s3, s4)
char *s1;
long s2, s3, s4;
{
printf(s1, s2, s3, s4);
exit(8);
}
/*
* An unexpected inconsistency occured.
* Die if preening, otherwise just print message and continue.
*/
/* VARARGS1 */
pfatal(s, a1, a2, a3)
char *s;
long a1, a2, a3;
{
if (preen) {
printf("%s: ", cdevname);
printf(s, a1, a2, a3);
printf("\n");
printf("%s: UNEXPECTED INCONSISTENCY; RUN fsck_ffs MANUALLY.\n",
cdevname);
exit(8);
}
printf(s, a1, a2, a3);
}
/*
* Pwarn just prints a message when not preening,
* or a warning (preceded by filename) when preening.
*/
/* VARARGS1 */
pwarn(s, a1, a2, a3, a4, a5, a6)
char *s;
long a1, a2, a3, a4, a5, a6;
{
if (preen)
printf("%s: ", cdevname);
printf(s, a1, a2, a3, a4, a5, a6);
}
#ifndef lint
/*
* Stub for routines from kernel.
*/
panic(s)
char *s;
{
pfatal("INTERNAL INCONSISTENCY:");
errexit(s);
}
#endif