Annotation of 43BSDReno/sbin/fsck/pass1b.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980, 1986 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted provided
                      6:  * that: (1) source distributions retain this entire copyright notice and
                      7:  * comment, and (2) distributions including binaries display the following
                      8:  * acknowledgement:  ``This product includes software developed by the
                      9:  * University of California, Berkeley and its contributors'' in the
                     10:  * documentation or other materials provided with the distribution and in
                     11:  * all advertising materials mentioning features or use of this software.
                     12:  * Neither the name of the University nor the names of its contributors may
                     13:  * be used to endorse or promote products derived from this software without
                     14:  * specific prior written permission.
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     16:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     17:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     18:  */
                     19: 
                     20: #ifndef lint
                     21: static char sccsid[] = "@(#)pass1b.c   5.8 (Berkeley) 7/20/90";
                     22: #endif /* not lint */
                     23: 
                     24: #include <sys/param.h>
                     25: #include <ufs/dinode.h>
                     26: #include <ufs/fs.h>
                     27: #include <string.h>
                     28: #include "fsck.h"
                     29: 
                     30: int    pass1bcheck();
                     31: static  struct dups *duphead;
                     32: 
                     33: pass1b()
                     34: {
                     35:        register int c, i;
                     36:        register struct dinode *dp;
                     37:        struct inodesc idesc;
                     38:        ino_t inumber;
                     39: 
                     40:        bzero((char *)&idesc, sizeof(struct inodesc));
                     41:        idesc.id_type = ADDR;
                     42:        idesc.id_func = pass1bcheck;
                     43:        duphead = duplist;
                     44:        inumber = 0;
                     45:        for (c = 0; c < sblock.fs_ncg; c++) {
                     46:                for (i = 0; i < sblock.fs_ipg; i++, inumber++) {
                     47:                        if (inumber < ROOTINO)
                     48:                                continue;
                     49:                        dp = ginode(inumber);
                     50:                        if (dp == NULL)
                     51:                                continue;
                     52:                        idesc.id_number = inumber;
                     53:                        if (statemap[inumber] != USTATE &&
                     54:                            (ckinode(dp, &idesc) & STOP))
                     55:                                return;
                     56:                }
                     57:        }
                     58: }
                     59: 
                     60: pass1bcheck(idesc)
                     61:        register struct inodesc *idesc;
                     62: {
                     63:        register struct dups *dlp;
                     64:        int nfrags, res = KEEPON;
                     65:        daddr_t blkno = idesc->id_blkno;
                     66: 
                     67:        for (nfrags = idesc->id_numfrags; nfrags > 0; blkno++, nfrags--) {
                     68:                if (chkrange(blkno, 1))
                     69:                        res = SKIP;
                     70:                for (dlp = duphead; dlp; dlp = dlp->next) {
                     71:                        if (dlp->dup == blkno) {
                     72:                                blkerror(idesc->id_number, "DUP", blkno);
                     73:                                dlp->dup = duphead->dup;
                     74:                                duphead->dup = blkno;
                     75:                                duphead = duphead->next;
                     76:                        }
                     77:                        if (dlp == muldup)
                     78:                                break;
                     79:                }
                     80:                if (muldup == 0 || duphead == muldup->next)
                     81:                        return (STOP);
                     82:        }
                     83:        return (res);
                     84: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.