1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 12:55:08 +00:00
serenity/Kernel/Storage/Ramdisk/Device.h
Timon Kruiper 187723776a Revert "Kernel/Storage: Remove the ramdisk implementation"
This reverts commit 4e0f85432a as the
ramdisk code is useful for the bring-up of the aarch64 port. Once the
kernel supports better ram-based filesystems, this code will be removed
again.
2023-02-08 18:19:48 +00:00

41 lines
1,022 B
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);
// ^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;
};
}