Created test_ininfo.c
[fsck.sofs09.git] / test_sbciutablesize.c
blob6b29adb628f2429091f39aff4f5f332d30ec9b54
1 #include <stdio.h>
3 #include "fsck.h"
4 #include "fsck_helper.h"
5 #include "sofs09.h"
7 testresult_t test_sbciutablesize (void)
9 testresult_t ret;
10 SOSuperBlock *sb;
11 int ciutshortage, ciutexcess;
13 fetch_superblock(&sb);
15 /* ceil(a/b) = (a + b - 1)/b */
17 ret = nice;
19 if (sb->ciutable_size < (sb->dzone_size+RPB-1)/RPB) {
20 ciutshortage = (sb->dzone_size+RPB-1)/RPB - (sb->ciutable_size);
21 printf("CIUT too small by %d blocks.\n", ciutshortage);
22 ret = corrupt;
25 if (sb->ciutable_size > (sb->dzone_size+RPB-1)/RPB) {
26 ciutexcess = (sb->ciutable_size) - (sb->dzone_size+RPB-1)/RPB;
27 printf("CIUT too big by %d blocks.\n", ciutexcess);
28 ret = weird;
31 return ret;