3 #include "fsck_helper.h"
5 /* This test can only be run after all other inode tests. */
6 testresult_t
test_ininfo(void)
13 uint32_t realrefcount
;
18 fetch_superblock(&sb
);
20 for (inodeidx
= 0; inodeidx
< sb
->itotal
; ++inodeidx
) {
21 fret
= soReadInode(&inode
, inodeidx
);
22 if (fret
< 0) FABORT(fret
, "test_ininfo");
25 ictable_get(inodeidx
, &icstat
);
28 if ((inode
.mode
&& INODE_FREE
) == 0) {
29 printf("Inode %d is free, but it's INODE_FREE bit is not "
35 if ((inode
.mode
&& INODE_FREE
) == INODE_FREE
) {
36 printf("Inode %d is in use, but it's INODE_FREE bit is "
42 printf("BUM! test_ininfo assumes inodes are either free or "
48 typesum
= (inode
.mode
&& INODE_DIR
)/INODE_DIR
+
49 (inode
.mode
&& INODE_FILE
)/INODE_FILE
+
50 (inode
.mode
&& INODE_SYMLINK
)/INODE_SYMLINK
;
51 if (((inode
.mode
&& INODE_FREE
) == 0) && typesum
== 0) {
52 printf("Inode %d is not free but has no type.\n", inodeidx
);
56 printf("Inode %d has many types.\n", inodeidx
);
61 irtable_get(inodeidx
, &realrefcount
);
62 if (realrefcount
!= inode
.refcount
) {
63 printf("Refcount of inode %d is %d but should be %d.\n", inodeidx
,
64 inode
.refcount
, realrefcount
);