2022-04-22 12:46:19 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Kernel/FileSystem/SysFS/Registry.h>
|
|
|
|
#include <Kernel/FileSystem/SysFS/RootDirectory.h>
|
|
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Bus/Directory.h>
|
2022-04-22 15:51:45 +03:00
|
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/Directory.h>
|
2022-04-23 11:48:40 +03:00
|
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Devices/Directory.h>
|
2022-10-14 20:51:51 +03:00
|
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/Directory.h>
|
2022-04-22 12:46:19 +03:00
|
|
|
#include <Kernel/Sections.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2022-08-19 21:53:40 +03:00
|
|
|
NonnullLockRefPtr<SysFSRootDirectory> SysFSRootDirectory::create()
|
2022-04-22 12:46:19 +03:00
|
|
|
{
|
2022-08-19 21:53:40 +03:00
|
|
|
return adopt_lock_ref(*new (nothrow) SysFSRootDirectory);
|
2022-04-22 12:46:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
SysFSRootDirectory::SysFSRootDirectory()
|
|
|
|
{
|
|
|
|
auto buses_directory = SysFSBusDirectory::must_create(*this);
|
2022-04-22 15:51:45 +03:00
|
|
|
auto device_identifiers_directory = SysFSDeviceIdentifiersDirectory::must_create(*this);
|
2022-04-23 11:48:40 +03:00
|
|
|
auto devices_directory = SysFSDevicesDirectory::must_create(*this);
|
2022-10-14 20:51:51 +03:00
|
|
|
auto global_kernel_stats_directory = SysFSGlobalKernelStatsDirectory::must_create(*this);
|
2022-04-23 01:06:37 +03:00
|
|
|
MUST(m_child_components.with([&](auto& list) -> ErrorOr<void> {
|
|
|
|
list.append(buses_directory);
|
|
|
|
list.append(device_identifiers_directory);
|
2022-04-23 11:48:40 +03:00
|
|
|
list.append(devices_directory);
|
2022-10-14 20:51:51 +03:00
|
|
|
list.append(global_kernel_stats_directory);
|
2022-04-23 01:06:37 +03:00
|
|
|
return {};
|
|
|
|
}));
|
2022-04-22 12:46:19 +03:00
|
|
|
m_buses_directory = buses_directory;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|