mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-09 12:31:06 -04:00
Write the directory cluster back to the disk
This commit is contained in:
parent
970796ed6b
commit
4b1656aa37
@ -58,6 +58,7 @@ const char* disk_type_to_string(disk_type type);
|
||||
const char* partition_type_to_string(partition_type type);
|
||||
|
||||
bool read_sectors(const disk_descriptor& disk, uint64_t start, uint8_t count, void* destination);
|
||||
bool write_sectors(const disk_descriptor& disk, uint64_t start, uint8_t count, void* destination);
|
||||
std::unique_heap_array<partition_descriptor> partitions(const disk_descriptor& disk);
|
||||
bool partition_exists(const disk_descriptor& disk, uint64_t uuid);
|
||||
|
||||
|
@ -122,6 +122,16 @@ bool disks::read_sectors(const disk_descriptor& disk, uint64_t start, uint8_t co
|
||||
}
|
||||
}
|
||||
|
||||
bool disks::write_sectors(const disk_descriptor& disk, uint64_t start, uint8_t count, void* destination){
|
||||
switch(disk.type){
|
||||
case disk_type::ATA:
|
||||
return ata::write_sectors(*static_cast<ata::drive_descriptor*>(disk.descriptor), start, count, destination);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_heap_array<disks::partition_descriptor> disks::partitions(const disk_descriptor& disk){
|
||||
std::unique_ptr<boot_record_t> boot_record(new boot_record_t());
|
||||
|
||||
|
@ -515,7 +515,11 @@ bool fat32::mkdir(dd disk, const disks::partition_descriptor& partition, const s
|
||||
new_directory_entry.cluster_high = 0;
|
||||
new_directory_entry.cluster_low = 0;
|
||||
|
||||
//TODO Write the sector to the disk
|
||||
if(!write_sectors(disk, cluster_lba(cluster_number.second), fat_bs->sectors_per_cluster, directory_cluster.get())){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user