mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Simplify VMObject::is_anonymous().
This doesn't need a separate flag. A VMObject is always anonymous if it has no backing inode.
This commit is contained in:
parent
b8e60b6652
commit
34c5db61aa
Notes:
sideshowbarker
2024-07-19 14:19:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/34c5db61aa1
2 changed files with 4 additions and 8 deletions
|
@ -33,7 +33,6 @@ Retained<VMObject> VMObject::clone()
|
|||
|
||||
VMObject::VMObject(VMObject& other)
|
||||
: m_name(other.m_name)
|
||||
, m_anonymous(other.m_anonymous)
|
||||
, m_inode_offset(other.m_inode_offset)
|
||||
, m_size(other.m_size)
|
||||
, m_inode(other.m_inode)
|
||||
|
@ -43,16 +42,14 @@ VMObject::VMObject(VMObject& other)
|
|||
}
|
||||
|
||||
VMObject::VMObject(size_t size)
|
||||
: m_anonymous(true)
|
||||
, m_size(size)
|
||||
: m_size(size)
|
||||
{
|
||||
MM.register_vmo(*this);
|
||||
m_physical_pages.resize(page_count());
|
||||
}
|
||||
|
||||
VMObject::VMObject(PhysicalAddress paddr, size_t size)
|
||||
: m_anonymous(true)
|
||||
, m_size(size)
|
||||
: m_size(size)
|
||||
{
|
||||
MM.register_vmo(*this);
|
||||
for (size_t i = 0; i < size; i += PAGE_SIZE) {
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
Retained<VMObject> clone();
|
||||
|
||||
~VMObject();
|
||||
bool is_anonymous() const { return m_anonymous; }
|
||||
bool is_anonymous() const { return !m_inode; }
|
||||
|
||||
Inode* inode() { return m_inode.ptr(); }
|
||||
const Inode* inode() const { return m_inode.ptr(); }
|
||||
|
@ -49,10 +49,9 @@ private:
|
|||
template<typename Callback> void for_each_region(Callback);
|
||||
|
||||
String m_name;
|
||||
bool m_anonymous { false };
|
||||
bool m_allow_cpu_caching { true };
|
||||
off_t m_inode_offset { 0 };
|
||||
size_t m_size { 0 };
|
||||
bool m_allow_cpu_caching { true };
|
||||
RetainPtr<Inode> m_inode;
|
||||
Vector<RetainPtr<PhysicalPage>> m_physical_pages;
|
||||
Lock m_paging_lock { "VMObject" };
|
||||
|
|
Loading…
Reference in a new issue