mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:15:07 +00:00
Kernel: Make UserOrKernelBuffer return KResult from read/write/memset
This allows us to simplify a whole bunch of call sites with TRY(). :^)
This commit is contained in:
parent
7bf8844499
commit
b481132418
29 changed files with 85 additions and 118 deletions
|
@ -138,8 +138,7 @@ KResultOr<size_t> TmpFSInode::read_bytes(off_t offset, size_t size, UserOrKernel
|
|||
if (static_cast<off_t>(size) > m_metadata.size - offset)
|
||||
size = m_metadata.size - offset;
|
||||
|
||||
if (!buffer.write(m_content->data() + offset, size))
|
||||
return EFAULT;
|
||||
TRY(buffer.write(m_content->data() + offset, size));
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -182,8 +181,7 @@ KResultOr<size_t> TmpFSInode::write_bytes(off_t offset, size_t size, const UserO
|
|||
notify_watchers();
|
||||
}
|
||||
|
||||
if (!buffer.read(m_content->data() + offset, size)) // TODO: partial reads?
|
||||
return EFAULT;
|
||||
TRY(buffer.read(m_content->data() + offset, size)); // TODO: partial reads?
|
||||
|
||||
did_modify_contents();
|
||||
return size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue