mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 11:09:05 +03:00
Kernel: Use u64 instead of size_t for BlockBasedFileSystem::write_block
This ensures offsets will not be truncated on large filesystems on i686
This commit is contained in:
parent
664ca58746
commit
0b2e93cf43
Notes:
sideshowbarker
2024-07-17 20:14:18 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/0b2e93cf43f Pull-request: https://github.com/SerenityOS/serenity/pull/12132 Reviewed-by: https://github.com/bgianfo ✅ Reviewed-by: https://github.com/tomuta ✅
@ -131,7 +131,7 @@ ErrorOr<void> BlockBasedFileSystem::initialize()
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> BlockBasedFileSystem::write_block(BlockIndex index, const UserOrKernelBuffer& data, size_t count, size_t offset, bool allow_cache)
|
ErrorOr<void> BlockBasedFileSystem::write_block(BlockIndex index, const UserOrKernelBuffer& data, size_t count, u64 offset, bool allow_cache)
|
||||||
{
|
{
|
||||||
VERIFY(m_logical_block_size);
|
VERIFY(m_logical_block_size);
|
||||||
VERIFY(offset + count <= block_size());
|
VERIFY(offset + count <= block_size());
|
||||||
@ -147,7 +147,7 @@ ErrorOr<void> BlockBasedFileSystem::write_block(BlockIndex index, const UserOrKe
|
|||||||
return m_cache.with_exclusive([&](auto& cache) -> ErrorOr<void> {
|
return m_cache.with_exclusive([&](auto& cache) -> ErrorOr<void> {
|
||||||
if (!allow_cache) {
|
if (!allow_cache) {
|
||||||
flush_specific_block_if_needed(index);
|
flush_specific_block_if_needed(index);
|
||||||
auto base_offset = index.value() * block_size() + offset;
|
u64 base_offset = index.value() * block_size() + offset;
|
||||||
auto nwritten = TRY(file_description().write(base_offset, data, count));
|
auto nwritten = TRY(file_description().write(base_offset, data, count));
|
||||||
VERIFY(nwritten == count);
|
VERIFY(nwritten == count);
|
||||||
return {};
|
return {};
|
||||||
|
@ -35,7 +35,7 @@ protected:
|
|||||||
ErrorOr<void> raw_read_blocks(BlockIndex index, size_t count, UserOrKernelBuffer&);
|
ErrorOr<void> raw_read_blocks(BlockIndex index, size_t count, UserOrKernelBuffer&);
|
||||||
ErrorOr<void> raw_write_blocks(BlockIndex index, size_t count, const UserOrKernelBuffer&);
|
ErrorOr<void> raw_write_blocks(BlockIndex index, size_t count, const UserOrKernelBuffer&);
|
||||||
|
|
||||||
ErrorOr<void> write_block(BlockIndex, const UserOrKernelBuffer&, size_t count, size_t offset = 0, bool allow_cache = true);
|
ErrorOr<void> write_block(BlockIndex, const UserOrKernelBuffer&, size_t count, u64 offset = 0, bool allow_cache = true);
|
||||||
ErrorOr<void> write_blocks(BlockIndex, unsigned count, const UserOrKernelBuffer&, bool allow_cache = true);
|
ErrorOr<void> write_blocks(BlockIndex, unsigned count, const UserOrKernelBuffer&, bool allow_cache = true);
|
||||||
|
|
||||||
u64 m_logical_block_size { 512 };
|
u64 m_logical_block_size { 512 };
|
||||||
|
Loading…
Reference in New Issue
Block a user