1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:05:08 +00:00

Kernel: Rename Custody::create() => try_create()

The try_ prefix indicates that this may fail. :^)
This commit is contained in:
Andreas Kling 2021-05-28 11:23:00 +02:00
parent 9a827ad3da
commit 9d801d2345
5 changed files with 18 additions and 19 deletions

View file

@ -131,11 +131,10 @@ bool VFS::mount_root(FS& file_system)
m_mounts.append(move(mount));
auto root_custody = Custody::create(nullptr, "", *m_root_inode, root_mount_flags);
if (root_custody.is_error())
auto custody_or_error = Custody::try_create(nullptr, "", *m_root_inode, root_mount_flags);
if (custody_or_error.is_error())
return false;
m_root_custody = root_custody.release_value();
m_root_custody = custody_or_error.release_value();
return true;
}
@ -383,10 +382,10 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int optio
if (inode_or_error.is_error())
return inode_or_error.error();
auto new_custody = Custody::create(&parent_custody, p.basename(), inode_or_error.value(), parent_custody.mount_flags());
if (new_custody.is_error())
return new_custody.error();
auto description = FileDescription::create(*new_custody.release_value());
auto new_custody_or_error = Custody::try_create(&parent_custody, p.basename(), inode_or_error.value(), parent_custody.mount_flags());
if (new_custody_or_error.is_error())
return new_custody_or_error.error();
auto description = FileDescription::create(*new_custody_or_error.release_value());
if (!description.is_error()) {
description.value()->set_rw_mode(options);
description.value()->set_file_flags(options);
@ -994,11 +993,11 @@ KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path_without_veil(StringView path
mount_flags_for_child = mount->flags();
}
auto new_custody = Custody::create(&parent, part, *child_inode, mount_flags_for_child);
if (new_custody.is_error())
return new_custody.error();
auto new_custody_or_error = Custody::try_create(&parent, part, *child_inode, mount_flags_for_child);
if (new_custody_or_error.is_error())
return new_custody_or_error.error();
custody = new_custody.release_value();
custody = new_custody_or_error.release_value();
if (child_inode->metadata().is_symlink()) {
if (!have_more_parts) {