mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 02:38:59 +00:00
Kernel/FATFS: Prefer read_block()
over raw_read()
`raw_read()` has proven to be a source of subtle bugs that occur as a result of the cache and disk contents being out of sync.
This commit is contained in:
parent
b1af97810e
commit
b9d7e2db93
Notes:
sideshowbarker
2024-07-19 01:59:31 +09:00
Author: https://github.com/implicitfield
Commit: b9d7e2db93
Pull-request: https://github.com/SerenityOS/serenity/pull/23907
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/cqundefine
Reviewed-by: https://github.com/nico
Reviewed-by: https://github.com/timschumi ✅
1 changed files with 2 additions and 2 deletions
|
@ -84,7 +84,7 @@ ErrorOr<Vector<BlockBasedFileSystem::BlockIndex>> FATInode::compute_block_list()
|
|||
u32 fat_sector_index = fs().m_parameter_block->common_bpb()->reserved_sector_count + (fat_offset / fs().m_device_block_size);
|
||||
u32 entry_offset = fat_offset % fs().m_device_block_size;
|
||||
|
||||
TRY(fs().raw_read(fat_sector_index, fat_sector_buffer));
|
||||
TRY(fs().read_block(fat_sector_index, &fat_sector_buffer, m_device_block_size));
|
||||
|
||||
// Look up the next cluster to read, or read End of Chain marker from table.
|
||||
cluster = cluster_number(*fat_sector, cluster, entry_offset);
|
||||
|
@ -191,7 +191,7 @@ ErrorOr<NonnullOwnPtr<KBuffer>> FATInode::read_block_list()
|
|||
|
||||
for (BlockBasedFileSystem::BlockIndex block : m_block_list) {
|
||||
dbgln_if(FAT_DEBUG, "FATFS: reading block: {}", block);
|
||||
TRY(fs().raw_read(block, buf));
|
||||
TRY(fs().read_block(block, &buf, sizeof(buffer)));
|
||||
TRY(builder.append((char const*)buffer, fs().m_device_block_size));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue