mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-09 00:22:43 +02:00
Kernel/Devices: Remove the DeviceManagement singleton
This change has many improvements: - We don't use `LockRefPtr` to hold instances of many base devices as with the DeviceManagement class. Instead, we have a saner pattern of holding them in a `NonnullRefPtr<T> const`, in a small-text footprint class definition in the `Device.cpp` file. - The awkwardness of using `::the()` each time we need to get references to mostly-static objects (like the Event queue) in runtime is now gone in the migration to using the `Device` class. - Acquiring a device feel more obvious because we use now the Device class for this method. The method name is improved as well.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <Kernel/API/DeviceFileTypes.h>
|
||||
#include <Kernel/Devices/DeviceManagement.h>
|
||||
#include <Kernel/Devices/Device.h>
|
||||
#include <Kernel/Devices/Loop/LoopDevice.h>
|
||||
#include <Kernel/FileSystem/DevLoopFS/FileSystem.h>
|
||||
#include <Kernel/FileSystem/DevLoopFS/Inode.h>
|
||||
@@ -58,7 +58,7 @@ ErrorOr<NonnullRefPtr<Inode>> DevLoopFS::get_inode(InodeIdentifier inode_id) con
|
||||
return *m_root_inode;
|
||||
|
||||
unsigned loop_index = inode_index_to_loop_index(inode_id.index());
|
||||
auto device = DeviceManagement::the().get_device(DeviceNodeType::Block, 20, loop_index);
|
||||
auto device = Device::acquire_by_type_and_major_minor_numbers(DeviceNodeType::Block, 20, loop_index);
|
||||
VERIFY(device);
|
||||
|
||||
auto& loop_device = static_cast<LoopDevice&>(*device);
|
||||
|
||||
Reference in New Issue
Block a user