summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-06 02:14:22 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-06 02:14:22 +0200
commit398f8e7c96fc3a056563a4413a0ebfce8f7209b5 (patch)
treeb786f7cd338952ca3c53571ba70487bde6ae79ed /Kernel
parentf4a6b60570899ea5ca59b753092e24963b2c457f (diff)
downloadserenity-398f8e7c96fc3a056563a4413a0ebfce8f7209b5.zip
Kernel: Use TRY() more in process-specific ProcFS code
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/ProcessExposed.cpp18
-rw-r--r--Kernel/ProcessSpecificExposed.cpp5
2 files changed, 4 insertions, 19 deletions
diff --git a/Kernel/ProcessExposed.cpp b/Kernel/ProcessExposed.cpp
index 9d157085fa..c705634c26 100644
--- a/Kernel/ProcessExposed.cpp
+++ b/Kernel/ProcessExposed.cpp
@@ -172,29 +172,17 @@ KResultOr<size_t> ProcFSExposedLink::read_bytes(off_t offset, size_t count, User
KResultOr<NonnullRefPtr<Inode>> ProcFSExposedLink::to_inode(const ProcFS& procfs_instance) const
{
- auto maybe_inode = ProcFSLinkInode::try_create(procfs_instance, *this);
- if (maybe_inode.is_error())
- return maybe_inode.error();
-
- return maybe_inode.release_value();
+ return TRY(ProcFSLinkInode::try_create(procfs_instance, *this));
}
KResultOr<NonnullRefPtr<Inode>> ProcFSExposedComponent::to_inode(const ProcFS& procfs_instance) const
{
- auto maybe_inode = ProcFSGlobalInode::try_create(procfs_instance, *this);
- if (maybe_inode.is_error())
- return maybe_inode.error();
-
- return maybe_inode.release_value();
+ return TRY(ProcFSGlobalInode::try_create(procfs_instance, *this));
}
KResultOr<NonnullRefPtr<Inode>> ProcFSExposedDirectory::to_inode(const ProcFS& procfs_instance) const
{
- auto maybe_inode = ProcFSDirectoryInode::try_create(procfs_instance, *this);
- if (maybe_inode.is_error())
- return maybe_inode.error();
-
- return maybe_inode.release_value();
+ return TRY(ProcFSDirectoryInode::try_create(procfs_instance, *this));
}
void ProcFSExposedDirectory::add_component(const ProcFSExposedComponent&)
diff --git a/Kernel/ProcessSpecificExposed.cpp b/Kernel/ProcessSpecificExposed.cpp
index 1f6adcaaf7..4906725fd4 100644
--- a/Kernel/ProcessSpecificExposed.cpp
+++ b/Kernel/ProcessSpecificExposed.cpp
@@ -112,10 +112,7 @@ KResultOr<NonnullRefPtr<Inode>> Process::lookup_file_descriptions_directory(cons
if (!fds().get_if_valid(*maybe_index))
return ENOENT;
- auto maybe_inode = ProcFSProcessPropertyInode::try_create_for_file_description_link(procfs, *maybe_index, pid());
- if (maybe_inode.is_error())
- return maybe_inode.error();
- return maybe_inode.release_value();
+ return TRY(ProcFSProcessPropertyInode::try_create_for_file_description_link(procfs, *maybe_index, pid()));
}
KResult Process::procfs_get_pledge_stats(KBufferBuilder& builder) const