Commit | Line | Data |
---|---|---|
1712811a | 1 | #ifndef lint |
39c18287 | 2 | static char version[] = "@(#)pass3.c 3.3 (Berkeley) %G%"; |
1712811a KM |
3 | #endif |
4 | ||
5 | #include <sys/param.h> | |
6 | #include <sys/inode.h> | |
7 | #include <sys/fs.h> | |
8 | #include "fsck.h" | |
9 | ||
10 | int pass2check(); | |
11 | ||
12 | pass3() | |
13 | { | |
14 | register DINODE *dp; | |
15 | struct inodesc idesc; | |
16 | ino_t inumber, orphan; | |
17 | int loopcnt; | |
18 | ||
19 | bzero((char *)&idesc, sizeof(struct inodesc)); | |
20 | idesc.id_type = DATA; | |
21 | for (inumber = ROOTINO; inumber <= lastino; inumber++) { | |
22 | if (statemap[inumber] == DSTATE) { | |
23 | pathp = pathname; | |
24 | *pathp++ = '?'; | |
25 | *pathp = '\0'; | |
26 | idesc.id_func = findino; | |
7718c0e6 | 27 | idesc.id_name = ".."; |
1712811a KM |
28 | idesc.id_parent = inumber; |
29 | loopcnt = 0; | |
30 | do { | |
31 | orphan = idesc.id_parent; | |
39c18287 | 32 | if (orphan < ROOTINO || orphan > imax) |
1712811a | 33 | break; |
39c18287 | 34 | dp = ginode(orphan); |
1712811a KM |
35 | idesc.id_parent = 0; |
36 | idesc.id_filesize = dp->di_size; | |
37 | idesc.id_number = orphan; | |
38 | (void)ckinode(dp, &idesc); | |
39 | if (idesc.id_parent == 0) | |
40 | break; | |
41 | if (loopcnt >= sblock.fs_cstotal.cs_ndir) | |
42 | break; | |
43 | loopcnt++; | |
44 | } while (statemap[idesc.id_parent] == DSTATE); | |
45 | if (linkup(orphan, idesc.id_parent) == 1) { | |
46 | idesc.id_func = pass2check; | |
47 | idesc.id_number = lfdir; | |
48 | descend(&idesc, orphan); | |
49 | } | |
50 | } | |
51 | } | |
52 | } |