3 #include "fsck_helper.h"
5 /* This test can only be run after all other inode tests.
6 * This test is more like a set of tests, so, a lot of returns are spread all
9 testresult_t
test_ininfo(void)
16 uint32_t realrefcount
;
21 fetch_superblock(&sb
);
23 for (inodeidx
= 0; inodeidx
< sb
->itotal
; ++inodeidx
) {
24 fret
= soReadInode(&inode
, inodeidx
);
25 if (fret
< 0) FABORT(fret
, "test_ininfo");
28 ictable_get(inodeidx
, &icstat
);
31 if ((inode
.mode
&& INODE_FREE
) == 0) {
32 printf("Inode %d is free, but it's INODE_FREE bit is not "
38 if ((inode
.mode
&& INODE_FREE
) == INODE_FREE
) {
39 printf("Inode %d is in use, but it's INODE_FREE bit is "
45 printf("BUM! test_ininfo assumes inodes are either free or "
51 typesum
= (inode
.mode
&& INODE_DIR
)/INODE_DIR
+
52 (inode
.mode
&& INODE_FILE
)/INODE_FILE
+
53 (inode
.mode
&& INODE_SYMLINK
)/INODE_SYMLINK
;
54 if (((inode
.mode
&& INODE_FREE
) == 0) && typesum
== 0) {
55 printf("Inode %d is not free but has no type.\n", inodeidx
);
59 printf("Inode %d has many types.\n", inodeidx
);
64 irtable_get(inodeidx
, &realrefcount
);
65 if (realrefcount
!= inode
.refcount
) {
66 printf("Refcount of inode %d is %d but should be %d.\n", inodeidx
,
67 inode
.refcount
, realrefcount
);