1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

Kernel: Make self-contained locking smart pointers their own classes

Until now, our kernel has reimplemented a number of AK classes to
provide automatic internal locking:

- RefPtr
- NonnullRefPtr
- WeakPtr
- Weakable

This patch renames the Kernel classes so that they can coexist with
the original AK classes:

- RefPtr => LockRefPtr
- NonnullRefPtr => NonnullLockRefPtr
- WeakPtr => LockWeakPtr
- Weakable => LockWeakable

The goal here is to eventually get rid of the Lock* classes in favor of
using external locking.
This commit is contained in:
Andreas Kling 2022-08-19 20:53:40 +02:00
parent e475263113
commit 11eee67b85
360 changed files with 1703 additions and 1672 deletions

View file

@ -6,14 +6,14 @@
#pragma once
#include <AK/NonnullRefPtr.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <AK/RefPtr.h>
#include <AK/Time.h>
#include <AK/Tuple.h>
#include <AK/Types.h>
#include <Kernel/Bus/PCI/Device.h>
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Library/NonnullLockRefPtr.h>
#include <Kernel/Library/NonnullLockRefPtrVector.h>
#include <Kernel/Locking/Spinlock.h>
#include <Kernel/Memory/TypedMapping.h>
#include <Kernel/Storage/NVMe/NVMeDefinitions.h>
@ -26,10 +26,10 @@ namespace Kernel {
class NVMeController : public PCI::Device
, public StorageController {
public:
static ErrorOr<NonnullRefPtr<NVMeController>> try_initialize(PCI::DeviceIdentifier const&, bool is_queue_polled);
static ErrorOr<NonnullLockRefPtr<NVMeController>> try_initialize(PCI::DeviceIdentifier const&, bool is_queue_polled);
ErrorOr<void> initialize(bool is_queue_polled);
explicit NVMeController(PCI::DeviceIdentifier const&);
RefPtr<StorageDevice> device(u32 index) const override;
LockRefPtr<StorageDevice> device(u32 index) const override;
size_t devices_count() const override;
protected:
@ -68,10 +68,10 @@ private:
private:
PCI::DeviceIdentifier m_pci_device_id;
RefPtr<NVMeQueue> m_admin_queue;
NonnullRefPtrVector<NVMeQueue> m_queues;
NonnullRefPtrVector<NVMeNameSpace> m_namespaces;
Memory::TypedMapping<volatile ControllerRegister> m_controller_regs;
LockRefPtr<NVMeQueue> m_admin_queue;
NonnullLockRefPtrVector<NVMeQueue> m_queues;
NonnullLockRefPtrVector<NVMeNameSpace> m_namespaces;
Memory::TypedMapping<ControllerRegister volatile> m_controller_regs;
bool m_admin_queue_ready { false };
size_t m_device_count { 0 };
AK::Time m_ready_timeout;