3 #include "fsck_helper.h"
6 testresult_t
test_infree (void)
13 uint32_t inodeidx
, previnodeidx
;
18 fetch_superblock(&sb
);
22 previnodeidx
= NULL_INODE
;
23 while (inodeidx
!= NULL_INODE
) {
24 if (inodeidx
< sb
->itotal
) {
25 ictable_get(inodeidx
, &icstat
);
28 fret
= soReadInode(&inode
, inodeidx
);
29 if (fret
< 0) FABORT(fret
, "test_infree");
31 ictable_set(inodeidx
, idle
);
34 printf("Inode number %u is marked as used and is in free"
35 "inode list.\n", inodeidx
);
39 printf("Free inode list closes over itself.\n");
43 printf("BUM! ictable has something strange in it.\n");
48 printf("Free inode list has a member pointing to %u, which is "
49 "outside the list.\n", inodeidx
);
54 if (inode
.prev
!= previnodeidx
) {
55 printf("Prev of inode %u in free inode list is %u, should be %u.\n"
56 inodeidx
, inode
.prev
, previnodeidx
);
60 previnodeidx
= inodeidx
;
61 inodeidx
= inode
.next
;
65 if (previnodeidx
!= sb
->itail
) {
66 printf("Itail is %u, should be %u.\n", sb
->itail
, previnodeidx
);
69 if (ifree
!= sb
->ifree
) {
70 printf("ifree is %u, should be %u.\n", sb
->ifree
, ifree
);