-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuperblock.h
More file actions
40 lines (29 loc) · 1.11 KB
/
superblock.h
File metadata and controls
40 lines (29 loc) · 1.11 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
//
// Created by Сергей Ефимочкин on 18.04.2018.
//
#ifndef FS_SUPERBLOCK_H
#define FS_SUPERBLOCK_H
#include "inode.h"
#include "block.h"
struct superblock {
int number_of_blocks;
int number_of_inods;
int number_of_bytes_in_block;
int number_of_chars_in_index;
int number_of_free_blocks;
int number_of_free_inods;
void* inods_bitmap;
void* blocks_bitmap;
struct inode* inods_array;
struct block* blocks_array;
char* blocks_data_array;
};
struct inode * get_free_inode(struct superblock *sb);
struct block* get_free_block(struct superblock *sb);
struct block* get_n_continuous_free_blocks(struct superblock *sb, int number_of_blocks);
void free_inode(struct superblock *sb, struct inode* inode);
void free_block(struct superblock *sb, struct block* block);
void put_index_in_address_block(struct superblock *sb, char* address_block, unsigned int index);
struct inode* get_inode_by_index_in_address_block(struct superblock *sb, char* address_block);
struct block* get_block_by_index_in_address_block(struct superblock *sb, char* address_block);
#endif //FS_SUPERBLOCK_H