test_clusterfree refactored
[fsck.sofs09.git] / test_sbitotal.c
blob5342afbcfe3e75e4fe80e0a9aff2d56b6183146a
1 #include <stdio.h>
3 #include "sofs09.h"
4 #include "fsck.h"
5 #include "fsck_helper.h"
7 testresult_t test_sbitotal (void)
9 testresult_t ret;
10 SOSuperBlock *sb;
11 int itshortage, itexcess;
13 fetch_superblock(&sb);
15 /* ceil(a/b) = (a + b - 1)/b */
17 ret = nice;
18 if (sb->itable_size < (sb->itotal+IPB-1)/IPB) {
19 itshortage = (sb->itotal+IPB-1)/IPB - (sb->itable_size);
20 printf("Inode table too small by %d blocks.\n", itshortage);
21 ret = corrupt;
23 if (sb->itable_size > (sb->itotal+IPB-1)/IPB) {
24 itexcess = (sb->itable_size) - (sb->itotal+IPB-1)/IPB;
25 printf("Inode table too big by %d blocks.\n", itexcess);
26 ret = weird;
29 return ret;