mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Kernel: Make FileSystem::initialize() return KResult
This forced me to also come up with error codes for a bunch of situations where we'd previously just panic the kernel.
This commit is contained in:
parent
46b93174fc
commit
d30d776ca4
Notes:
sideshowbarker
2024-07-18 06:57:23 +09:00
Author: https://github.com/awesomekling
Commit: d30d776ca4
21 changed files with 61 additions and 58 deletions
|
@ -114,26 +114,26 @@ BlockBasedFileSystem::~BlockBasedFileSystem()
|
|||
{
|
||||
}
|
||||
|
||||
bool BlockBasedFileSystem::initialize()
|
||||
KResult BlockBasedFileSystem::initialize()
|
||||
{
|
||||
VERIFY(block_size() != 0);
|
||||
auto cached_block_data = KBuffer::try_create_with_size(DiskCache::EntryCount * block_size());
|
||||
if (!cached_block_data)
|
||||
return false;
|
||||
return ENOMEM;
|
||||
|
||||
auto entries_data = KBuffer::try_create_with_size(DiskCache::EntryCount * sizeof(CacheEntry));
|
||||
if (!entries_data)
|
||||
return false;
|
||||
return ENOMEM;
|
||||
|
||||
auto disk_cache = adopt_own_if_nonnull(new (nothrow) DiskCache(*this, cached_block_data.release_nonnull(), entries_data.release_nonnull()));
|
||||
if (!disk_cache)
|
||||
return false;
|
||||
return ENOMEM;
|
||||
|
||||
m_cache.with_exclusive([&](auto& cache) {
|
||||
cache = move(disk_cache);
|
||||
});
|
||||
|
||||
return true;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult BlockBasedFileSystem::write_block(BlockIndex index, const UserOrKernelBuffer& data, size_t count, size_t offset, bool allow_cache)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue