ladybird/Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.cpp
Liav A 75f01692b4 Kernel+Userland: Move /sys/firmware/power_state to /sys/kernel directory
Let's put the power_state global node into the /sys/kernel directory,
because that directory represents all global nodes and variables being
related to the Kernel. It's also a mutable node, that is more acceptable
being in the mentioned directory due to the fact that all other files in
the /sys/firmware directory are just firmware blobs and are not mutable
at all.
2022-10-25 15:33:34 -06:00

37 lines
1.1 KiB
C++

/*
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/FileSystem/SysFS/Registry.h>
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Directory.h>
#include <Kernel/FileSystem/SysFS/Subsystems/Firmware/Directory.h>
#include <Kernel/Firmware/ACPI/Parser.h>
#include <Kernel/Sections.h>
namespace Kernel {
UNMAP_AFTER_INIT void FirmwareSysFSDirectory::initialize()
{
auto firmware_directory = adopt_lock_ref_if_nonnull(new (nothrow) FirmwareSysFSDirectory()).release_nonnull();
SysFSComponentRegistry::the().register_new_component(firmware_directory);
firmware_directory->create_components();
}
void FirmwareSysFSDirectory::create_components()
{
MUST(m_child_components.with([&](auto& list) -> ErrorOr<void> {
list.append(BIOSSysFSDirectory::must_create(*this));
if (ACPI::is_enabled())
list.append(ACPI::ACPISysFSDirectory::must_create(*this));
return {};
}));
}
UNMAP_AFTER_INIT FirmwareSysFSDirectory::FirmwareSysFSDirectory()
: SysFSDirectory(SysFSComponentRegistry::the().root_directory())
{
}
}