mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
Kernel: Use u64 instead of size_t for BlockBasedFileSystem::read_block
This ensures offsets will not be truncated on large filesystems on i686
This commit is contained in:
parent
0b2e93cf43
commit
2065a73727
2 changed files with 3 additions and 3 deletions
|
@ -212,7 +212,7 @@ ErrorOr<void> BlockBasedFileSystem::write_blocks(BlockIndex index, unsigned coun
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> BlockBasedFileSystem::read_block(BlockIndex index, UserOrKernelBuffer* buffer, size_t count, size_t offset, bool allow_cache) const
|
ErrorOr<void> BlockBasedFileSystem::read_block(BlockIndex index, UserOrKernelBuffer* buffer, size_t count, u64 offset, bool allow_cache) const
|
||||||
{
|
{
|
||||||
VERIFY(m_logical_block_size);
|
VERIFY(m_logical_block_size);
|
||||||
VERIFY(offset + count <= block_size());
|
VERIFY(offset + count <= block_size());
|
||||||
|
@ -221,7 +221,7 @@ ErrorOr<void> BlockBasedFileSystem::read_block(BlockIndex index, UserOrKernelBuf
|
||||||
return m_cache.with_exclusive([&](auto& cache) -> ErrorOr<void> {
|
return m_cache.with_exclusive([&](auto& cache) -> ErrorOr<void> {
|
||||||
if (!allow_cache) {
|
if (!allow_cache) {
|
||||||
const_cast<BlockBasedFileSystem*>(this)->flush_specific_block_if_needed(index);
|
const_cast<BlockBasedFileSystem*>(this)->flush_specific_block_if_needed(index);
|
||||||
auto base_offset = index.value() * block_size() + offset;
|
u64 base_offset = index.value() * block_size() + offset;
|
||||||
auto nread = TRY(file_description().read(*buffer, base_offset, count));
|
auto nread = TRY(file_description().read(*buffer, base_offset, count));
|
||||||
VERIFY(nread == count);
|
VERIFY(nread == count);
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
explicit BlockBasedFileSystem(OpenFileDescription&);
|
explicit BlockBasedFileSystem(OpenFileDescription&);
|
||||||
|
|
||||||
ErrorOr<void> read_block(BlockIndex, UserOrKernelBuffer*, size_t count, size_t offset = 0, bool allow_cache = true) const;
|
ErrorOr<void> read_block(BlockIndex, UserOrKernelBuffer*, size_t count, u64 offset = 0, bool allow_cache = true) const;
|
||||||
ErrorOr<void> read_blocks(BlockIndex, unsigned count, UserOrKernelBuffer&, bool allow_cache = true) const;
|
ErrorOr<void> read_blocks(BlockIndex, unsigned count, UserOrKernelBuffer&, bool allow_cache = true) const;
|
||||||
|
|
||||||
ErrorOr<void> raw_read(BlockIndex, UserOrKernelBuffer&);
|
ErrorOr<void> raw_read(BlockIndex, UserOrKernelBuffer&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue