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.3 (Berkeley) 06/26/89"; 9 #endif not lint 10 11 #include <sys/param.h> 12 #include <sys/time.h> 13 #include <sys/vnode.h> 14 #include <ufs/inode.h> 15 #include <ufs/fs.h> 16 #include "fsck.h" 17 18 int pass1bcheck(); 19 static struct dups *duphead; 20 21 pass1b() 22 { 23 register int c, i; 24 register DINODE *dp; 25 struct inodesc idesc; 26 ino_t inumber; 27 28 bzero((char *)&idesc, sizeof(struct inodesc)); 29 idesc.id_type = ADDR; 30 idesc.id_func = pass1bcheck; 31 duphead = duplist; 32 inumber = 0; 33 for (c = 0; c < sblock.fs_ncg; c++) { 34 for (i = 0; i < sblock.fs_ipg; i++, inumber++) { 35 if (inumber < ROOTINO) 36 continue; 37 dp = ginode(inumber); 38 if (dp == NULL) 39 continue; 40 idesc.id_number = inumber; 41 if (statemap[inumber] != USTATE && 42 (ckinode(dp, &idesc) & STOP)) 43 goto out1b; 44 } 45 } 46 out1b:; 47 } 48 49 pass1bcheck(idesc) 50 register struct inodesc *idesc; 51 { 52 register struct dups *dlp; 53 int nfrags, res = KEEPON; 54 daddr_t blkno = idesc->id_blkno; 55 56 for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) { 57 if (outrange(blkno, 1)) 58 res = SKIP; 59 for (dlp = duphead; dlp; dlp = dlp->next) { 60 if (dlp->dup == blkno) { 61 blkerr(idesc->id_number, "DUP", blkno); 62 dlp->dup = duphead->dup; 63 duphead->dup = blkno; 64 duphead = duphead->next; 65 } 66 if (dlp == muldup) 67 break; 68 } 69 if (muldup == 0 || duphead == muldup->next) 70 return (STOP); 71 } 72 return (res); 73 } 74