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/Memory/MemoryManager.cpp | |
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/Memory/MemoryManager.cpp')
-rw-r--r-- | Kernel/Memory/MemoryManager.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 377cea04ca..2a5afa3688 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -705,7 +705,7 @@ PageFaultResponse MemoryManager::handle_page_fault(PageFault const& fault) return region->handle_fault(fault); } -KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_contiguous_kernel_region(size_t size, StringView name, Region::Access access, Region::Cacheable cacheable) +ErrorOr<NonnullOwnPtr<Region>> MemoryManager::allocate_contiguous_kernel_region(size_t size, StringView name, Region::Access access, Region::Cacheable cacheable) { VERIFY(!(size % PAGE_SIZE)); SpinlockLocker lock(kernel_page_directory().get_lock()); @@ -714,7 +714,7 @@ KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_contiguous_kernel_regio return allocate_kernel_region_with_vmobject(range, move(vmobject), name, access, cacheable); } -KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region(size_t size, StringView name, Region::Access access, AllocationStrategy strategy, Region::Cacheable cacheable) +ErrorOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region(size_t size, StringView name, Region::Access access, AllocationStrategy strategy, Region::Cacheable cacheable) { VERIFY(!(size % PAGE_SIZE)); auto vmobject = TRY(AnonymousVMObject::try_create_with_size(size, strategy)); @@ -723,7 +723,7 @@ KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region(size_t si return allocate_kernel_region_with_vmobject(range, move(vmobject), name, access, cacheable); } -KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable) +ErrorOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region(PhysicalAddress paddr, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable) { VERIFY(!(size % PAGE_SIZE)); auto vmobject = TRY(AnonymousVMObject::try_create_for_physical_range(paddr, size)); @@ -732,7 +732,7 @@ KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region(PhysicalA return allocate_kernel_region_with_vmobject(range, move(vmobject), name, access, cacheable); } -KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region_with_vmobject(VirtualRange const& range, VMObject& vmobject, StringView name, Region::Access access, Region::Cacheable cacheable) +ErrorOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region_with_vmobject(VirtualRange const& range, VMObject& vmobject, StringView name, Region::Access access, Region::Cacheable cacheable) { OwnPtr<KString> name_kstring; if (!name.is_null()) @@ -742,7 +742,7 @@ KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region_with_vmob return region; } -KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region_with_vmobject(VMObject& vmobject, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable) +ErrorOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region_with_vmobject(VMObject& vmobject, size_t size, StringView name, Region::Access access, Region::Cacheable cacheable) { VERIFY(!(size % PAGE_SIZE)); SpinlockLocker lock(kernel_page_directory().get_lock()); @@ -750,7 +750,7 @@ KResultOr<NonnullOwnPtr<Region>> MemoryManager::allocate_kernel_region_with_vmob return allocate_kernel_region_with_vmobject(range, vmobject, name, access, cacheable); } -KResultOr<CommittedPhysicalPageSet> MemoryManager::commit_user_physical_pages(size_t page_count) +ErrorOr<CommittedPhysicalPageSet> MemoryManager::commit_user_physical_pages(size_t page_count) { VERIFY(page_count > 0); SpinlockLocker lock(s_mm_lock); |