From b6ee8a2c8da3a1326a85852fca10bcc2c9fc54e5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 19 Dec 2019 19:13:44 +0100 Subject: [PATCH] Kernel: Rename vmo => vmobject everywhere --- Kernel/Devices/BXVGADevice.cpp | 6 +++--- Kernel/Devices/MBVGADevice.cpp | 6 +++--- Kernel/FileSystem/Inode.cpp | 4 ++-- Kernel/FileSystem/Inode.h | 2 +- Kernel/FileSystem/ProcFS.cpp | 6 +++--- Kernel/FileSystem/SharedMemory.cpp | 2 +- Kernel/Process.cpp | 20 ++++++++++---------- Kernel/Process.h | 4 ++-- Kernel/SharedBuffer.cpp | 2 +- Kernel/VM/InodeVMObject.cpp | 6 +++--- Kernel/VM/MemoryManager.cpp | 8 ++++---- Kernel/VM/MemoryManager.h | 4 ++-- Kernel/VM/Region.cpp | 10 +++++----- Kernel/VM/Region.h | 8 ++++---- Kernel/VM/VMObject.cpp | 6 +++--- 15 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Kernel/Devices/BXVGADevice.cpp b/Kernel/Devices/BXVGADevice.cpp index 9ee46c7c9bb..b7520c6c95b 100644 --- a/Kernel/Devices/BXVGADevice.cpp +++ b/Kernel/Devices/BXVGADevice.cpp @@ -88,11 +88,11 @@ KResultOr BXVGADevice::mmap(Process& process, FileDescription&, Virtual { ASSERT(offset == 0); ASSERT(size == framebuffer_size_in_bytes()); - auto vmo = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, framebuffer_size_in_bytes()); - auto* region = process.allocate_region_with_vmo( + auto vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, framebuffer_size_in_bytes()); + auto* region = process.allocate_region_with_vmobject( preferred_vaddr, framebuffer_size_in_bytes(), - move(vmo), + move(vmobject), 0, "BXVGA Framebuffer", prot); diff --git a/Kernel/Devices/MBVGADevice.cpp b/Kernel/Devices/MBVGADevice.cpp index 887a06f355e..0f5f3204e06 100644 --- a/Kernel/Devices/MBVGADevice.cpp +++ b/Kernel/Devices/MBVGADevice.cpp @@ -27,11 +27,11 @@ KResultOr MBVGADevice::mmap(Process& process, FileDescription&, Virtual { ASSERT(offset == 0); ASSERT(size == framebuffer_size_in_bytes()); - auto vmo = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, framebuffer_size_in_bytes()); - auto* region = process.allocate_region_with_vmo( + auto vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, framebuffer_size_in_bytes()); + auto* region = process.allocate_region_with_vmobject( preferred_vaddr, framebuffer_size_in_bytes(), - move(vmo), + move(vmobject), 0, "MBVGA Framebuffer", prot); diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index e9b2217b059..64c407ad072 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -114,9 +114,9 @@ int Inode::decrement_link_count() return -ENOTIMPL; } -void Inode::set_vmo(VMObject& vmo) +void Inode::set_vmobject(VMObject& vmobject) { - m_vmobject = vmo.make_weak_ptr(); + m_vmobject = vmobject.make_weak_ptr(); } bool Inode::bind_socket(LocalSocket& socket) diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h index 6914563ceaf..5f25eae2ca3 100644 --- a/Kernel/FileSystem/Inode.h +++ b/Kernel/FileSystem/Inode.h @@ -71,7 +71,7 @@ public: void will_be_destroyed(); - void set_vmo(VMObject&); + void set_vmobject(VMObject&); InodeVMObject* vmobject() { return m_vmobject.ptr(); } const InodeVMObject* vmobject() const { return m_vmobject.ptr(); } diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index d8e0002711d..69f784a335f 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -74,7 +74,7 @@ enum ProcFileType { __FI_PID_Start, FI_PID_vm, - FI_PID_vmo, + FI_PID_vmobjects, FI_PID_stack, FI_PID_regs, FI_PID_fds, @@ -478,7 +478,7 @@ Optional procfs$net_local(InodeIdentifier) return builder.build(); } -Optional procfs$pid_vmo(InodeIdentifier identifier) +Optional procfs$pid_vmobjects(InodeIdentifier identifier) { auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier)); if (!handle) @@ -1374,7 +1374,7 @@ ProcFS::ProcFS() m_entries[FI_Root_net_local] = { "local", FI_Root_net_local, procfs$net_local }; m_entries[FI_PID_vm] = { "vm", FI_PID_vm, procfs$pid_vm }; - m_entries[FI_PID_vmo] = { "vmo", FI_PID_vmo, procfs$pid_vmo }; + m_entries[FI_PID_vmobjects] = { "vmobjects", FI_PID_vmobjects, procfs$pid_vmobjects }; m_entries[FI_PID_stack] = { "stack", FI_PID_stack, procfs$pid_stack }; m_entries[FI_PID_regs] = { "regs", FI_PID_regs, procfs$pid_regs }; m_entries[FI_PID_fds] = { "fds", FI_PID_fds, procfs$pid_fds }; diff --git a/Kernel/FileSystem/SharedMemory.cpp b/Kernel/FileSystem/SharedMemory.cpp index fe9d27a3b8b..ad4b1319393 100644 --- a/Kernel/FileSystem/SharedMemory.cpp +++ b/Kernel/FileSystem/SharedMemory.cpp @@ -93,5 +93,5 @@ KResultOr SharedMemory::mmap(Process& process, FileDescription&, Virtua { if (!vmobject()) return KResult(-ENODEV); - return process.allocate_region_with_vmo(vaddr, size, *vmobject(), offset, name(), prot); + return process.allocate_region_with_vmobject(vaddr, size, *vmobject(), offset, name(), prot); } diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 41f02b38440..c3b356e4bee 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -130,9 +130,9 @@ static unsigned prot_to_region_access_flags(int prot) return access; } -Region& Process::allocate_split_region(const Region& source_region, const Range& range, size_t offset_in_vmo) +Region& Process::allocate_split_region(const Region& source_region, const Range& range, size_t offset_in_vmobject) { - m_regions.append(Region::create_user_accessible(range, source_region.vmobject(), offset_in_vmo, source_region.name(), source_region.access())); + m_regions.append(Region::create_user_accessible(range, source_region.vmobject(), offset_in_vmobject, source_region.name(), source_region.access())); return m_regions.last(); } @@ -158,13 +158,13 @@ Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size, return &m_regions.last(); } -Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, NonnullRefPtr vmo, size_t offset_in_vmo, const String& name, int prot) +Region* Process::allocate_region_with_vmobject(VirtualAddress vaddr, size_t size, NonnullRefPtr vmobject, size_t offset_in_vmobject, const String& name, int prot) { auto range = allocate_range(vaddr, size); if (!range.is_valid()) return nullptr; - offset_in_vmo &= PAGE_MASK; - m_regions.append(Region::create_user_accessible(range, move(vmo), offset_in_vmo, name, prot_to_region_access_flags(prot))); + offset_in_vmobject &= PAGE_MASK; + m_regions.append(Region::create_user_accessible(range, move(vmobject), offset_in_vmobject, name, prot_to_region_access_flags(prot))); m_regions.last().map(page_directory()); return &m_regions.last(); } @@ -240,7 +240,7 @@ void* Process::sys$mmap(const Syscall::SC_mmap_params* params) // FIXME: The rest of this function seems like it could share more code.. if (flags & MAP_PURGEABLE) { auto vmobject = PurgeableVMObject::create_with_size(size); - auto* region = allocate_region_with_vmo(VirtualAddress((u32)addr), size, vmobject, 0, name ? name : "mmap (purgeable)", prot); + auto* region = allocate_region_with_vmobject(VirtualAddress((u32)addr), size, vmobject, 0, name ? name : "mmap (purgeable)", prot); if (!region) return (void*)-ENOMEM; if (flags & MAP_SHARED) @@ -516,8 +516,8 @@ int Process::do_exec(String path, Vector arguments, Vector envir ProcessPagingScope paging_scope(*this); ASSERT(description->inode()); - auto vmo = InodeVMObject::create_with_inode(*description->inode()); - auto* region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo, 0, description->absolute_path(), PROT_READ); + auto vmobject = InodeVMObject::create_with_inode(*description->inode()); + auto* region = allocate_region_with_vmobject(VirtualAddress(), metadata.size, vmobject, 0, description->absolute_path(), PROT_READ); ASSERT(region); // NOTE: We yank this out of 'm_regions' since we're about to manipulate the vector @@ -544,7 +544,7 @@ int Process::do_exec(String path, Vector arguments, Vector envir prot |= PROT_WRITE; if (is_executable) prot |= PROT_EXEC; - if (!allocate_region_with_vmo(vaddr, size, vmo, offset_in_image, String(name), prot)) + if (!allocate_region_with_vmobject(vaddr, size, vmobject, offset_in_image, String(name), prot)) return nullptr; return vaddr.as_ptr(); }; @@ -2838,7 +2838,7 @@ int Process::sys$create_shared_buffer(int size, void** buffer) *buffer = shared_buffer->ref_for_process_and_get_address(*this); ASSERT((int)shared_buffer->size() >= size); #ifdef SHARED_BUFFER_DEBUG - kprintf("%s(%u): Created shared buffer %d @ %p (%u bytes, vmo is %u)\n", name().characters(), pid(), shared_buffer_id, *buffer, size, shared_buffer->size()); + kprintf("%s(%u): Created shared buffer %d @ %p (%u bytes, vmobject is %u)\n", name().characters(), pid(), shared_buffer_id, *buffer, size, shared_buffer->size()); #endif shared_buffers().resource().set(shared_buffer_id, move(shared_buffer)); diff --git a/Kernel/Process.h b/Kernel/Process.h index 573dd92223a..400d81573bf 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -284,12 +284,12 @@ public: bool is_superuser() const { return m_euid == 0; } - Region* allocate_region_with_vmo(VirtualAddress, size_t, NonnullRefPtr, size_t offset_in_vmo, const String& name, int prot); + Region* allocate_region_with_vmobject(VirtualAddress, size_t, NonnullRefPtr, size_t offset_in_vmobject, const String& name, int prot); Region* allocate_file_backed_region(VirtualAddress, size_t, NonnullRefPtr, const String& name, int prot); Region* allocate_region(VirtualAddress, size_t, const String& name, int prot = PROT_READ | PROT_WRITE, bool commit = true); bool deallocate_region(Region& region); - Region& allocate_split_region(const Region& source_region, const Range&, size_t offset_in_vmo); + Region& allocate_split_region(const Region& source_region, const Range&, size_t offset_in_vmobject); void set_being_inspected(bool b) { m_being_inspected = b; } bool is_being_inspected() const { return m_being_inspected; } diff --git a/Kernel/SharedBuffer.cpp b/Kernel/SharedBuffer.cpp index 87b119cad02..2cb131f1cff 100644 --- a/Kernel/SharedBuffer.cpp +++ b/Kernel/SharedBuffer.cpp @@ -61,7 +61,7 @@ void* SharedBuffer::ref_for_process_and_get_address(Process& process) ref.count++; m_total_refs++; if (ref.region == nullptr) { - ref.region = process.allocate_region_with_vmo(VirtualAddress(), size(), m_vmobject, 0, "SharedBuffer", PROT_READ | (m_writable ? PROT_WRITE : 0)); + ref.region = process.allocate_region_with_vmobject(VirtualAddress(), size(), m_vmobject, 0, "SharedBuffer", PROT_READ | (m_writable ? PROT_WRITE : 0)); ref.region->set_shared(true); } sanity_check("ref_for_process_and_get_address"); diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index eb8f9d39f68..874b3ccc1bb 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -8,9 +8,9 @@ NonnullRefPtr InodeVMObject::create_with_inode(Inode& inode) InterruptDisabler disabler; if (inode.vmobject()) return *inode.vmobject(); - auto vmo = adopt(*new InodeVMObject(inode)); - vmo->inode().set_vmo(*vmo); - return vmo; + auto vmobject = adopt(*new InodeVMObject(inode)); + vmobject->inode().set_vmobject(*vmobject); + return vmobject; } NonnullRefPtr InodeVMObject::clone() diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp index 92e240ecff0..93ade5eb90b 100644 --- a/Kernel/VM/MemoryManager.cpp +++ b/Kernel/VM/MemoryManager.cpp @@ -587,16 +587,16 @@ bool MemoryManager::validate_user_write(const Process& process, VirtualAddress v return region && region->is_writable(); } -void MemoryManager::register_vmo(VMObject& vmo) +void MemoryManager::register_vmobject(VMObject& vmobject) { InterruptDisabler disabler; - m_vmobjects.append(&vmo); + m_vmobjects.append(&vmobject); } -void MemoryManager::unregister_vmo(VMObject& vmo) +void MemoryManager::unregister_vmobject(VMObject& vmobject) { InterruptDisabler disabler; - m_vmobjects.remove(&vmo); + m_vmobjects.remove(&vmobject); } void MemoryManager::register_region(Region& region) diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h index a422e9b7e04..ce0c52ff731 100644 --- a/Kernel/VM/MemoryManager.h +++ b/Kernel/VM/MemoryManager.h @@ -87,8 +87,8 @@ private: MemoryManager(u32 physical_address_for_kernel_page_tables); ~MemoryManager(); - void register_vmo(VMObject&); - void unregister_vmo(VMObject&); + void register_vmobject(VMObject&); + void unregister_vmobject(VMObject&); void register_region(Region&); void unregister_region(Region&); diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 5e31c404d9a..8a6c0466253 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -27,10 +27,10 @@ Region::Region(const Range& range, NonnullRefPtr inode, const String& nam MM.register_region(*this); } -Region::Region(const Range& range, NonnullRefPtr vmo, size_t offset_in_vmo, const String& name, u8 access) +Region::Region(const Range& range, NonnullRefPtr vmobject, size_t offset_in_vmobject, const String& name, u8 access) : m_range(range) - , m_offset_in_vmo(offset_in_vmo) - , m_vmobject(move(vmo)) + , m_offset_in_vmobject(offset_in_vmobject) + , m_vmobject(move(vmobject)) , m_name(name) , m_access(access) { @@ -65,7 +65,7 @@ NonnullOwnPtr Region::clone() vaddr().get()); #endif // Create a new region backed by the same VMObject. - return Region::create_user_accessible(m_range, m_vmobject, m_offset_in_vmo, m_name, m_access); + return Region::create_user_accessible(m_range, m_vmobject, m_offset_in_vmobject, m_name, m_access); } #ifdef MM_DEBUG @@ -78,7 +78,7 @@ NonnullOwnPtr Region::clone() // Set up a COW region. The parent (this) region becomes COW as well! ensure_cow_map().fill(true); remap(); - auto clone_region = Region::create_user_accessible(m_range, m_vmobject->clone(), m_offset_in_vmo, m_name, m_access); + auto clone_region = Region::create_user_accessible(m_range, m_vmobject->clone(), m_offset_in_vmobject, m_name, m_access); clone_region->ensure_cow_map(); if (m_stack) { ASSERT(is_readable()); diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h index 7ec0fb97373..95ac5fd96a2 100644 --- a/Kernel/VM/Region.h +++ b/Kernel/VM/Region.h @@ -80,7 +80,7 @@ public: size_t first_page_index() const { - return m_offset_in_vmo / PAGE_SIZE; + return m_offset_in_vmobject / PAGE_SIZE; } size_t last_page_index() const @@ -95,7 +95,7 @@ public: size_t offset_in_vmobject() const { - return m_offset_in_vmo; + return m_offset_in_vmobject; } bool commit(); @@ -141,7 +141,7 @@ public: // NOTE: These are public so we can make<> them. Region(const Range&, const String&, u8 access); - Region(const Range&, NonnullRefPtr, size_t offset_in_vmo, const String&, u8 access); + Region(const Range&, NonnullRefPtr, size_t offset_in_vmobject, const String&, u8 access); Region(const Range&, NonnullRefPtr, const String&, u8 access); private: @@ -153,7 +153,7 @@ private: RefPtr m_page_directory; Range m_range; - size_t m_offset_in_vmo { 0 }; + size_t m_offset_in_vmobject { 0 }; NonnullRefPtr m_vmobject; String m_name; u8 m_access { 0 }; diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp index 24c3b71352a..5b5497fd33d 100644 --- a/Kernel/VM/VMObject.cpp +++ b/Kernel/VM/VMObject.cpp @@ -6,16 +6,16 @@ VMObject::VMObject(const VMObject& other) : m_physical_pages(other.m_physical_pages) { - MM.register_vmo(*this); + MM.register_vmobject(*this); } VMObject::VMObject(size_t size) : m_physical_pages(ceil_div(size, PAGE_SIZE)) { - MM.register_vmo(*this); + MM.register_vmobject(*this); } VMObject::~VMObject() { - MM.unregister_vmo(*this); + MM.unregister_vmobject(*this); }