1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:57:46 +00:00

Kernel: Remove Range "valid" state and use Optional<Range> instead

It's easier to understand VM ranges if they are always valid. We can
simply use an empty Optional<Range> to encode absence when needed.
This commit is contained in:
Andreas Kling 2021-01-27 21:01:45 +01:00
parent 67bc5e0bbd
commit e67402c702
8 changed files with 39 additions and 37 deletions

View file

@ -38,7 +38,7 @@ class Range {
friend class RangeAllocator;
public:
Range() { }
Range() = delete;
Range(VirtualAddress base, size_t size)
: m_base(base)
, m_size(size)
@ -85,9 +85,9 @@ public:
void initialize_with_range(VirtualAddress, size_t);
void initialize_from_parent(const RangeAllocator&);
Range allocate_anywhere(size_t, size_t alignment = PAGE_SIZE);
Range allocate_specific(VirtualAddress, size_t);
void deallocate(Range);
Optional<Range> allocate_anywhere(size_t, size_t alignment = PAGE_SIZE);
Optional<Range> allocate_specific(VirtualAddress, size_t);
void deallocate(const Range&);
void dump() const;