mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user