summaryrefslogtreecommitdiff
path: root/Kernel/Storage/StorageController.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-04-22 18:52:20 +0300
committerAndreas Kling <kling@serenityos.org>2022-07-15 12:29:23 +0200
commit4744ccbff0a165b05c2c4b6978cb1aa78aca80f7 (patch)
tree991558947b8e90a7804c853e6f2bb3b57f9a7954 /Kernel/Storage/StorageController.cpp
parentb49af59b4a3920b912ed6d06b2c8ba8c10492854 (diff)
downloadserenity-4744ccbff0a165b05c2c4b6978cb1aa78aca80f7.zip
Kernel/Storage: Add LUN address to each StorageDevice
LUN address is essentially how people used to address SCSI devices back in the day we had these devices more in use. However, SCSI was taken as an abstraction layer for many Unix and Unix-like systems, so it still common to see LUN addresses in use. In Serenity, we don't really provide such abstraction layer, and therefore until now, we didn't use LUNs too. However (again), this changes, as we want to let users to address their devices under SysFS easily. LUNs make sense in that regard, because they can be easily adapted to different interfaces besides SCSI. For example, for legacy ATA hard drive being connected to the first IDE controller which was enumerated on the PCI bus, and then to the primary channel as slave device, the LUN address would be 0:0:1. To make this happen, we add unique ID number to each StorageController, which increments by 1 for each new instance of StorageController. Then, we adapt the ATA and NVMe devices to use these numbers and generate LUN in the construction time.
Diffstat (limited to 'Kernel/Storage/StorageController.cpp')
-rw-r--r--Kernel/Storage/StorageController.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Kernel/Storage/StorageController.cpp b/Kernel/Storage/StorageController.cpp
new file mode 100644
index 0000000000..739c1ec1ae
--- /dev/null
+++ b/Kernel/Storage/StorageController.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <Kernel/Storage/StorageController.h>
+#include <Kernel/Storage/StorageManagement.h>
+
+namespace Kernel {
+
+StorageController::StorageController()
+ : m_controller_id(StorageManagement::generate_controller_id())
+{
+}
+
+}