diff options
Diffstat (limited to 'sbin/fsck_ifs/utilities.c')
-rw-r--r-- | sbin/fsck_ifs/utilities.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/sbin/fsck_ifs/utilities.c b/sbin/fsck_ifs/utilities.c index 0d82d6e..5ea02b6 100644 --- a/sbin/fsck_ifs/utilities.c +++ b/sbin/fsck_ifs/utilities.c @@ -32,20 +32,16 @@ */ #ifndef lint -#if 0 static const char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95"; -#endif -static const char rcsid[] = - "$Id$"; #endif /* not lint */ #include <sys/param.h> +#include <sys/time.h> #include <ufs/ufs/dinode.h> #include <ufs/ufs/dir.h> #include <ufs/ffs/fs.h> -#include <ctype.h> #include <err.h> #include <string.h> @@ -116,6 +112,26 @@ reply(question) } /* + * Look up state information for an inode. + */ +struct inostat * +inoinfo(inum) + ino_t inum; +{ + static struct inostat unallocated = { USTATE, 0, 0 }; + struct inostatlist *ilp; + int iloff; + + if (inum > maxino) + errx(EEXIT, "inoinfo: inumber %d out of range", inum); + ilp = &inostathead[inum / sblock.fs_ipg]; + iloff = inum % sblock.fs_ipg; + if (iloff >= ilp->il_numalloced) + return (&unallocated); + return (&ilp->il_stat[iloff]); +} + +/* * Malloc buffers and set up cache. */ void @@ -270,16 +286,23 @@ ckfini(markclean) free((char *)bp); } if (bufhead.b_size != cnt) - errx(EEXIT, "panic: lost %d buffers", bufhead.b_size - cnt); + errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt); pbp = pdirbp = (struct bufarea *)0; - if (markclean && sblock.fs_clean == 0) { - sblock.fs_clean = 1; + if (sblock.fs_clean != markclean) { + sblock.fs_clean = markclean; sbdirty(); ofsmodified = fsmodified; flush(fswritefd, &sblk); fsmodified = ofsmodified; - if (!preen) - printf("\n***** FILE SYSTEM MARKED CLEAN *****\n"); + if (!preen) { + printf("\n***** FILE SYSTEM MARKED %s *****\n", + markclean ? "CLEAN" : "DIRTY"); + if (!markclean) + rerun = 1; + } + } else if (!preen && !markclean) { + printf("\n***** FILE SYSTEM STILL DIRTY *****\n"); + rerun = 1; } if (debug) printf("cache missed %ld of %ld (%d%%)\n", diskreads, @@ -324,6 +347,8 @@ bread(fd, buf, blk, size) } } printf("\n"); + if (errs) + resolved = 0; return (errs); } @@ -348,6 +373,7 @@ bwrite(fd, buf, blk, size) fsmodified = 1; return; } + resolved = 0; rwerror("WRITE", blk); if (lseek(fd, offset, 0) < 0) rwerror("SEEK", blk); @@ -438,7 +464,8 @@ getpathname(namebuf, curdir, ino) return; } if (busy || - (statemap[curdir] != DSTATE && statemap[curdir] != DFOUND)) { + (inoinfo(curdir)->ino_state != DSTATE && + inoinfo(curdir)->ino_state != DFOUND)) { (void)strcpy(namebuf, "?"); return; } @@ -497,6 +524,7 @@ void catchquit(sig) int sig; { + printf("returning to single-user after filesystem check\n"); returntosingle = 1; (void)signal(SIGQUIT, SIG_DFL); @@ -589,14 +617,16 @@ pfatal(fmt, va_alist) va_end(ap); if (usedsoftdep) (void)fprintf(stderr, - "\nUNEXPECTED SOFTDEP INCONSISTENCY\n"); + "\nUNEXPECTED SOFT UPDATE INCONSISTENCY\n"); return; } + if (cdevname == NULL) + cdevname = "fsck"; (void)fprintf(stderr, "%s: ", cdevname); (void)vfprintf(stderr, fmt, ap); (void)fprintf(stderr, "\n%s: UNEXPECTED%sINCONSISTENCY; RUN fsck MANUALLY.\n", - cdevname, usedsoftdep ? " SOFTDEP " : " "); + cdevname, usedsoftdep ? " SOFT UPDATE " : " "); ckfini(0); exit(EEXIT); } |