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

Kernel: Make Inode::lookup() return a KResultOr<NonnullRefPtr<Inode>>

This allows file systems to return arbitrary error codes instead of just
an Inode or not an Inode.
This commit is contained in:
Andreas Kling 2021-08-14 13:32:35 +02:00
parent 459115a59c
commit ef2720bcad
18 changed files with 83 additions and 72 deletions

View file

@ -106,7 +106,7 @@ KResult SysFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEnt
VERIFY_NOT_REACHED();
}
RefPtr<Inode> SysFSInode::lookup(StringView)
KResultOr<NonnullRefPtr<Inode>> SysFSInode::lookup(StringView)
{
VERIFY_NOT_REACHED();
}
@ -195,12 +195,12 @@ KResult SysFSDirectoryInode::traverse_as_directory(Function<bool(FileSystem::Dir
return m_associated_component->traverse_as_directory(fs().fsid(), move(callback));
}
RefPtr<Inode> SysFSDirectoryInode::lookup(StringView name)
KResultOr<NonnullRefPtr<Inode>> SysFSDirectoryInode::lookup(StringView name)
{
MutexLocker locker(fs().m_lock);
auto component = m_associated_component->lookup(name);
if (!component)
return {};
return ENOENT;
return component->to_inode(fs());
}