-
Notifications
You must be signed in to change notification settings - Fork 2
/
super.h
executable file
·51 lines (39 loc) · 1.39 KB
/
super.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _SUPER_H
#define _SUPER_H
#include <stdio.h>
#include "testfs.h"
#include "tx.h"
#define MAX_STORAGE BLOCK_SIZE*1024
struct hlist_head;
struct dsuper_block {
int inode_freemap_start;
int block_freemap_start;
int csum_table_start;
int inode_blocks_start;
int data_blocks_start;
int modification_time;
};
struct super_block {
struct dsuper_block sb;
struct bitmap *inode_freemap;
struct bitmap *block_freemap;
tx_type tx_in_progress;
// TODO: add your code here
int *csum_table;
struct hlist_head *inode_hash_table;
char *storage;
};
struct super_block *testfs_make_super_block(char* storage);
void testfs_make_inode_freemap(struct super_block *sb);
void testfs_make_block_freemap(struct super_block *sb);
void testfs_make_csum_table(struct super_block *sb);
void testfs_make_inode_blocks(struct super_block *sb);
int testfs_init_super_block(const char *storage, int corrupt,
struct super_block **sbp);
void testfs_write_super_block(struct super_block *sb);
void testfs_close_super_block(struct super_block *sb);
int testfs_get_inode_freemap(struct super_block *sb);
void testfs_put_inode_freemap(struct super_block *sb, int inode_nr);
int testfs_alloc_block(struct super_block *sb, char *block);
int testfs_free_block(struct super_block *sb, int block_nr);
#endif /* _SUPER_H */