-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
39 lines (36 loc) · 878 Bytes
/
Copy pathmain.h
File metadata and controls
39 lines (36 loc) · 878 Bytes
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
//
// Created by jade on 6/6/22.
//
#ifndef FILE_SYSTEM_MAIN_H
#define FILE_SYSTEM_MAIN_H
//meta information about the filesystem
//number of inodes
//number of disk blocks
//size of the disk blocks
#define BLOCKSIZE 512
struct superblock{
int numInodes;
int numBlocks;
int sizeOfBlocks;
};
struct inode{
int size;
char name[8];
int firstBlock;
};
struct block{
int nextBlockNumber;
char data[BLOCKSIZE];
};
void createFileSystem(); //Initializing the new file system
void mountFileSystem(); //Load the file system
void syncFileSystem(); //Write the file system
void printFileSystem();
// returns filenumber
int allocate_file (char name[8]);
void set_filesize (int filenum, int size);
void write_data (int filenum, int pos, char *data);
int find_empty_inode();
int find_empty_block();
void shortenFile (int bn);
#endif //FILE_SYSTEM_MAIN_H