Fix copyright
[unix-history] / usr / src / sbin / fsck / fsck.h
index 44e4bf3..24a12bf 100644 (file)
@@ -1,9 +1,13 @@
-/* @(#)fsck.h  3.3 (Berkeley) %G% */
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)fsck.h      5.1 (Berkeley) %G%
+ */
 
 #define        MAXDUP          10      /* limit on dup blks (per inode) */
 #define        MAXBAD          10      /* limit on bad blks (per inode) */
 
 #define        MAXDUP          10      /* limit on dup blks (per inode) */
 #define        MAXBAD          10      /* limit on bad blks (per inode) */
-#define        DUPTBLSIZE      100     /* num of dup blocks to remember */
-#define        MAXLNCNT        500     /* num zero link cnts to remember */
 
 typedef        int     (*SIG_TYP)();
 
 
 typedef        int     (*SIG_TYP)();
 
@@ -34,6 +38,7 @@ struct bufarea {
        struct bufarea  *b_next;                /* must be first */
        daddr_t b_bno;
        int     b_size;
        struct bufarea  *b_next;                /* must be first */
        daddr_t b_bno;
        int     b_size;
+       int     b_errs;
        union {
                char    b_buf[MAXBSIZE];        /* buffer space */
                short   b_lnks[SPERB];          /* link counts */
        union {
                char    b_buf[MAXBSIZE];        /* buffer space */
                short   b_lnks[SPERB];          /* link counts */
@@ -88,13 +93,42 @@ struct inodesc {
 #define        DATA    1
 #define        ADDR    2
 
 #define        DATA    1
 #define        ADDR    2
 
-
-daddr_t        duplist[DUPTBLSIZE];    /* dup block table */
-daddr_t        *enddup;                /* next entry in dup table */
-daddr_t        *muldup;                /* multiple dups part of table */
-
-ino_t  badlncnt[MAXLNCNT];     /* table of inos with zero link cnts */
-ino_t  *badlnp;                /* next entry in table */
+/*
+ * Linked list of duplicate blocks.
+ * 
+ * The list is composed of two parts. The first part of the
+ * list (from duplist through the node pointed to by muldup)
+ * contains a single copy of each duplicate block that has been 
+ * found. The second part of the list (from muldup to the end)
+ * contains duplicate blocks that have been found more than once.
+ * To check if a block has been found as a duplicate it is only
+ * necessary to search from duplist through muldup. To find the 
+ * total number of times that a block has been found as a duplicate
+ * the entire list must be searched for occurences of the block
+ * in question. The following diagram shows a sample list where
+ * w (found twice), x (found once), y (found three times), and z
+ * (found once) are duplicate block numbers:
+ *
+ *    w -> y -> x -> z -> y -> w -> y
+ *    ^                     ^
+ *    |                     |
+ * duplist       muldup
+ */
+struct dups {
+       struct dups *next;
+       daddr_t dup;
+};
+struct dups *duplist;          /* head of dup list */
+struct dups *muldup;           /* end of unique duplicate dup block numbers */
+
+/*
+ * Linked list of inodes with zero link counts.
+ */
+struct zlncnt {
+       struct zlncnt *next;
+       ino_t zlncnt;
+};
+struct zlncnt *zlnhead;                /* head of zero link count list */
 
 char   rawflg;
 char   *devname;
 
 char   rawflg;
 char   *devname;