From 79fa9765ca89869d19364143989436d117974c21 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 8 Nov 2021 00:51:39 +0100 Subject: Kernel: Replace KResult and KResultOr with Error and ErrorOr We now use AK::Error and AK::ErrorOr 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. :^) --- Kernel/Syscalls/read.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Kernel/Syscalls/read.cpp') diff --git a/Kernel/Syscalls/read.cpp b/Kernel/Syscalls/read.cpp index 444c3daa02..c3e8700aa7 100644 --- a/Kernel/Syscalls/read.cpp +++ b/Kernel/Syscalls/read.cpp @@ -12,7 +12,7 @@ namespace Kernel { using BlockFlags = Thread::FileBlocker::BlockFlags; -static KResultOr open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd) +static ErrorOr open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd) { auto description = TRY(fds.open_file_description(fd)); if (!description->is_readable()) @@ -22,7 +22,7 @@ static KResultOr open_readable_file_description(Process::O return description; } -static KResult check_blocked_read(OpenFileDescription* description) +static ErrorOr check_blocked_read(OpenFileDescription* description) { if (description->is_blocking()) { if (!description->can_read()) { @@ -34,10 +34,10 @@ static KResult check_blocked_read(OpenFileDescription* description) // TODO: handle exceptions in unblock_flags } } - return KSuccess; + return {}; } -KResultOr Process::sys$readv(int fd, Userspace iov, int iov_count) +ErrorOr Process::sys$readv(int fd, Userspace iov, int iov_count) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(stdio); @@ -74,7 +74,7 @@ KResultOr Process::sys$readv(int fd, Userspace iov return nread; } -KResultOr Process::sys$read(int fd, Userspace buffer, size_t size) +ErrorOr Process::sys$read(int fd, Userspace buffer, size_t size) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(stdio); @@ -91,7 +91,7 @@ KResultOr Process::sys$read(int fd, Userspace buffer, size_t size) return TRY(description->read(user_buffer.value(), size)); } -KResultOr Process::sys$pread(int fd, Userspace buffer, size_t size, off_t offset) +ErrorOr Process::sys$pread(int fd, Userspace buffer, size_t size, off_t offset) { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(stdio); -- cgit v1.2.3