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: #if !defined(lint) && defined(DOSCCS)
   8: static char sccsid[] = "@(#)pass4.c	5.3 (Berkeley) 3/5/86";
   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 pass4check();
  17: 
  18: pass4()
  19: {
  20:     register ino_t inumber, *zp;
  21:     struct inodesc idesc;
  22:     int n;
  23: 
  24:     bzero((char *)&idesc, sizeof(struct inodesc));
  25:     idesc.id_type = ADDR;
  26:     idesc.id_func = pass4check;
  27:     for (inumber = ROOTINO; inumber <= lastino; inumber++) {
  28:         idesc.id_number = inumber;
  29:         switch (getstate(inumber)) {
  30: 
  31:         case FSTATE:
  32:         case DFOUND:
  33:             n = getlncnt(inumber);
  34:             if (n)
  35:                 adjust(&idesc, (short)n);
  36:             else {
  37:                 zp = zlnlist;
  38:                 for (zp = zlnlist; zp < zlnp; zp++) {
  39:                     if (*zp == 0) continue;
  40:                     if (*zp == inumber) {
  41:                         clri(&idesc, "UNREF", 1);
  42:                         *zp = 0;
  43:                         break;
  44:                     }
  45:                 }
  46:             }
  47:             break;
  48: 
  49:         case DSTATE:
  50:             clri(&idesc, "UNREF", 1);
  51:             break;
  52: 
  53:         case DCLEAR:
  54:         case FCLEAR:
  55:             clri(&idesc, "BAD/DUP", 1);
  56:             break;
  57: 
  58:         case USTATE:
  59:             break;
  60: 
  61:         default:
  62:             errexit("BAD STATE %d FOR INODE I=%u",
  63:                 getstate(inumber), inumber);
  64:         }
  65:     }
  66: }
  67: 
  68: pass4check(idesc)
  69:     register struct inodesc *idesc;
  70: {
  71:     register daddr_t *dlp;
  72:     daddr_t blkno = idesc->id_blkno;
  73: 
  74:     if (outrange(blkno))
  75:         return (SKIP);
  76:     if (getbmap(blkno)) {
  77:         for (dlp = duplist; dlp < enddup; dlp++)
  78:             if (*dlp == blkno) {
  79:                 *dlp = *--enddup;
  80:                 return (KEEPON);
  81:             }
  82:         clrbmap(blkno);
  83:         n_blks--;
  84:     }
  85:     return (KEEPON);
  86: }

Defined functions

pass4 defined in line 18; used 1 times
pass4check defined in line 68; used 7 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1990-09-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2688
Valid CSS Valid XHTML 1.0 Strict