1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:37:34 +00:00

Kernel: Use range-for with InlineLinkedList

This commit is contained in:
Andreas Kling 2019-08-08 13:40:58 +02:00
parent 028e834bb4
commit 9104d32341
6 changed files with 21 additions and 21 deletions

View file

@ -15,13 +15,13 @@ static Lockable<InlineLinkedList<Custody>>& all_custodies()
Custody* Custody::get_if_cached(Custody* parent, const String& name)
{
LOCKER(all_custodies().lock());
for (auto* custody = all_custodies().resource().head(); custody; custody = custody->next()) {
if (custody->is_deleted())
for (auto& custody : all_custodies().resource()) {
if (custody.is_deleted())
continue;
if (custody->is_mounted_on())
if (custody.is_mounted_on())
continue;
if (custody->parent() == parent && custody->name() == name)
return custody;
if (custody.parent() == parent && custody.name() == name)
return &custody;
}
return nullptr;
}

View file

@ -18,9 +18,9 @@ void Inode::sync()
NonnullRefPtrVector<Inode, 32> inodes;
{
InterruptDisabler disabler;
for (auto* inode = all_inodes().head(); inode; inode = inode->next()) {
if (inode->is_metadata_dirty())
inodes.append(*inode);
for (auto& inode : all_inodes()) {
if (inode.is_metadata_dirty())
inodes.append(inode);
}
}

View file

@ -596,8 +596,8 @@ Optional<KBuffer> procfs$inodes(InodeIdentifier)
extern InlineLinkedList<Inode>& all_inodes();
KBufferBuilder builder;
InterruptDisabler disabler;
for (auto* inode = all_inodes().head(); inode; inode = inode->next()) {
builder.appendf("Inode{K%x} %02u:%08u (%u)\n", inode, inode->fsid(), inode->index(), inode->ref_count());
for (auto& inode : all_inodes()) {
builder.appendf("Inode{K%x} %02u:%08u (%u)\n", &inode, inode.fsid(), inode.index(), inode.ref_count());
}
return builder.build();
}