1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +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

@ -512,7 +512,7 @@ private:
Process(RefPtr<Thread>& first_thread, const String& name, uid_t, gid_t, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
static ProcessID allocate_pid();
Range allocate_range(VirtualAddress, size_t, size_t alignment = PAGE_SIZE);
Optional<Range> allocate_range(VirtualAddress, size_t, size_t alignment = PAGE_SIZE);
Region& add_region(NonnullOwnPtr<Region>);
@ -614,7 +614,7 @@ private:
NonnullOwnPtrVector<Region> m_regions;
struct RegionLookupCache {
Range range;
Optional<Range> range;
WeakPtr<Region> region;
};
RegionLookupCache m_region_lookup_cache;