mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-11 21:52:53 +00:00
Kernel+LibC: Turn errno codes into a strongly typed enum
..and allow implicit creation of KResult and KResultOr from ErrnoCode. This means that kernel functions that return those types can finally do "return EINVAL;" and it will just work. There's a handful of functions that still deal with signed integers that should be converted to return KResults.
This commit is contained in:
parent
e279b45aed
commit
19d3f8cab7
Notes:
sideshowbarker
2024-07-18 23:01:53 +09:00
Author: https://github.com/awesomekling
Commit: 19d3f8cab7
48 changed files with 591 additions and 506 deletions
Kernel/FileSystem
|
@ -169,7 +169,7 @@ KResult BlockBasedFS::write_block(unsigned index, const UserOrKernelBuffer& data
|
|||
return result;
|
||||
}
|
||||
if (!data.read(entry.data + offset, count))
|
||||
return KResult(-EFAULT);
|
||||
return EFAULT;
|
||||
|
||||
cache().mark_dirty(entry);
|
||||
entry.has_data = true;
|
||||
|
@ -261,7 +261,7 @@ KResult BlockBasedFS::read_block(unsigned index, UserOrKernelBuffer* buffer, siz
|
|||
entry.has_data = true;
|
||||
}
|
||||
if (buffer && !buffer->write(entry.data + offset, count))
|
||||
return KResult(-EFAULT);
|
||||
return EFAULT;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ KResult BlockBasedFS::read_blocks(unsigned index, unsigned count, UserOrKernelBu
|
|||
{
|
||||
ASSERT(m_logical_block_size);
|
||||
if (!count)
|
||||
return KResult(-EINVAL);
|
||||
return EINVAL;
|
||||
if (count == 1)
|
||||
return read_block(index, &buffer, block_size(), 0, allow_cache);
|
||||
auto out = buffer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue