1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09: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
Notes: sideshowbarker 2024-07-18 06:57:29 +09:00
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());
}