diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-22 00:02:34 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-22 09:17:02 +0200 |
commit | 9e15708aa08454d6418c256a82ac21597eee20fe (patch) | |
tree | c5d15f4c36f7bacd3704ad4f49c169b27cd5ee75 /Kernel | |
parent | 16106695194ced969f5a58cf2729b5ddd4cb2546 (diff) | |
download | serenity-9e15708aa08454d6418c256a82ac21597eee20fe.zip |
Kernel: Convert VMObject & subclasses to east-const style
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/VM/AnonymousVMObject.cpp | 22 | ||||
-rw-r--r-- | Kernel/VM/AnonymousVMObject.h | 28 | ||||
-rw-r--r-- | Kernel/VM/ContiguousVMObject.cpp | 2 | ||||
-rw-r--r-- | Kernel/VM/ContiguousVMObject.h | 4 | ||||
-rw-r--r-- | Kernel/VM/InodeVMObject.cpp | 2 | ||||
-rw-r--r-- | Kernel/VM/InodeVMObject.h | 6 | ||||
-rw-r--r-- | Kernel/VM/PrivateInodeVMObject.cpp | 2 | ||||
-rw-r--r-- | Kernel/VM/PrivateInodeVMObject.h | 4 | ||||
-rw-r--r-- | Kernel/VM/SharedInodeVMObject.cpp | 2 | ||||
-rw-r--r-- | Kernel/VM/SharedInodeVMObject.h | 4 | ||||
-rw-r--r-- | Kernel/VM/VMObject.cpp | 2 | ||||
-rw-r--r-- | Kernel/VM/VMObject.h | 4 |
12 files changed, 41 insertions, 41 deletions
diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index f6097d51b5..e91ae6ffa9 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -25,7 +25,7 @@ RefPtr<VMObject> AnonymousVMObject::try_clone() size_t need_cow_pages = 0; // We definitely need to commit non-volatile areas - for_each_nonvolatile_range([&](const VolatilePageRange& nonvolatile_range) { + for_each_nonvolatile_range([&](VolatilePageRange const& nonvolatile_range) { need_cow_pages += nonvolatile_range.count; }); @@ -125,7 +125,7 @@ AnonymousVMObject::AnonymousVMObject(NonnullRefPtrVector<PhysicalPage> physical_ } } -AnonymousVMObject::AnonymousVMObject(const AnonymousVMObject& other) +AnonymousVMObject::AnonymousVMObject(AnonymousVMObject const& other) : VMObject(other) , m_volatile_ranges_cache({ 0, page_count() }) // do *not* clone this , m_volatile_ranges_cache_dirty(true) // do *not* clone this @@ -178,7 +178,7 @@ int AnonymousVMObject::purge_with_interrupts_disabled(Badge<MemoryManager>) return purge_impl(); } -void AnonymousVMObject::set_was_purged(const VolatilePageRange& range) +void AnonymousVMObject::set_was_purged(VolatilePageRange const& range) { VERIFY(m_lock.is_locked()); for (auto* purgeable_ranges : m_purgeable_ranges) @@ -189,7 +189,7 @@ int AnonymousVMObject::purge_impl() { int purged_page_count = 0; ScopedSpinLock lock(m_lock); - for_each_volatile_range([&](const auto& range) { + for_each_volatile_range([&](auto const& range) { int purged_in_range = 0; auto range_end = range.base + range.count; for (size_t i = range.base; i < range_end; i++) { @@ -261,7 +261,7 @@ bool AnonymousVMObject::is_any_volatile() const return false; } -size_t AnonymousVMObject::remove_lazy_commit_pages(const VolatilePageRange& range) +size_t AnonymousVMObject::remove_lazy_commit_pages(VolatilePageRange const& range) { VERIFY(m_lock.is_locked()); @@ -286,14 +286,14 @@ void AnonymousVMObject::update_volatile_cache() VERIFY(m_volatile_ranges_cache_dirty); m_volatile_ranges_cache.clear(); - for_each_nonvolatile_range([&](const VolatilePageRange& range) { + for_each_nonvolatile_range([&](VolatilePageRange const& range) { m_volatile_ranges_cache.add_unchecked(range); }); m_volatile_ranges_cache_dirty = false; } -void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range) +void AnonymousVMObject::range_made_volatile(VolatilePageRange const& range) { VERIFY(m_lock.is_locked()); @@ -305,7 +305,7 @@ void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range) // and also adjust the m_unused_committed_pages for each such page. // Take into account all the other views as well. size_t uncommit_page_count = 0; - for_each_volatile_range([&](const auto& r) { + for_each_volatile_range([&](auto const& r) { auto intersected = range.intersected(r); if (!intersected.is_empty()) { uncommit_page_count += remove_lazy_commit_pages(intersected); @@ -324,13 +324,13 @@ void AnonymousVMObject::range_made_volatile(const VolatilePageRange& range) m_volatile_ranges_cache_dirty = true; } -void AnonymousVMObject::range_made_nonvolatile(const VolatilePageRange&) +void AnonymousVMObject::range_made_nonvolatile(VolatilePageRange const&) { VERIFY(m_lock.is_locked()); m_volatile_ranges_cache_dirty = true; } -size_t AnonymousVMObject::count_needed_commit_pages_for_nonvolatile_range(const VolatilePageRange& range) +size_t AnonymousVMObject::count_needed_commit_pages_for_nonvolatile_range(VolatilePageRange const& range) { VERIFY(m_lock.is_locked()); VERIFY(!range.is_empty()); @@ -348,7 +348,7 @@ size_t AnonymousVMObject::count_needed_commit_pages_for_nonvolatile_range(const return need_commit_pages; } -size_t AnonymousVMObject::mark_committed_pages_for_nonvolatile_range(const VolatilePageRange& range, size_t mark_total) +size_t AnonymousVMObject::mark_committed_pages_for_nonvolatile_range(VolatilePageRange const& range, size_t mark_total) { VERIFY(m_lock.is_locked()); VERIFY(!range.is_empty()); diff --git a/Kernel/VM/AnonymousVMObject.h b/Kernel/VM/AnonymousVMObject.h index 72acbe7cb6..22bd7ccc8a 100644 --- a/Kernel/VM/AnonymousVMObject.h +++ b/Kernel/VM/AnonymousVMObject.h @@ -41,7 +41,7 @@ public: bool is_any_volatile() const; - template<IteratorFunction<const VolatilePageRange&> F> + template<IteratorFunction<VolatilePageRange const&> F> IterationDecision for_each_volatile_range(F f) const { VERIFY(m_lock.is_locked()); @@ -61,7 +61,7 @@ public: // immediately bail return IterationDecision::Continue; } - for (const auto& r2 : purgeable_range2->volatile_ranges().ranges()) { + for (auto const& r2 : purgeable_range2->volatile_ranges().ranges()) { range = range.intersected(r2); if (range.is_empty()) break; @@ -79,11 +79,11 @@ public: return IterationDecision::Continue; } - template<IteratorFunction<const VolatilePageRange&> F> + template<IteratorFunction<VolatilePageRange const&> F> IterationDecision for_each_nonvolatile_range(F f) const { size_t base = 0; - for_each_volatile_range([&](const VolatilePageRange& volatile_range) { + for_each_volatile_range([&](VolatilePageRange const& volatile_range) { if (volatile_range.base == base) return IterationDecision::Continue; IterationDecision decision = f(VolatilePageRange { base, volatile_range.base - base }); @@ -97,7 +97,7 @@ public: return IterationDecision::Continue; } - template<VoidFunction<const VolatilePageRange&> F> + template<VoidFunction<VolatilePageRange const&> F> IterationDecision for_each_volatile_range(F f) const { return for_each_volatile_range([&](auto& range) { @@ -106,7 +106,7 @@ public: }); } - template<VoidFunction<const VolatilePageRange&> F> + template<VoidFunction<VolatilePageRange const&> F> IterationDecision for_each_nonvolatile_range(F f) const { return for_each_nonvolatile_range([&](auto range) { @@ -120,21 +120,21 @@ private: explicit AnonymousVMObject(PhysicalAddress, size_t); explicit AnonymousVMObject(PhysicalPage&); explicit AnonymousVMObject(NonnullRefPtrVector<PhysicalPage>); - explicit AnonymousVMObject(const AnonymousVMObject&); + explicit AnonymousVMObject(AnonymousVMObject const&); virtual StringView class_name() const override { return "AnonymousVMObject"sv; } int purge_impl(); void update_volatile_cache(); - void set_was_purged(const VolatilePageRange&); - size_t remove_lazy_commit_pages(const VolatilePageRange&); - void range_made_volatile(const VolatilePageRange&); - void range_made_nonvolatile(const VolatilePageRange&); - size_t count_needed_commit_pages_for_nonvolatile_range(const VolatilePageRange&); - size_t mark_committed_pages_for_nonvolatile_range(const VolatilePageRange&, size_t); + void set_was_purged(VolatilePageRange const&); + size_t remove_lazy_commit_pages(VolatilePageRange const&); + void range_made_volatile(VolatilePageRange const&); + void range_made_nonvolatile(VolatilePageRange const&); + size_t count_needed_commit_pages_for_nonvolatile_range(VolatilePageRange const&); + size_t mark_committed_pages_for_nonvolatile_range(VolatilePageRange const&, size_t); bool is_nonvolatile(size_t page_index); - AnonymousVMObject& operator=(const AnonymousVMObject&) = delete; + AnonymousVMObject& operator=(AnonymousVMObject const&) = delete; AnonymousVMObject& operator=(AnonymousVMObject&&) = delete; AnonymousVMObject(AnonymousVMObject&&) = delete; diff --git a/Kernel/VM/ContiguousVMObject.cpp b/Kernel/VM/ContiguousVMObject.cpp index 59fa2a5855..a946a3658e 100644 --- a/Kernel/VM/ContiguousVMObject.cpp +++ b/Kernel/VM/ContiguousVMObject.cpp @@ -27,7 +27,7 @@ ContiguousVMObject::ContiguousVMObject(size_t size, NonnullRefPtrVector<Physical } } -ContiguousVMObject::ContiguousVMObject(const ContiguousVMObject& other) +ContiguousVMObject::ContiguousVMObject(ContiguousVMObject const& other) : VMObject(other) { } diff --git a/Kernel/VM/ContiguousVMObject.h b/Kernel/VM/ContiguousVMObject.h index f4af29ba05..76700f1c4b 100644 --- a/Kernel/VM/ContiguousVMObject.h +++ b/Kernel/VM/ContiguousVMObject.h @@ -19,12 +19,12 @@ public: private: explicit ContiguousVMObject(size_t, NonnullRefPtrVector<PhysicalPage>&); - explicit ContiguousVMObject(const ContiguousVMObject&); + explicit ContiguousVMObject(ContiguousVMObject const&); virtual StringView class_name() const override { return "ContiguousVMObject"sv; } virtual RefPtr<VMObject> try_clone() override; - ContiguousVMObject& operator=(const ContiguousVMObject&) = delete; + ContiguousVMObject& operator=(ContiguousVMObject const&) = delete; ContiguousVMObject& operator=(ContiguousVMObject&&) = delete; ContiguousVMObject(ContiguousVMObject&&) = delete; diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index 2e932b71fa..7315828e01 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -17,7 +17,7 @@ InodeVMObject::InodeVMObject(Inode& inode, size_t size) { } -InodeVMObject::InodeVMObject(const InodeVMObject& other) +InodeVMObject::InodeVMObject(InodeVMObject const& other) : VMObject(other) , m_inode(other.m_inode) , m_dirty_pages(page_count(), false) diff --git a/Kernel/VM/InodeVMObject.h b/Kernel/VM/InodeVMObject.h index 443a28e132..63fee76f0e 100644 --- a/Kernel/VM/InodeVMObject.h +++ b/Kernel/VM/InodeVMObject.h @@ -17,7 +17,7 @@ public: virtual ~InodeVMObject() override; Inode& inode() { return *m_inode; } - const Inode& inode() const { return *m_inode; } + Inode const& inode() const { return *m_inode; } size_t amount_dirty() const; size_t amount_clean() const; @@ -29,9 +29,9 @@ public: protected: explicit InodeVMObject(Inode&, size_t); - explicit InodeVMObject(const InodeVMObject&); + explicit InodeVMObject(InodeVMObject const&); - InodeVMObject& operator=(const InodeVMObject&) = delete; + InodeVMObject& operator=(InodeVMObject const&) = delete; InodeVMObject& operator=(InodeVMObject&&) = delete; InodeVMObject(InodeVMObject&&) = delete; diff --git a/Kernel/VM/PrivateInodeVMObject.cpp b/Kernel/VM/PrivateInodeVMObject.cpp index 420ffc511d..c000fb4e14 100644 --- a/Kernel/VM/PrivateInodeVMObject.cpp +++ b/Kernel/VM/PrivateInodeVMObject.cpp @@ -24,7 +24,7 @@ PrivateInodeVMObject::PrivateInodeVMObject(Inode& inode, size_t size) { } -PrivateInodeVMObject::PrivateInodeVMObject(const PrivateInodeVMObject& other) +PrivateInodeVMObject::PrivateInodeVMObject(PrivateInodeVMObject const& other) : InodeVMObject(other) { } diff --git a/Kernel/VM/PrivateInodeVMObject.h b/Kernel/VM/PrivateInodeVMObject.h index 9faa34b695..55b80680f8 100644 --- a/Kernel/VM/PrivateInodeVMObject.h +++ b/Kernel/VM/PrivateInodeVMObject.h @@ -25,11 +25,11 @@ private: virtual bool is_private_inode() const override { return true; } explicit PrivateInodeVMObject(Inode&, size_t); - explicit PrivateInodeVMObject(const PrivateInodeVMObject&); + explicit PrivateInodeVMObject(PrivateInodeVMObject const&); virtual StringView class_name() const override { return "PrivateInodeVMObject"sv; } - PrivateInodeVMObject& operator=(const PrivateInodeVMObject&) = delete; + PrivateInodeVMObject& operator=(PrivateInodeVMObject const&) = delete; }; } diff --git a/Kernel/VM/SharedInodeVMObject.cpp b/Kernel/VM/SharedInodeVMObject.cpp index 07f3a6d3c1..e603f70504 100644 --- a/Kernel/VM/SharedInodeVMObject.cpp +++ b/Kernel/VM/SharedInodeVMObject.cpp @@ -31,7 +31,7 @@ SharedInodeVMObject::SharedInodeVMObject(Inode& inode, size_t size) { } -SharedInodeVMObject::SharedInodeVMObject(const SharedInodeVMObject& other) +SharedInodeVMObject::SharedInodeVMObject(SharedInodeVMObject const& other) : InodeVMObject(other) { } diff --git a/Kernel/VM/SharedInodeVMObject.h b/Kernel/VM/SharedInodeVMObject.h index 113c7a1a5b..ef5b828b5e 100644 --- a/Kernel/VM/SharedInodeVMObject.h +++ b/Kernel/VM/SharedInodeVMObject.h @@ -23,11 +23,11 @@ private: virtual bool is_shared_inode() const override { return true; } explicit SharedInodeVMObject(Inode&, size_t); - explicit SharedInodeVMObject(const SharedInodeVMObject&); + explicit SharedInodeVMObject(SharedInodeVMObject const&); virtual StringView class_name() const override { return "SharedInodeVMObject"sv; } - SharedInodeVMObject& operator=(const SharedInodeVMObject&) = delete; + SharedInodeVMObject& operator=(SharedInodeVMObject const&) = delete; }; } diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp index 99cf074b9c..aeded3697b 100644 --- a/Kernel/VM/VMObject.cpp +++ b/Kernel/VM/VMObject.cpp @@ -9,7 +9,7 @@ namespace Kernel { -VMObject::VMObject(const VMObject& other) +VMObject::VMObject(VMObject const& other) : m_physical_pages(other.m_physical_pages) { MM.register_vmobject(*this); diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h index 3cd3b09082..6497d10493 100644 --- a/Kernel/VM/VMObject.h +++ b/Kernel/VM/VMObject.h @@ -63,7 +63,7 @@ public: protected: explicit VMObject(size_t); - explicit VMObject(const VMObject&); + explicit VMObject(VMObject const&); template<typename Callback> void for_each_region(Callback); @@ -75,7 +75,7 @@ protected: mutable SpinLock<u8> m_lock; private: - VMObject& operator=(const VMObject&) = delete; + VMObject& operator=(VMObject const&) = delete; VMObject& operator=(VMObject&&) = delete; VMObject(VMObject&&) = delete; |