mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 22:27:44 +00:00
Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
This commit is contained in:
parent
7ee10c6926
commit
79fa9765ca
262 changed files with 2415 additions and 2600 deletions
|
@ -24,7 +24,7 @@ static void update_intermediate_node_permissions(UnveilNode& root_node, UnveilAc
|
|||
}
|
||||
}
|
||||
|
||||
KResultOr<FlatPtr> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> user_params)
|
||||
ErrorOr<FlatPtr> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> user_params)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||
auto params = TRY(copy_typed_from_user(user_params));
|
||||
|
@ -84,12 +84,12 @@ KResultOr<FlatPtr> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params
|
|||
auto custody_or_error = VirtualFileSystem::the().resolve_path_without_veil(path->view(), VirtualFileSystem::the().root_custody(), &parent_custody);
|
||||
if (!custody_or_error.is_error()) {
|
||||
new_unveiled_path = TRY(custody_or_error.value()->try_serialize_absolute_path());
|
||||
} else if (custody_or_error.error() == ENOENT && parent_custody && (new_permissions & UnveilAccess::CreateOrRemove)) {
|
||||
} else if (custody_or_error.error().code() == ENOENT && parent_custody && (new_permissions & UnveilAccess::CreateOrRemove)) {
|
||||
auto parent_custody_path = TRY(parent_custody->try_serialize_absolute_path());
|
||||
new_unveiled_path = TRY(KLexicalPath::try_join(parent_custody_path->view(), KLexicalPath::basename(path->view())));
|
||||
} else {
|
||||
// FIXME Should this be EINVAL?
|
||||
return custody_or_error.error();
|
||||
return custody_or_error.release_error();
|
||||
}
|
||||
|
||||
auto path_parts = KLexicalPath::parts(new_unveiled_path->view());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue