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

Kernel: Make VirtualRangeAllocator return KResultOr<VirtualRange>

This achieves two things:
- The allocator can report more specific errors
- Callers can (and now do) use TRY() :^)
This commit is contained in:
Andreas Kling 2021-09-05 23:12:16 +02:00
parent 21f7932ae2
commit f4a9a0d561
9 changed files with 82 additions and 95 deletions

View file

@ -21,9 +21,9 @@ public:
void initialize_with_range(VirtualAddress, size_t);
void initialize_from_parent(VirtualRangeAllocator const&);
Optional<VirtualRange> allocate_anywhere(size_t, size_t alignment = PAGE_SIZE);
Optional<VirtualRange> allocate_specific(VirtualAddress, size_t);
Optional<VirtualRange> allocate_randomized(size_t, size_t alignment);
KResultOr<VirtualRange> try_allocate_anywhere(size_t, size_t alignment = PAGE_SIZE);
KResultOr<VirtualRange> try_allocate_specific(VirtualAddress, size_t);
KResultOr<VirtualRange> try_allocate_randomized(size_t, size_t alignment);
void deallocate(VirtualRange const&);
void dump() const;