mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:55:08 +00:00
Kernel: Change Inode::{read/write}_bytes interface to KResultOr<ssize_t>
The error handling in all these cases was still using the old style negative values to indicate errors. We have a nicer solution for this now with KResultOr<T>. This change switches the interface and then all implementers to use the new style.
This commit is contained in:
parent
de9b454f89
commit
234c6ae32d
18 changed files with 88 additions and 82 deletions
|
@ -710,9 +710,9 @@ KResult VFS::symlink(StringView target, StringView linkpath, Custody& base)
|
|||
return inode_or_error.error();
|
||||
auto& inode = inode_or_error.value();
|
||||
auto target_buffer = UserOrKernelBuffer::for_kernel_buffer(const_cast<u8*>((const u8*)target.characters_without_null_termination()));
|
||||
ssize_t nwritten = inode->write_bytes(0, target.length(), target_buffer, nullptr);
|
||||
if (nwritten < 0)
|
||||
return KResult((ErrnoCode)-nwritten);
|
||||
auto result = inode->write_bytes(0, target.length(), target_buffer, nullptr);
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue