1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 07:45:07 +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

@ -914,7 +914,7 @@ KResult Plan9FSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryE
}
}
RefPtr<Inode> Plan9FSInode::lookup(StringView name)
KResultOr<NonnullRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
{
u32 newfid = fs().allocate_fid();
Plan9FS::Message message { fs(), Plan9FS::Message::Type::Twalk };
@ -922,7 +922,7 @@ RefPtr<Inode> Plan9FSInode::lookup(StringView name)
auto result = fs().post_message_and_wait_for_a_reply(message);
if (result.is_error())
return nullptr;
return result;
return Plan9FSInode::create(fs(), newfid);
}