|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)pass1b.c 5.2 (Berkeley) 5/7/88"; ! 9: #endif not lint ! 10: ! 11: #include <sys/param.h> ! 12: #include <sys/inode.h> ! 13: #include <sys/fs.h> ! 14: #include "fsck.h" ! 15: ! 16: int pass1bcheck(); ! 17: static struct dups *duphead; ! 18: ! 19: pass1b() ! 20: { ! 21: register int c, i; ! 22: register DINODE *dp; ! 23: struct inodesc idesc; ! 24: ino_t inumber; ! 25: ! 26: bzero((char *)&idesc, sizeof(struct inodesc)); ! 27: idesc.id_type = ADDR; ! 28: idesc.id_func = pass1bcheck; ! 29: duphead = duplist; ! 30: inumber = 0; ! 31: for (c = 0; c < sblock.fs_ncg; c++) { ! 32: for (i = 0; i < sblock.fs_ipg; i++, inumber++) { ! 33: if (inumber < ROOTINO) ! 34: continue; ! 35: dp = ginode(inumber); ! 36: if (dp == NULL) ! 37: continue; ! 38: idesc.id_number = inumber; ! 39: if (statemap[inumber] != USTATE && ! 40: (ckinode(dp, &idesc) & STOP)) ! 41: goto out1b; ! 42: } ! 43: } ! 44: out1b:; ! 45: } ! 46: ! 47: pass1bcheck(idesc) ! 48: register struct inodesc *idesc; ! 49: { ! 50: register struct dups *dlp; ! 51: int nfrags, res = KEEPON; ! 52: daddr_t blkno = idesc->id_blkno; ! 53: ! 54: for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) { ! 55: if (outrange(blkno, 1)) ! 56: res = SKIP; ! 57: for (dlp = duphead; dlp; dlp = dlp->next) { ! 58: if (dlp->dup == blkno) { ! 59: blkerr(idesc->id_number, "DUP", blkno); ! 60: dlp->dup = duphead->dup; ! 61: duphead->dup = blkno; ! 62: duphead = duphead->next; ! 63: } ! 64: if (dlp == muldup) ! 65: break; ! 66: } ! 67: if (muldup == 0 || duphead == muldup->next) ! 68: return (STOP); ! 69: } ! 70: return (res); ! 71: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.