![]() |
Max OS 0.3
|
Handles the FAT table that stores the information about the files on the disk and operations on the disk. More...
#include <fat32.h>
Public Member Functions | |
| Fat32Volume (drivers::disk::Disk *disk, lba_t partition_offset) | |
| Construct a new Fat32 Volume object. | |
| uint32_t | next_cluster (uint32_t cluster) const |
| Take the cluster and gets the next cluster in the chain. | |
| uint32_t | set_next_cluster (uint32_t cluster, uint32_t next_cluster) const |
| Sets the next cluster in the chain (where the base cluster should point) | |
| uint32_t | find_free_cluster () const |
| Searches the fat table for a free cluster starting from the first free cluster in the fsinfo, will then wrap around. | |
| uint32_t | allocate_cluster (uint32_t cluster) |
| Allocate a cluster in the FAT table. | |
| uint32_t | allocate_cluster (uint32_t cluster, size_t amount) |
| Allocate a number of clusters in the FAT table, updates the fsinfo and the chain. | |
| void | free_cluster (uint32_t cluster) |
| Free a cluster in the FAT table. | |
| void | free_cluster (uint32_t cluster, size_t amount) |
| Free a number of clusters in the FAT table. | |
Public Attributes | |
| bpb32_t | bpb = { } |
| The BIOS Parameter Block for the FAT32 volume. | |
| fs_info_t | fsinfo = { } |
| The FSInfo structure for the FAT32 volume. | |
| size_t | fat_total_clusters |
| How many clusters are in the FAT table. | |
| lba_t | fat_lba |
| The starting LBA of the FAT table. | |
| lba_t | fat_info_lba |
| The LBA of the FSInfo structure. | |
| lba_t | fat_copies |
| How many FAT tables are present. | |
| lba_t | data_lba |
| The starting LBA of the data region. | |
| lba_t | root_lba |
| The starting LBA of the root directory. | |
| drivers::disk::Disk * | disk |
| The disk that this volume is on. | |
Handles the FAT table that stores the information about the files on the disk and operations on the disk.
| Fat32Volume::Fat32Volume | ( | drivers::disk::Disk * | disk, |
| lba_t | partition_offset | ||
| ) |
Construct a new Fat32 Volume object.
| disk | The disk to read from |
| partition_offset | The offset of the partition on the disk |
Definition at line 26 of file fat32.cpp.
References bpb, data_lba, disk, MaxOS::Logger::ERROR(), fat_copies, fat_info_lba, fat_lba, fat_total_clusters, fsinfo, MaxOS::drivers::disk::Disk::read(), and root_lba.
Allocate a cluster in the FAT table.
| cluster | The base cluster to start from or 0 if this is a new chain |
Definition at line 141 of file fat32.cpp.
References allocate_cluster().
Referenced by allocate_cluster(), and MaxOS::filesystem::format::Fat32File::write().
Allocate a number of clusters in the FAT table, updates the fsinfo and the chain.
| cluster | The base cluster to start from or 0 if this is a new chain |
| amount | The number of clusters to allocate |
Definition at line 154 of file fat32.cpp.
References disk, fat_info_lba, fat_total_clusters, find_free_cluster(), fsinfo, next_cluster(), set_next_cluster(), and MaxOS::drivers::disk::Disk::write().
| uint32_t Fat32Volume::find_free_cluster | ( | ) | const |
Searches the fat table for a free cluster starting from the first free cluster in the fsinfo, will then wrap around.
Definition at line 119 of file fat32.cpp.
References ASSERT, fat_total_clusters, fsinfo, and next_cluster().
Referenced by allocate_cluster().
Free a cluster in the FAT table.
| cluster | The base cluster to start from |
Definition at line 189 of file fat32.cpp.
References free_cluster().
Referenced by free_cluster().
Free a number of clusters in the FAT table.
| cluster | The base cluster to start from |
| amount | The number of clusters to free |
Definition at line 202 of file fat32.cpp.
References disk, fat_info_lba, fat_total_clusters, fsinfo, next_cluster(), set_next_cluster(), and MaxOS::drivers::disk::Disk::write().
Take the cluster and gets the next cluster in the chain.
| cluster | The base cluster to start from |
Definition at line 65 of file fat32.cpp.
References bpb, disk, fat_lba, and MaxOS::drivers::disk::Disk::read().
Referenced by allocate_cluster(), find_free_cluster(), free_cluster(), MaxOS::filesystem::format::Fat32File::read(), set_next_cluster(), MaxOS::filesystem::format::Fat32Directory::update_entry_on_disk(), and MaxOS::filesystem::format::Fat32File::write().
Sets the next cluster in the chain (where the base cluster should point)
| cluster | The base cluster to start from |
| next_cluster | The next cluster in the chain |
Definition at line 90 of file fat32.cpp.
References bpb, disk, fat_copies, fat_lba, next_cluster(), MaxOS::drivers::disk::Disk::read(), and MaxOS::drivers::disk::Disk::write().
Referenced by allocate_cluster(), and free_cluster().
| bpb32_t MaxOS::filesystem::format::Fat32Volume::bpb = { } |
The BIOS Parameter Block for the FAT32 volume.
Definition at line 176 of file fat32.h.
Referenced by MaxOS::filesystem::format::Fat32FileSystem::Fat32FileSystem(), Fat32Volume(), next_cluster(), MaxOS::filesystem::format::Fat32File::read(), set_next_cluster(), MaxOS::filesystem::format::Fat32Directory::update_entry_on_disk(), and MaxOS::filesystem::format::Fat32File::write().
| lba_t MaxOS::filesystem::format::Fat32Volume::data_lba |
The starting LBA of the data region.
Definition at line 184 of file fat32.h.
Referenced by Fat32Volume(), MaxOS::filesystem::format::Fat32File::read(), MaxOS::filesystem::format::Fat32Directory::update_entry_on_disk(), and MaxOS::filesystem::format::Fat32File::write().
| drivers::disk::Disk* MaxOS::filesystem::format::Fat32Volume::disk |
The disk that this volume is on.
Definition at line 187 of file fat32.h.
Referenced by allocate_cluster(), Fat32Volume(), free_cluster(), next_cluster(), MaxOS::filesystem::format::Fat32File::read(), set_next_cluster(), MaxOS::filesystem::format::Fat32Directory::update_entry_on_disk(), and MaxOS::filesystem::format::Fat32File::write().
| lba_t MaxOS::filesystem::format::Fat32Volume::fat_copies |
How many FAT tables are present.
Definition at line 182 of file fat32.h.
Referenced by Fat32Volume(), and set_next_cluster().
| lba_t MaxOS::filesystem::format::Fat32Volume::fat_info_lba |
The LBA of the FSInfo structure.
Definition at line 181 of file fat32.h.
Referenced by allocate_cluster(), Fat32Volume(), and free_cluster().
| lba_t MaxOS::filesystem::format::Fat32Volume::fat_lba |
The starting LBA of the FAT table.
Definition at line 180 of file fat32.h.
Referenced by Fat32Volume(), next_cluster(), and set_next_cluster().
| size_t MaxOS::filesystem::format::Fat32Volume::fat_total_clusters |
How many clusters are in the FAT table.
Definition at line 179 of file fat32.h.
Referenced by allocate_cluster(), Fat32Volume(), find_free_cluster(), and free_cluster().
| fs_info_t MaxOS::filesystem::format::Fat32Volume::fsinfo = { } |
The FSInfo structure for the FAT32 volume.
Definition at line 177 of file fat32.h.
Referenced by allocate_cluster(), Fat32Volume(), find_free_cluster(), and free_cluster().
| lba_t MaxOS::filesystem::format::Fat32Volume::root_lba |
The starting LBA of the root directory.
Definition at line 185 of file fat32.h.
Referenced by Fat32Volume().