1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:18:12 +00:00
serenity/Kernel/Storage/RamdiskDevice.h
Brian Gianforcaro 70ad18fbcd Kernel: Remove most String usage from storage_name() API
This change is another minor step towards removing `AK::String` from
the Kernel. Instead of dynamically allocating the storage_name we can
instead allocate it via a KString in the factory for each device, and
then push the device name down into the StorageDevice base class.

We don't have a way of doing `AK::String::formatted(..)` with a KString
at the moment, so cleaning that up will be left for a later day.
2021-10-03 13:36:10 +02:00

38 lines
960 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;
AK_MAKE_ETERNAL
public:
static NonnullRefPtr<RamdiskDevice> create(const RamdiskController&, NonnullOwnPtr<Memory::Region>&& region, int major, int minor);
virtual ~RamdiskDevice() override;
// ^DiskDevice
virtual StringView class_name() const override;
private:
RamdiskDevice(const RamdiskController&, NonnullOwnPtr<Memory::Region>&&, int major, int minor, NonnullOwnPtr<KString> device_name);
// ^BlockDevice
virtual void start_request(AsyncBlockDeviceRequest&) override;
Mutex m_lock { "RamdiskDevice" };
NonnullOwnPtr<Memory::Region> m_region;
};
}