1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Kernel/FileSystem: Simplify the ProcFS inode code

This is done by merging all scattered pieces of derived classes from the
ProcFSInode class into that one class, so we don't use inheritance but
rather simplistic checks to determine the proper code for each ProcFS
inode with its specific characteristics.
This commit is contained in:
Liav A 2022-11-25 22:29:27 +02:00 committed by Jelle Raaijmakers
parent e9dcc49f9c
commit 722ae35329
25 changed files with 583 additions and 913 deletions

View file

@ -4,8 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/FileSystem/ProcFS/DirectoryInode.h>
#include <Kernel/FileSystem/ProcFS/LinkInode.h>
#include <Kernel/FileSystem/ProcFS/Inode.h>
#include <Kernel/KBufferBuilder.h>
#include <Kernel/PerformanceEventBuffer.h>
#include <Kernel/Process.h>
@ -125,14 +124,14 @@ ErrorOr<size_t> ProcFSExposedLink::read_bytes(off_t offset, size_t count, UserOr
return nread;
}
ErrorOr<NonnullLockRefPtr<Inode>> ProcFSExposedLink::to_inode(ProcFS const& procfs_instance) const
ErrorOr<NonnullLockRefPtr<ProcFSInode>> ProcFSExposedLink::to_inode(ProcFS const& procfs_instance) const
{
return TRY(ProcFSLinkInode::try_create(procfs_instance, *this));
return TRY(ProcFSInode::try_create_as_global_link_inode(procfs_instance, *this));
}
ErrorOr<NonnullLockRefPtr<Inode>> ProcFSExposedDirectory::to_inode(ProcFS const& procfs_instance) const
ErrorOr<NonnullLockRefPtr<ProcFSInode>> ProcFSExposedDirectory::to_inode(ProcFS const& procfs_instance) const
{
return TRY(ProcFSDirectoryInode::try_create(procfs_instance, *this));
return TRY(ProcFSInode::try_create_as_directory_inode(procfs_instance, *this));
}
void ProcFSExposedDirectory::add_component(ProcFSExposedComponent const&)