1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 09:07:44 +00:00
serenity/Kernel/Storage/Ramdisk/Device.h
Andreas Kling 11eee67b85 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.
2022-08-20 17:20:43 +02:00

41 lines
1 KiB
C++

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <Kernel/Locking/Mutex.h>
#include <Kernel/Storage/StorageDevice.h>
namespace Kernel {
class RamdiskController;
class RamdiskDevice final : public StorageDevice {
friend class RamdiskController;
friend class DeviceManagement;
public:
static NonnullLockRefPtr<RamdiskDevice> create(RamdiskController const&, NonnullOwnPtr<Memory::Region>&& region, int major, int minor);
virtual ~RamdiskDevice() override;
// ^DiskDevice
virtual StringView class_name() const override;
private:
RamdiskDevice(RamdiskController const&, NonnullOwnPtr<Memory::Region>&&, int major, int minor, NonnullOwnPtr<KString> device_name);
// ^BlockDevice
virtual void start_request(AsyncBlockDeviceRequest&) override;
// ^StorageDevice
virtual CommandSet command_set() const override { return CommandSet::PlainMemory; }
Mutex m_lock { "RamdiskDevice"sv };
NonnullOwnPtr<Memory::Region> m_region;
};
}