summaryrefslogtreecommitdiff
path: root/Kernel/Memory/Region.h
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2021-08-15 10:11:05 +0000
committerAndreas Kling <kling@serenityos.org>2021-08-15 15:41:02 +0200
commit0a18425cbb8ac027fa378ff72d60e5a21573b814 (patch)
treed71cbe15837e6957689ced733704468404330b36 /Kernel/Memory/Region.h
parent4bfd6e41b952c2583c6941e58dea3e5cc032b9f3 (diff)
downloadserenity-0a18425cbb8ac027fa378ff72d60e5a21573b814.zip
Kernel: Make Memory::Region allocation functions return KResultOr
This makes for some nicer handling of errors compared to checking an OwnPtr for null state.
Diffstat (limited to 'Kernel/Memory/Region.h')
-rw-r--r--Kernel/Memory/Region.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Memory/Region.h b/Kernel/Memory/Region.h
index 94d777ff2e..5f3c760234 100644
--- a/Kernel/Memory/Region.h
+++ b/Kernel/Memory/Region.h
@@ -49,8 +49,8 @@ public:
Yes,
};
- static OwnPtr<Region> try_create_user_accessible(VirtualRange const&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, OwnPtr<KString> name, Region::Access access, Cacheable, bool shared);
- static OwnPtr<Region> try_create_kernel_only(VirtualRange const&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, OwnPtr<KString> name, Region::Access access, Cacheable = Cacheable::Yes);
+ static KResultOr<NonnullOwnPtr<Region>> try_create_user_accessible(VirtualRange const&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, OwnPtr<KString> name, Region::Access access, Cacheable, bool shared);
+ static KResultOr<NonnullOwnPtr<Region>> try_create_kernel_only(VirtualRange const&, NonnullRefPtr<VMObject>, size_t offset_in_vmobject, OwnPtr<KString> name, Region::Access access, Cacheable = Cacheable::Yes);
~Region();
@@ -90,7 +90,7 @@ public:
PageFaultResponse handle_fault(PageFault const&);
- OwnPtr<Region> clone();
+ KResultOr<NonnullOwnPtr<Region>> try_clone();
bool contains(VirtualAddress vaddr) const
{