mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +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
Notes:
sideshowbarker
2024-07-18 06:57:29 +09:00
Author: https://github.com/awesomekling
Commit: ef2720bcad
18 changed files with 83 additions and 72 deletions
|
@ -965,16 +965,17 @@ KResultOr<NonnullRefPtr<Custody>> VirtualFileSystem::resolve_path_without_veil(S
|
|||
}
|
||||
|
||||
// Okay, let's look up this part.
|
||||
auto child_inode = parent.inode().lookup(part);
|
||||
if (!child_inode) {
|
||||
auto child_or_error = parent.inode().lookup(part);
|
||||
if (child_or_error.is_error()) {
|
||||
if (out_parent) {
|
||||
// ENOENT with a non-null parent custody signals to caller that
|
||||
// we found the immediate parent of the file, but the file itself
|
||||
// does not exist yet.
|
||||
*out_parent = have_more_parts ? nullptr : &parent;
|
||||
}
|
||||
return ENOENT;
|
||||
return child_or_error.error();
|
||||
}
|
||||
auto child_inode = child_or_error.release_value();
|
||||
|
||||
int mount_flags_for_child = parent.mount_flags();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue