salvage the correct part of the directory
[unix-history] / usr / src / sbin / fsck / pass5.c
index 286cf10..7d41ed6 100644 (file)
@@ -6,12 +6,13 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)pass5.c    5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)pass5.c    5.18 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
-#include <ufs/dinode.h>
-#include <ufs/fs.h>
+#include <sys/time.h>
+#include <ufs/ufs/dinode.h>
+#include <ufs/ffs/fs.h>
 #include <string.h>
 #include "fsck.h"
 
 #include <string.h>
 #include "fsck.h"
 
@@ -24,7 +25,6 @@ pass5()
        register daddr_t d;
        register long i, j;
        struct csum *cs;
        register daddr_t d;
        register long i, j;
        struct csum *cs;
-       time_t now;
        struct csum cstotal;
        struct inodesc idesc[3];
        char buf[MAXBSIZE];
        struct csum cstotal;
        struct inodesc idesc[3];
        char buf[MAXBSIZE];
@@ -68,10 +68,12 @@ pass5()
                        fs->fs_postblformat);
        }
        bzero((char *)&idesc[0], sizeof idesc);
                        fs->fs_postblformat);
        }
        bzero((char *)&idesc[0], sizeof idesc);
-       for (i = 0; i < 3; i++)
+       for (i = 0; i < 3; i++) {
                idesc[i].id_type = ADDR;
                idesc[i].id_type = ADDR;
+               if (doinglevel2)
+                       idesc[i].id_fix = FIX;
+       }
        bzero((char *)&cstotal, sizeof(struct csum));
        bzero((char *)&cstotal, sizeof(struct csum));
-       (void)time(&now);
        j = blknum(fs, fs->fs_size + fs->fs_frag - 1);
        for (i = fs->fs_size; i < j; i++)
                setbmap(i);
        j = blknum(fs, fs->fs_size + fs->fs_frag - 1);
        for (i = fs->fs_size; i < j; i++)
                setbmap(i);
@@ -83,10 +85,7 @@ pass5()
                dmax = dbase + fs->fs_fpg;
                if (dmax > fs->fs_size)
                        dmax = fs->fs_size;
                dmax = dbase + fs->fs_fpg;
                if (dmax > fs->fs_size)
                        dmax = fs->fs_size;
-               if (now > cg->cg_time)
-                       newcg->cg_time = cg->cg_time;
-               else
-                       newcg->cg_time = now;
+               newcg->cg_time = cg->cg_time;
                newcg->cg_cgx = c;
                if (c == fs->fs_ncg - 1)
                        newcg->cg_ncyl = fs->fs_ncyl % fs->fs_cpg;
                newcg->cg_cgx = c;
                if (c == fs->fs_ncg - 1)
                        newcg->cg_ncyl = fs->fs_ncyl % fs->fs_cpg;
@@ -163,7 +162,7 @@ pass5()
                        } else if (frags > 0) {
                                newcg->cg_cs.cs_nffree += frags;
                                blk = blkmap(fs, cg_blksfree(newcg), i);
                        } else if (frags > 0) {
                                newcg->cg_cs.cs_nffree += frags;
                                blk = blkmap(fs, cg_blksfree(newcg), i);
-                               fragacct(fs, blk, newcg->cg_frsum, 1);
+                               ffs_fragacct(fs, blk, newcg->cg_frsum, 1);
                        }
                }
                cstotal.cs_nffree += newcg->cg_cs.cs_nffree;
                        }
                }
                cstotal.cs_nffree += newcg->cg_cs.cs_nffree;
@@ -176,7 +175,7 @@ pass5()
                        bcopy((char *)&newcg->cg_cs, (char *)cs, sizeof *cs);
                        sbdirty();
                }
                        bcopy((char *)&newcg->cg_cs, (char *)cs, sizeof *cs);
                        sbdirty();
                }
-               if (cvtflag) {
+               if (doinglevel1) {
                        bcopy((char *)newcg, (char *)cg, (size_t)fs->fs_cgsize);
                        cgdirty();
                        continue;
                        bcopy((char *)newcg, (char *)cg, (size_t)fs->fs_cgsize);
                        cgdirty();
                        continue;