Cleaned up dependencies on controller manager (#964)

* Cleaned up dependencies on controller manager

* Removed global fields

* Simplified setting up RascsiResponse and RascsiExecutor

* Got rid of remaining raw pointers

* Use references instead of pointers

* Improved encapsulation
This commit is contained in:
Uwe Seimet
2022-11-04 08:22:32 +01:00
committed by GitHub
parent 921ba7d2ed
commit c98c52ffb8
44 changed files with 1071 additions and 965 deletions

View File

@@ -23,7 +23,7 @@ bool ControllerManager::AttachToScsiController(int id, shared_ptr<PrimaryDevice>
// If there is no LUN yet the first LUN must be LUN 0
if (device->GetLun() == 0) {
controller = make_shared<ScsiController>(bus, id);
controller = make_shared<ScsiController>(shared_from_this(), id);
if (controller->AddDevice(device)) {
controllers[id] = controller;
@@ -74,13 +74,6 @@ void ControllerManager::DeleteAllControllers()
controllers.clear();
}
void ControllerManager::ResetAllControllers() const
{
for (const auto& [id, controller] : controllers) {
controller->Reset();
}
}
shared_ptr<PrimaryDevice> ControllerManager::GetDeviceByIdAndLun(int id, int lun) const
{
if (const auto& controller = FindController(id); controller != nullptr) {