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

Method ReportLuns

cpp/devices/primary_device.cpp:111–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111void PrimaryDevice::ReportLuns()
112{
113 // Only SELECT REPORT mode 0 is supported
114 if (GetController()->GetCmdByte(2)) {
115 throw scsi_exception(sense_key::illegal_request, asc::invalid_field_in_cdb);
116 }
117
118 const uint32_t allocation_length = GetInt32(GetController()->GetCmd(), 6);
119
120 vector<uint8_t>& buf = GetController()->GetBuffer();
121 fill_n(buf.begin(), min(buf.size(), static_cast<size_t>(allocation_length)), 0);
122
123 uint32_t size = 0;
124 for (int lun = 0; lun < GetController()->GetMaxLuns(); lun++) {
125 if (GetController()->HasDeviceForLun(lun)) {
126 size += 8;
127 buf[size + 7] = (uint8_t)lun;
128 }
129 }
130
131 SetInt16(buf, 2, size);
132
133 size += 8;
134
135 GetController()->SetLength(min(allocation_length, size));
136
137 EnterDataInPhase();
138}
139
140void PrimaryDevice::RequestSense()
141{

Callers

nothing calls this directly

Calls 8

scsi_exceptionClass · 0.85
GetInt32Function · 0.85
SetInt16Function · 0.85
GetCmdByteMethod · 0.80
GetCmdMethod · 0.80
GetMaxLunsMethod · 0.80
HasDeviceForLunMethod · 0.80
SetLengthMethod · 0.80

Tested by

no test coverage detected