Table printing changed. directory parsing corrected.
[fsck.sofs09.git] / test_sbfctablesize.c
blob3914c64c845c622415ea8410fa1510f65dc4008d
1 #include <stdio.h>
3 #include "fsck.h"
4 #include "fsck_helper.h"
5 #include "sofs09.h"
7 testresult_t test_sbfctablesize (void)
9 testresult_t ret;
10 SOSuperBlock *sb;
11 int fctshortage, fctexcess;
13 fetch_superblock(&sb);
15 /* ceil(a/b) = (a + b - 1)/b */
17 ret = nice;
19 if (sb->fctable_size < ((sb->dzone_size-1)+RPB-1)/RPB) {
20 fctshortage = (sb->dzone_size+RPB-1)/RPB - (sb->fctable_size);
21 printf("FCT too small (even considering that the root directory block "
22 "will never be there) by %d blocks.\n", fctshortage);
23 ret = corrupt;
26 if (sb->fctable_size > (sb->dzone_size+RPB-1)/RPB) {
27 fctexcess = (sb->fctable_size) - (sb->dzone_size+RPB-1)/RPB;
28 printf("FCT too big by %d blocks.\n", fctexcess);
29 ret = weird;
32 return ret;