mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
Kernel/SysFS: Don't allocate ACPISysFS components in constructors
Instead defer it to a method to be called after the construction of ACPISysFSDirectory.
This commit is contained in:
parent
381fdaa163
commit
bbdb55126c
Notes:
sideshowbarker
2024-07-17 22:47:37 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/bbdb55126c6 Pull-request: https://github.com/SerenityOS/serenity/pull/11228
@ -67,14 +67,7 @@ UNMAP_AFTER_INIT ACPISysFSComponent::ACPISysFSComponent(NonnullOwnPtr<KString> t
|
||||
{
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<ACPISysFSDirectory> ACPISysFSDirectory::must_create(FirmwareSysFSDirectory& firmware_directory)
|
||||
{
|
||||
auto acpi_directory = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) ACPISysFSDirectory(firmware_directory)));
|
||||
return acpi_directory;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory)
|
||||
: SysFSDirectory(firmware_directory)
|
||||
UNMAP_AFTER_INIT void ACPISysFSDirectory::find_tables_and_register_them_as_components()
|
||||
{
|
||||
NonnullRefPtrVector<SysFSComponent> components;
|
||||
size_t ssdt_count = 0;
|
||||
@ -99,6 +92,18 @@ UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory&
|
||||
}
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<ACPISysFSDirectory> ACPISysFSDirectory::must_create(FirmwareSysFSDirectory& firmware_directory)
|
||||
{
|
||||
auto acpi_directory = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) ACPISysFSDirectory(firmware_directory)));
|
||||
acpi_directory->find_tables_and_register_them_as_components();
|
||||
return acpi_directory;
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT ACPISysFSDirectory::ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory)
|
||||
: SysFSDirectory(firmware_directory)
|
||||
{
|
||||
}
|
||||
|
||||
void Parser::enumerate_static_tables(Function<void(StringView, PhysicalAddress, size_t)> callback)
|
||||
{
|
||||
for (auto& p_table : m_sdt_pointers) {
|
||||
|
@ -26,6 +26,7 @@ public:
|
||||
static NonnullRefPtr<ACPISysFSDirectory> must_create(FirmwareSysFSDirectory& firmware_directory);
|
||||
|
||||
private:
|
||||
void find_tables_and_register_them_as_components();
|
||||
explicit ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user