Minifilesystem is an file system API library that operates on virtual disks. It is based on FAT (File Allocation Table). Virtual Disk is a single real file.
- mini_fat_create: Uses fopen with "wb" parameter to create a binary file for both writing and reading mode[1]. fseek is used for creating the file in specified size[2].
- mini_fat_save: Saves all wanted information in a structred way.
- mini_fat_load: Assuming the saved structure, reads from saved file and load data
We also implemented helper functions
- mini_fat_find_empty_block: Iterates the block map to find block with empty type
- mini_fat_read_in_block: Using fseek function, it is pointed to starting position and reads to buffer from there to specific bytes [3].
- mini_fat_write_in_block: Using fseek function, it is pointed to starting position and writes into buffer from there
- mini_file_open: Does checks for conditions that are required for opening a file. If they are satisfied, it creates a new open file with starting position 0 and other given parameters. Appends open handles.
- mini_file_write: Does neccesary checks for writing. Uses mini_fat_write_in_block from disk manipulation to write.
- mini_file_read: Does neccesary checks for reading. Uses mini_fat_read_in_block from disk manipulation to read.
Our implementation follows the explanations from project PDF. Our approach was inspecting the completed parts and understanding the logic behind a virtual filesystem to complete implementation. It passes all test cases and it satisfies all wanted properties. Therefore, it runs without a problem.
[1] https://www.ibm.com/docs/en/i/7.1?topic=functions-fopen-open-files