mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
Kernel/SysFS: Migrate components code from SysFS.cpp to the SysFS folder
This commit is contained in:
parent
4d05a41b30
commit
23c1c40e86
29 changed files with 496 additions and 286 deletions
54
Kernel/FileSystem/SysFS/Registry.cpp
Normal file
54
Kernel/FileSystem/SysFS/Registry.cpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/FileSystem/SysFS/Registry.h>
|
||||
#include <Kernel/Sections.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
static Singleton<SysFSComponentRegistry> s_the;
|
||||
|
||||
SysFSComponentRegistry& SysFSComponentRegistry::the()
|
||||
{
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void SysFSComponentRegistry::initialize()
|
||||
{
|
||||
VERIFY(!s_the.is_initialized());
|
||||
s_the.ensure_instance();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT SysFSComponentRegistry::SysFSComponentRegistry()
|
||||
: m_root_directory(SysFSRootDirectory::create())
|
||||
{
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void SysFSComponentRegistry::register_new_component(SysFSComponent& component)
|
||||
{
|
||||
MutexLocker locker(m_lock);
|
||||
m_root_directory->m_components.append(component);
|
||||
}
|
||||
|
||||
SysFSComponentRegistry::DevicesList& SysFSComponentRegistry::devices_list()
|
||||
{
|
||||
return m_devices_list;
|
||||
}
|
||||
|
||||
SysFSBusDirectory& SysFSComponentRegistry::buses_directory()
|
||||
{
|
||||
return *m_root_directory->m_buses_directory;
|
||||
}
|
||||
|
||||
void SysFSComponentRegistry::register_new_bus_directory(SysFSDirectory& new_bus_directory)
|
||||
{
|
||||
VERIFY(!m_root_directory->m_buses_directory.is_null());
|
||||
m_root_directory->m_buses_directory->m_components.append(new_bus_directory);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue