Implemented changes proposed by the teacher.
[fsck.sofs09.git] / fsck_helper.h
blobb3f1ab7d45fe29e37e269a0252555a7f2fddea2b
1 #ifndef _FSCK_HELPER_
2 #define _FSCK_HELPER_
4 #include "stdlib.h"
5 #include "sofs_superblock.h"
7 /* usefull macro and function */
9 void printError (int errcode, char *cmd_name);
11 #define ABORT(err) \
13 printError(-(err), argv[0]);\
14 exit(EXIT_FAILURE);\
17 #define FABORT(err, fname) \
19 printError(-(err), fname);\
20 exit(EXIT_FAILURE);\
23 typedef enum{idle, busy, bah} ic_t;
24 /* C is stupid */
25 //typedef enum{idle, busy, bah} cc_t;
26 typedef ic_t cc_t;
28 void fetch_superblock(SOSuperBlock **sb);
30 /* inode control table */
31 /* index < itotal */
32 void ictable_create(void);
33 void ictable_free(void);
34 void ictable_set(uint32_t index, ic_t value);
35 void ictable_get(uint32_t index, ic_t *value);
37 /* cluster control table */
38 /* index < dzone_size */
39 void cctable_create(void);
40 void cctable_free(void);
41 void cctable_set(uint32_t index, cc_t value);
42 void cctable_get(uint32_t index, cc_t *value);
43 void cctable_print(void);
45 /* inode refcount table */
46 /* index < itotal */
47 void irtable_create(void);
48 void irtable_free(void);
49 void irtable_inc(uint32_t index);
50 void irtable_get(uint32_t index, uint32_t *value);
52 void itable_print(void);
54 #endif /* _FSCK_HELPER_ */