MCPcopy Create free account
hub / github.com/PiSCSI/piscsi / AttachToController

Method AttachToController

cpp/controllers/controller_manager.cpp:24–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24bool ControllerManager::AttachToController(BUS& bus, int id, shared_ptr<PrimaryDevice> device)
25{
26 if (auto controller = FindController(id); controller != nullptr) {
27 if (controller->HasDeviceForLun(device->GetLun())) {
28 return false;
29 }
30
31 return controller->AddDevice(device);
32 }
33
34 // If this is LUN 0 create a new controller
35 if (!device->GetLun()) {
36 if (auto controller = CreateScsiController(bus, id); controller->AddDevice(device)) {
37 controllers[id] = controller;
38
39 return true;
40 }
41 }
42
43 return false;
44}
45
46bool ControllerManager::DeleteController(const AbstractController& controller)
47{

Callers 6

TESTFunction · 0.80
TESTFunction · 0.80
TestNonDiskDeviceFunction · 0.80
TESTFunction · 0.80
TESTFunction · 0.80
AttachMethod · 0.80

Calls 3

HasDeviceForLunMethod · 0.80
AddDeviceMethod · 0.80
GetLunMethod · 0.45

Tested by 5

TESTFunction · 0.64
TESTFunction · 0.64
TestNonDiskDeviceFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64