diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-08 00:51:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-08 01:10:53 +0100 |
commit | 79fa9765ca89869d19364143989436d117974c21 (patch) | |
tree | 3af62f70127d9217d841047f6b7461351800d1ae /Kernel/KBuffer.h | |
parent | 7ee10c69264cb278845a1e1b06d5acf2e5e7ddf0 (diff) | |
download | serenity-79fa9765ca89869d19364143989436d117974c21.zip |
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. :^)
Diffstat (limited to 'Kernel/KBuffer.h')
-rw-r--r-- | Kernel/KBuffer.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/KBuffer.h b/Kernel/KBuffer.h index 2a56410178..0b4a699174 100644 --- a/Kernel/KBuffer.h +++ b/Kernel/KBuffer.h @@ -24,13 +24,13 @@ namespace Kernel { class [[nodiscard]] KBuffer { public: - static KResultOr<NonnullOwnPtr<KBuffer>> try_create_with_size(size_t size, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve) + static ErrorOr<NonnullOwnPtr<KBuffer>> try_create_with_size(size_t size, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve) { auto region = TRY(MM.allocate_kernel_region(Memory::page_round_up(size), name, access, strategy)); return TRY(adopt_nonnull_own_or_enomem(new (nothrow) KBuffer { size, move(region) })); } - static KResultOr<NonnullOwnPtr<KBuffer>> try_create_with_bytes(ReadonlyBytes bytes, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve) + static ErrorOr<NonnullOwnPtr<KBuffer>> try_create_with_bytes(ReadonlyBytes bytes, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve) { auto buffer = TRY(try_create_with_size(bytes.size(), access, name, strategy)); memcpy(buffer->data(), bytes.data(), bytes.size()); |