mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 11:55:12 +00:00

This enforces us to remove duplicated code across the SysFS code. This results in great simplification of how the SysFS works now, because we enforce one way to treat SysFSDirectory objects.
32 lines
950 B
C++
32 lines
950 B
C++
/*
|
|
* 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>
|
|
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/Directory.h>
|
|
#include <Kernel/Sections.h>
|
|
|
|
namespace Kernel {
|
|
|
|
NonnullRefPtr<SysFSRootDirectory> SysFSRootDirectory::create()
|
|
{
|
|
return adopt_ref(*new (nothrow) SysFSRootDirectory);
|
|
}
|
|
|
|
SysFSRootDirectory::SysFSRootDirectory()
|
|
{
|
|
auto buses_directory = SysFSBusDirectory::must_create(*this);
|
|
auto device_identifiers_directory = SysFSDeviceIdentifiersDirectory::must_create(*this);
|
|
MUST(m_child_components.with([&](auto& list) -> ErrorOr<void> {
|
|
list.append(buses_directory);
|
|
list.append(device_identifiers_directory);
|
|
return {};
|
|
}));
|
|
m_buses_directory = buses_directory;
|
|
}
|
|
|
|
}
|