date and time created 84/03/31 21:03:49 by mckusick
[unix-history] / usr / src / sbin / fsck / pass3.c
#ifndef lint
static char version[] = "@(#)pass3.c 3.1 (Berkeley) %G%";
#endif
#include <sys/param.h>
#include <sys/inode.h>
#include <sys/fs.h>
#include "fsck.h"
int pass2check();
pass3()
{
register DINODE *dp;
struct inodesc idesc;
ino_t inumber, orphan;
int loopcnt;
bzero((char *)&idesc, sizeof(struct inodesc));
idesc.id_type = DATA;
for (inumber = ROOTINO; inumber <= lastino; inumber++) {
if (statemap[inumber] == DSTATE) {
pathp = pathname;
*pathp++ = '?';
*pathp = '\0';
idesc.id_func = findino;
srchname = "..";
idesc.id_parent = inumber;
loopcnt = 0;
do {
orphan = idesc.id_parent;
if ((dp = ginode(orphan)) == NULL)
break;
idesc.id_parent = 0;
idesc.id_filesize = dp->di_size;
idesc.id_number = orphan;
(void)ckinode(dp, &idesc);
if (idesc.id_parent == 0)
break;
if (loopcnt >= sblock.fs_cstotal.cs_ndir)
break;
loopcnt++;
} while (statemap[idesc.id_parent] == DSTATE);
if (linkup(orphan, idesc.id_parent) == 1) {
idesc.id_func = pass2check;
idesc.id_number = lfdir;
descend(&idesc, orphan);
}
}
}
}