Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 26, 2024
1 parent db04365 commit fc1b977
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
18 changes: 9 additions & 9 deletions cpp/s2pdump/s2pdump_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void S2pDumpExecutor::TestUnitReady() const
{
vector<uint8_t> cdb(6);

phase_executor->Execute(scsi_command::cmd_test_unit_ready, cdb, { }, 0);
initiator_executor->Execute(scsi_command::cmd_test_unit_ready, cdb, { }, 0);
}

bool S2pDumpExecutor::Inquiry(span<uint8_t> buffer, bool sasi)
Expand All @@ -27,15 +27,15 @@ bool S2pDumpExecutor::Inquiry(span<uint8_t> buffer, bool sasi)
cdb[3] = static_cast<uint8_t>(buffer.size() >> 8);
cdb[4] = static_cast<uint8_t>(buffer.size());

return phase_executor->Execute(scsi_command::cmd_inquiry, cdb, buffer, static_cast<int>(buffer.size()), sasi);
return initiator_executor->Execute(scsi_command::cmd_inquiry, cdb, buffer, static_cast<int>(buffer.size()), sasi);
}

pair<uint64_t, uint32_t> S2pDumpExecutor::ReadCapacity()
{
vector<uint8_t> buffer(14);
vector<uint8_t> cdb(10);

if (!phase_executor->Execute(scsi_command::cmd_read_capacity10, cdb, buffer, 8)) {
if (!initiator_executor->Execute(scsi_command::cmd_read_capacity10, cdb, buffer, 8)) {
return {0, 0};
}

Expand All @@ -48,7 +48,7 @@ pair<uint64_t, uint32_t> S2pDumpExecutor::ReadCapacity()
// READ CAPACITY(16), not READ LONG(16)
cdb[1] = 0x10;

if (!phase_executor->Execute(scsi_command::cmd_read_capacity16_read_long16, cdb, buffer,
if (!initiator_executor->Execute(scsi_command::cmd_read_capacity16_read_long16, cdb, buffer,
static_cast<int>(buffer.size()))) {
return {0, 0};
}
Expand All @@ -72,7 +72,7 @@ bool S2pDumpExecutor::ReadWrite(span<uint8_t> buffer, uint32_t bstart, uint32_t
cdb[3] = static_cast<uint8_t>(bstart);
cdb[4] = static_cast<uint8_t>(blength);

return phase_executor->Execute(is_write ? scsi_command::cmd_write6 : scsi_command::cmd_read6, cdb, buffer,
return initiator_executor->Execute(is_write ? scsi_command::cmd_write6 : scsi_command::cmd_read6, cdb, buffer,
length);
}
else {
Expand All @@ -84,7 +84,7 @@ bool S2pDumpExecutor::ReadWrite(span<uint8_t> buffer, uint32_t bstart, uint32_t
cdb[7] = static_cast<uint8_t>(blength >> 8);
cdb[8] = static_cast<uint8_t>(blength);

return phase_executor->Execute(is_write ? scsi_command::cmd_write10 : scsi_command::cmd_read10, cdb, buffer,
return initiator_executor->Execute(is_write ? scsi_command::cmd_write10 : scsi_command::cmd_read10, cdb, buffer,
length);
}
}
Expand All @@ -96,14 +96,14 @@ bool S2pDumpExecutor::ModeSense6(span<uint8_t> buffer)
cdb[2] = 0x3f;
cdb[4] = static_cast<uint8_t>(buffer.size());

return phase_executor->Execute(scsi_command::cmd_mode_sense6, cdb, buffer, static_cast<int>(buffer.size()));
return initiator_executor->Execute(scsi_command::cmd_mode_sense6, cdb, buffer, static_cast<int>(buffer.size()));
}

void S2pDumpExecutor::SynchronizeCache()
{
vector<uint8_t> cdb(10);

phase_executor->Execute(scsi_command::cmd_synchronize_cache10, cdb, { }, 0);
initiator_executor->Execute(scsi_command::cmd_synchronize_cache10, cdb, { }, 0);
}

set<int> S2pDumpExecutor::ReportLuns()
Expand All @@ -114,7 +114,7 @@ set<int> S2pDumpExecutor::ReportLuns()
cdb[9] = static_cast<uint8_t>(buffer.size());

// Assume 8 LUNs in case REPORT LUNS is not available
if (!phase_executor->Execute(scsi_command::cmd_report_luns, cdb, buffer, static_cast<int>(buffer.size()))) {
if (!initiator_executor->Execute(scsi_command::cmd_report_luns, cdb, buffer, static_cast<int>(buffer.size()))) {
trace("Target does not support REPORT LUNS");
return {0, 1, 2, 3, 4, 5, 6, 7};
}
Expand Down
6 changes: 3 additions & 3 deletions cpp/s2pdump/s2pdump_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class S2pDumpExecutor

S2pDumpExecutor(Bus &bus, int id)
{
phase_executor = make_unique<InitiatorExecutor>(bus, id);
initiator_executor = make_unique<InitiatorExecutor>(bus, id);
}
~S2pDumpExecutor() = default;

Expand All @@ -36,13 +36,13 @@ class S2pDumpExecutor

void SetTarget(int id, int lun)
{
phase_executor->SetTarget(id, lun);
initiator_executor->SetTarget(id, lun);
}

private:

static uint32_t GetInt32(span<uint8_t>, int = 0);
static uint64_t GetInt64(span<uint8_t>, int = 0);

unique_ptr<InitiatorExecutor> phase_executor;
unique_ptr<InitiatorExecutor> initiator_executor;
};
5 changes: 0 additions & 5 deletions cpp/s2pproto/s2pproto_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,3 @@ string S2pProtoExecutor::Execute(const string &filename, protobuf_format input_f

return "";
}

bool S2pProtoExecutor::ExecuteCommand(scsi_command cmd, vector<uint8_t> &cdb, vector<uint8_t> &buffer, bool sasi)
{
return initiator_executor->Execute(cmd, cdb, buffer, buffer.size(), sasi);
}
1 change: 0 additions & 1 deletion cpp/s2pproto/s2pproto_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class S2pProtoExecutor
~S2pProtoExecutor() = default;

string Execute(const string&, protobuf_format, PbResult&);
bool ExecuteCommand(scsi_command, vector<uint8_t>&, vector<uint8_t>&, bool);

void SetTarget(int id, int lun)
{
Expand Down

0 comments on commit fc1b977

Please sign in to comment.