summaryrefslogtreecommitdiff
path: root/Kernel/Storage/Ramdisk/Device.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-03-19 11:55:55 +0200
committerLinus Groh <mail@linusgroh.de>2022-03-19 13:41:06 +0000
commit462618b68c0b11d169262c30e4cdad9e4065f059 (patch)
tree7adca89ba83740bc883cf4b589bab44dc29ec941 /Kernel/Storage/Ramdisk/Device.h
parentf5acef0b81690232efb4ea8c7a7701c2aadf2e79 (diff)
downloadserenity-462618b68c0b11d169262c30e4cdad9e4065f059.zip
Kernel/Storage: Move Ramdisk code into a separate subdirectory
Diffstat (limited to 'Kernel/Storage/Ramdisk/Device.h')
-rw-r--r--Kernel/Storage/Ramdisk/Device.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/Kernel/Storage/Ramdisk/Device.h b/Kernel/Storage/Ramdisk/Device.h
new file mode 100644
index 0000000000..7d611cfdc9
--- /dev/null
+++ b/Kernel/Storage/Ramdisk/Device.h
@@ -0,0 +1,41 @@
+/*
+ * 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 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;
+
+ // ^StorageDevice
+ virtual CommandSet command_set() const override { return CommandSet::PlainMemory; }
+
+ Mutex m_lock { "RamdiskDevice" };
+
+ NonnullOwnPtr<Memory::Region> m_region;
+};
+
+}