1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00: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:
Liav A 2022-04-23 00:26:36 +03:00 committed by Andreas Kling
parent ecc29bb52e
commit 6733f19b3c
11 changed files with 72 additions and 31 deletions

View file

@ -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;
};
}