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

Kernel: Add for_each_vmobject_of_type<T>

This makes iterating over a specific type of VMObjects a bit nicer.
This commit is contained in:
Andreas Kling 2020-05-08 22:10:47 +02:00
parent 239fd33405
commit 55f61c0004
8 changed files with 57 additions and 16 deletions

View file

@ -671,9 +671,8 @@ int Process::sys$purge(int mode)
NonnullRefPtrVector<PurgeableVMObject> vmobjects;
{
InterruptDisabler disabler;
MM.for_each_vmobject([&](auto& vmobject) {
if (vmobject.is_purgeable())
vmobjects.append(static_cast<PurgeableVMObject&>(vmobject));
MM.for_each_vmobject_of_type<PurgeableVMObject>([&](auto& vmobject) {
vmobjects.append(vmobject);
return IterationDecision::Continue;
});
}
@ -685,9 +684,8 @@ int Process::sys$purge(int mode)
NonnullRefPtrVector<InodeVMObject> vmobjects;
{
InterruptDisabler disabler;
MM.for_each_vmobject([&](auto& vmobject) {
if (vmobject.is_inode())
vmobjects.append(static_cast<InodeVMObject&>(vmobject));
MM.for_each_vmobject_of_type<InodeVMObject>([&](auto& vmobject) {
vmobjects.append(vmobject);
return IterationDecision::Continue;
});
}