Kernel: Remove all friend declarations from SysFSComponentRegistry

Let them access the class using public API instead.
This commit is contained in:
Andreas Kling 2021-07-11 01:17:33 +02:00
parent d40ea1a0a8
commit a9decf5aa6
4 changed files with 6 additions and 10 deletions

View file

@ -115,7 +115,7 @@ ProcFSInode::~ProcFSInode()
}
ProcFS::ProcFS()
: m_root_inode(ProcFSComponentsRegistrar::the().m_root_folder->to_inode(*this))
: m_root_inode(ProcFSComponentsRegistrar::the().root_folder().to_inode(*this))
{
}

View file

@ -42,7 +42,7 @@ NonnullRefPtr<SysFSRootFolder> SysFSRootFolder::create()
KResult SysFSRootFolder::traverse_as_directory(unsigned fsid, Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
Locker locker(SysFSComponentRegistry::the().m_lock);
Locker locker(SysFSComponentRegistry::the().get_lock());
callback({ ".", { fsid, component_index() }, 0 });
callback({ "..", { fsid, 0 }, 0 });
@ -64,7 +64,7 @@ NonnullRefPtr<SysFS> SysFS::create()
}
SysFS::SysFS()
: m_root_inode(SysFSComponentRegistry::the().m_root_folder->to_inode(*this))
: m_root_inode(SysFSComponentRegistry::the().root_folder().to_inode(*this))
{
Locker locker(m_lock);
}

View file

@ -24,11 +24,6 @@ private:
};
class SysFSComponentRegistry {
friend class SysFS;
friend class SysFSComponent;
friend class SysFSDirectory;
friend class SysFSRootFolder;
public:
static SysFSComponentRegistry& the();
@ -37,7 +32,8 @@ public:
SysFSComponentRegistry();
void register_new_component(SysFSComponent&);
NonnullRefPtr<SysFSDirectory> root_folder() { return m_root_folder; }
SysFSDirectory& root_folder() { return m_root_folder; }
Lock& get_lock() { return m_lock; }
private:
Lock m_lock;

View file

@ -28,7 +28,7 @@ SysFSComponent::SysFSComponent(StringView name)
KResult SysFSDirectory::traverse_as_directory(unsigned fsid, Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
Locker locker(SysFSComponentRegistry::the().m_lock);
Locker locker(SysFSComponentRegistry::the().get_lock());
VERIFY(m_parent_folder);
callback({ ".", { fsid, component_index() }, 0 });
callback({ "..", { fsid, m_parent_folder->component_index() }, 0 });