mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
Kernel/SysFS: Reduce the responsibilities of the Registry object
Instead, let the /sys/dev/block and /sys/dev/char directories to handle the registering part of SysFSDeviceComponents by themselves.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 08:56:09 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/6733f19b3c Pull-request: https://github.com/SerenityOS/serenity/pull/13779
@@ -7,10 +7,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/FileSystem/SysFS/Component.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/DeviceComponent.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/DeviceIdentifiers/Directory.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class Device;
|
||||
class SysFSBlockDevicesDirectory final : public SysFSDirectory {
|
||||
public:
|
||||
virtual StringView name() const override { return "block"sv; }
|
||||
@@ -18,8 +20,15 @@ public:
|
||||
virtual ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
|
||||
virtual RefPtr<SysFSComponent> lookup(StringView name) override;
|
||||
|
||||
static SysFSBlockDevicesDirectory& the();
|
||||
|
||||
using DevicesList = SpinlockProtected<IntrusiveList<&SysFSDeviceComponent::m_list_node>>;
|
||||
DevicesList& devices_list(Badge<Device>) { return m_devices_list; }
|
||||
|
||||
private:
|
||||
explicit SysFSBlockDevicesDirectory(SysFSDeviceIdentifiersDirectory const&);
|
||||
|
||||
DevicesList m_devices_list;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user