1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

Kernel: Make Memory::Region allocation functions return KResultOr

This makes for some nicer handling of errors compared to checking an
OwnPtr for null state.
This commit is contained in:
sin-ack 2021-08-15 10:11:05 +00:00 committed by Andreas Kling
parent 4bfd6e41b9
commit 0a18425cbb
5 changed files with 45 additions and 38 deletions

View file

@ -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
{