mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +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:
parent
ecc29bb52e
commit
6733f19b3c
11 changed files with 72 additions and 31 deletions
|
@ -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 SysFSCharacterDevicesDirectory final : public SysFSDirectory {
|
||||
public:
|
||||
virtual StringView name() const override { return "char"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 SysFSCharacterDevicesDirectory& the();
|
||||
|
||||
using DevicesList = SpinlockProtected<IntrusiveList<&SysFSDeviceComponent::m_list_node>>;
|
||||
DevicesList& devices_list(Badge<Device>) { return m_devices_list; }
|
||||
|
||||
private:
|
||||
explicit SysFSCharacterDevicesDirectory(SysFSDeviceIdentifiersDirectory const&);
|
||||
|
||||
DevicesList m_devices_list;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue