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:
parent
459115a59c
commit
ef2720bcad
18 changed files with 83 additions and 72 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue