# Fat32FileSystem_2022 **Repository Path**: bessiechen2022/fat32-file-system_2022 ## Basic Information - **Project Name**: Fat32FileSystem_2022 - **Description**: This is a FAT32 file system developed on the Windows platform, it is implemented layer by layer from the bottom up: driver layer, partition and FAT32 parsing, file operations and buffer management. - **Primary Language**: C - **License**: OSL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2022-06-09 - **Last Updated**: 2023-06-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Fat32FileSystem This project is an implementation of the FAT32 file system, mainly divided into the following parts: driver layer, partition parsing, FAT32 parsing, file operations, partition mounting and formatting, and buffer management. ### Driver Layer The driver layer includes virtual disks, driver framework, and encapsulated driver interfaces to achieve communication with the underlying hardware. ### Partition Parsing The partition parsing part is mainly used to handle the number of primary and extended partitions and to parse the relevant information of the partitions. #### Structure ![输入图片说明](output/img/Partition%20Parsing.png) #### Output Parse partition information and load fat32 info ![输入图片说明](output/img/0.%20Parse%20partition%20information.png) ![输入图片说明](output/img/0.%20Parse%20partition%20information2.png) ![输入图片说明](output/img/1.%20load%20fat32%20info.png)) ### FAT32 Parsing The FAT32 parsing part is responsible for loading FAT32 information, establishing the XFAT structure, parsing the root directory and subsequent clusters of the root directory, and printing the file contents. #### Structure ![输入图片说明](output/img/FAT32%20Parsing.png) ![输入图片说明](output/img/FAT32%20Parsing2.png) ![输入图片说明](output/img/FAT32%20Parsing3.png) #### Output xfat struct: ![输入图片说明](output/img/2.%20xfat%20struct.png) parse root directory: ![输入图片说明](output/img/3.%20parse%20root%20directory.png) print info from clusters: ![输入图片说明](output/img/4.%20print%20out%20info%20from%20multiple%20cluster.png) print content of file: ![输入图片说明](output/img/5.%20print%20out%20content%20of%20file.png) ### File Operations In the file operations part, this project provides the functions of opening the root directory, sub-files, and implementing the 8+3 short file format. At the same time, the project implements the functions of root directory file traversal, filtering specific types of directory entries, opening and operating subdirectories, etc. In addition, it also provides functions such as reading data from files, positioning, modifying names and times, and writing data to files. This project also implements file creation, directory creation, file deletion, empty directory deletion, non-empty directory deletion, and setting file size operations. #### Structure ![输入图片说明](output/img/File%20Operations.png) #### Output open the sub-file: ![输入图片说明](output/img/6.%20open%20the%20sub-file.png) open sub-directory recursively: ![输入图片说明](output/img/7.%20open%20sub-directory%20recursively.png) modify file name: ![输入图片说明](output/img/8.%20modify%20file%20name.png) modify file time: ![输入图片说明](output/img/8.%20modify%20file%20time.png) expand and rewrite the file: ![输入图片说明](output/img/9.%20expand%20the%20file%20and%20write.png) create file: ![输入图片说明](output/img/10.%20create%20file.png) delete directory: ![输入图片说明](output/img/11.%20delete%20directory.png) ### Partition Mounting and Formatting The partition mounting and formatting part is mainly used to implement multi-partition link management and partition mounting. This project can realize the formatting of the FAT32 file system through steps such as writing a template DBR, replacing part of the template DBR content, customizing the writing of DBR, initializing the FAT table, creating a root directory, initializing the FSINFO area, and setting the type in the partition table. ### Buffer Management Buffer management part includes buffer, defining cache block structure, adding xfat_obj structure, adding cache pool, reading and writing cache pool, disk layer cache management, FAT layer and file layer cache management, continuous reading and writing cache management, xfile and xfat cache management, etc. In addition, it also provides operations such as reading and writing the Fsinfo area, using cache to query free clusters, and using cache to expand and reclaim cluster chains.