1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 01:48:11 +00:00

Kernel: Move VMObject::for_each_region() to MemoryManager.h

It can't be in VMObject.h since it depends on MemoryManager.h
This commit is contained in:
Andreas Kling 2019-12-09 20:06:03 +01:00
parent a22b7f96fc
commit 65229a4082
2 changed files with 15 additions and 15 deletions

View file

@ -102,18 +102,3 @@ void InodeVMObject::inode_contents_changed(Badge<Inode>, off_t offset, ssize_t s
region.remap(); region.remap();
}); });
} }
template<typename Callback>
void VMObject::for_each_region(Callback callback)
{
// FIXME: Figure out a better data structure so we don't have to walk every single region every time an inode changes.
// Perhaps VMObject could have a Vector<Region*> with all of his mappers?
for (auto& region : MM.m_user_regions) {
if (&region.vmobject() == this)
callback(region);
}
for (auto& region : MM.m_kernel_regions) {
if (&region.vmobject() == this)
callback(region);
}
}

View file

@ -138,3 +138,18 @@ struct ProcessPagingScope {
ProcessPagingScope(Process&); ProcessPagingScope(Process&);
~ProcessPagingScope(); ~ProcessPagingScope();
}; };
template<typename Callback>
void VMObject::for_each_region(Callback callback)
{
// FIXME: Figure out a better data structure so we don't have to walk every single region every time an inode changes.
// Perhaps VMObject could have a Vector<Region*> with all of his mappers?
for (auto& region : MM.m_user_regions) {
if (&region.vmobject() == this)
callback(region);
}
for (auto& region : MM.m_kernel_regions) {
if (&region.vmobject() == this)
callback(region);
}
}