forked from jacksun007/testfs
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsuper.h
More file actions
executable file
·47 lines (37 loc) · 1.32 KB
/
super.h
File metadata and controls
executable file
·47 lines (37 loc) · 1.32 KB
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
#ifndef _SUPER_H
#define _SUPER_H
#include <stdio.h>
#include "tx.h"
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;
int dev_fd;
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;
};
struct super_block *testfs_make_super_block(char *file);
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 *file, 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 */