From 47bdd7c3a01b7e21e56a5d1dd40b18e9ed43f466 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 6 Aug 2021 21:45:05 +0200 Subject: [PATCH] Kernel: Rename a very long enum to ShouldDeallocateVirtualRange ShouldDeallocateVirtualMemoryVirtualRange was a bit on the long side. --- Kernel/Interrupts/APIC.cpp | 2 +- Kernel/Memory/AddressSpace.cpp | 4 ++-- Kernel/Memory/Region.cpp | 6 +++--- Kernel/Memory/Region.h | 4 ++-- Kernel/Syscalls/mmap.cpp | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Kernel/Interrupts/APIC.cpp b/Kernel/Interrupts/APIC.cpp index a2bfa0dd8e..ab8722ac2b 100644 --- a/Kernel/Interrupts/APIC.cpp +++ b/Kernel/Interrupts/APIC.cpp @@ -379,7 +379,7 @@ UNMAP_AFTER_INIT void APIC::do_boot_aps() // NOTE: Since this region is identity-mapped, we have to unmap it manually to prevent the virtual // address range from leaking into the general virtual range allocator. - apic_startup_region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No); + apic_startup_region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); } UNMAP_AFTER_INIT void APIC::boot_aps() diff --git a/Kernel/Memory/AddressSpace.cpp b/Kernel/Memory/AddressSpace.cpp index 1f939e30d3..2b4f92066e 100644 --- a/Kernel/Memory/AddressSpace.cpp +++ b/Kernel/Memory/AddressSpace.cpp @@ -69,7 +69,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size) auto region = take_region(*old_region); // We manually unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Region::ShouldDeallocateVirtualMemoryVirtualRange::No); + region->unmap(Region::ShouldDeallocateVirtualRange::No); auto new_regions_or_error = try_split_region_around_range(*region, range_to_unmap); if (new_regions_or_error.is_error()) @@ -115,7 +115,7 @@ KResult AddressSpace::unmap_mmap_range(VirtualAddress addr, size_t size) auto region = take_region(*old_region); // We manually unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Region::ShouldDeallocateVirtualMemoryVirtualRange::No); + region->unmap(Region::ShouldDeallocateVirtualRange::No); // Otherwise, split the regions and collect them for future mapping. auto split_regions_or_error = try_split_region_around_range(*region, range_to_unmap); diff --git a/Kernel/Memory/Region.cpp b/Kernel/Memory/Region.cpp index a5b5758b94..3a328c2205 100644 --- a/Kernel/Memory/Region.cpp +++ b/Kernel/Memory/Region.cpp @@ -45,7 +45,7 @@ Region::~Region() // find the address<->region mappings in an invalid state there. ScopedSpinLock lock(s_mm_lock); if (m_page_directory) { - unmap(ShouldDeallocateVirtualMemoryVirtualRange::Yes); + unmap(ShouldDeallocateVirtualRange::Yes); VERIFY(!m_page_directory); } @@ -234,7 +234,7 @@ bool Region::remap_vmobject_page(size_t page_index, bool with_flush) return success; } -void Region::unmap(ShouldDeallocateVirtualMemoryVirtualRange deallocate_range) +void Region::unmap(ShouldDeallocateVirtualRange deallocate_range) { ScopedSpinLock lock(s_mm_lock); if (!m_page_directory) @@ -246,7 +246,7 @@ void Region::unmap(ShouldDeallocateVirtualMemoryVirtualRange deallocate_range) MM.release_pte(*m_page_directory, vaddr, i == count - 1); } MM.flush_tlb(m_page_directory, vaddr(), page_count()); - if (deallocate_range == ShouldDeallocateVirtualMemoryVirtualRange::Yes) { + if (deallocate_range == ShouldDeallocateVirtualRange::Yes) { m_page_directory->range_allocator().deallocate(range()); } m_page_directory = nullptr; diff --git a/Kernel/Memory/Region.h b/Kernel/Memory/Region.h index 4cad527889..fbac96a257 100644 --- a/Kernel/Memory/Region.h +++ b/Kernel/Memory/Region.h @@ -168,11 +168,11 @@ public: void set_page_directory(PageDirectory&); bool map(PageDirectory&, ShouldFlushTLB = ShouldFlushTLB::Yes); - enum class ShouldDeallocateVirtualMemoryVirtualRange { + enum class ShouldDeallocateVirtualRange { No, Yes, }; - void unmap(ShouldDeallocateVirtualMemoryVirtualRange = ShouldDeallocateVirtualMemoryVirtualRange::Yes); + void unmap(ShouldDeallocateVirtualRange = ShouldDeallocateVirtualRange::Yes); void remap(); diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index e9e02b74fc..742b8dd385 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -346,7 +346,7 @@ KResultOr Process::sys$mprotect(Userspace addr, size_t size, int auto region = address_space().take_region(*old_region); // Unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No); + region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); // This vector is the region(s) adjacent to our range. // We need to allocate a new region for the range we wanted to change permission bits on. @@ -409,7 +409,7 @@ KResultOr Process::sys$mprotect(Userspace addr, size_t size, int auto region = address_space().take_region(*old_region); // Unmap the old region here, specifying that we *don't* want the VM deallocated. - region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No); + region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); // This vector is the region(s) adjacent to our range. // We need to allocate a new region for the range we wanted to change permission bits on. @@ -566,7 +566,7 @@ KResultOr Process::sys$mremap(Userspacetake_name(); // Unmap without deallocating the VM range since we're going to reuse it. - old_region->unmap(Memory::Region::ShouldDeallocateVirtualMemoryVirtualRange::No); + old_region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); address_space().deallocate_region(*old_region); auto new_region_or_error = address_space().allocate_region_with_vmobject(range, new_vmobject.release_nonnull(), old_offset, old_name->view(), old_prot, false);