Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Nov 6, 2024
1 parent 5cb8b4f commit 8aee1fd
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ I am also the author of the <a href="https://www.hddriver.net">HDDRIVER driver s

# How is SCSI2Pi related to PiSCSI?

In the PiSCSI project there was not much interest in replacing old, often buggy or unnecessary code, or to improve the data transfer rates. Long promised features on the roadmap and user requests in tickets were not addressed, and it took long for features or bug fixes to make it into a release. This is why I started to work on the emulation in a separate project, while staying compatible with the PiSCSI web interface. The major part of the PiSCSI C++ codebase has been contributed by me anyway. SCSI2Pi is not meant to completely replace the PiSCSI software, but only the device emulation and the tools.<br />
In the PiSCSI project there was not much interest in replacing old, often buggy or unnecessary code, or to improve the data transfer rates. Long promised features on the roadmap and user requests in tickets were not addressed, and it took long for features or bug fixes to make it into a release. This is why I started to work on the emulation in a separate project, while staying compatible with the PiSCSI web interface. The major part of the PiSCSI C++ codebase has been contributed by me anyway. SCSI2Pi is not meant to fully replace/extend the PiSCSI software, but only the device emulation and the tools.<br />
With PiSCSI there was also not much interest in further developing the SCSI emulation and exploiting the initiator mode feature of the FULLSPEC board. This mode, together with new SCSI2Pi command line tools, offers solutions for use cases that have never been addressed before. These tools also help with advanced testing, making the emulation more robust and reliable.<br />
The SCSI2Pi website offers an <a href="https://www.scsi2pi.net/en/piscsi_comparison.html">overview on differences between SCSI2Pi and PiSCSI</a>.
2 changes: 1 addition & 1 deletion cpp/base/property_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void PropertyHandler::Init(const string &filenames, const property_map &cmd_prop

property_map properties;

// Always parse the optional global property file
// Parse the optional global property file unless disabled
if (!ignore_conf && exists(path(CONFIGURATION))) {
ParsePropertyFile(properties, CONFIGURATION, true);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/controllers/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ void Controller::LogCdb() const
{
const auto opcode = static_cast<scsi_command>(GetCdb()[0]);
const string_view &command_name = BusFactory::Instance().GetCommandName(opcode);
string s = fmt::format("Controller is executing {}, CDB $",
string s = fmt::format("Controller is executing {}, CDB ",
!command_name.empty() ? command_name : fmt::format("{:02x}", GetCdb()[0]));
for (int i = 0; i < BusFactory::Instance().GetCommandBytesCount(opcode); i++) {
if (i) {
Expand Down
1 change: 0 additions & 1 deletion cpp/devices/host_services.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ void HostServices::AddRealtimeClockPage(map<int, vector<byte>> &pages, bool chan

int HostServices::WriteData(span<const uint8_t> buf, scsi_command command)
{
assert(command == scsi_command::execute_operation);
if (command != scsi_command::execute_operation) {
throw scsi_exception(sense_key::aborted_command);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/storage_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void StorageDevice::ModeSelect(cdb_t cdb, span<const uint8_t> buf, int length)
{
// PF
if (!(cdb[1] & 0x10)) {
// Vendor-specific parameters (SCSI-1) are not supported.
// Vendor-specific parameters (all parameters in SCSI-1 are vendor-specific) are not supported.
// Do not report an error in order to support Apple's HD SC Setup.
return;
}
Expand Down
18 changes: 3 additions & 15 deletions cpp/devices/tape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,23 +349,11 @@ void Tape::AddDeviceConfigurationPage(map<int, vector<byte>> &pages, bool change

void Tape::AddMediumPartitionPage(map<int, vector<byte> > &pages, bool changeable) const
{
vector<byte> buf(10);
vector<byte> buf(8);

if (!changeable) {
// Maximum additional partitions
buf[2] = (byte)1;

// PSUM (descriptor unit in MB)
buf[4] = (byte)0b00010000;

// Logical unit is capable of format and partition recognition
buf[5] = (byte)0x03;

// Approximate partition size in MB
if (IsReady()) {
const auto capacity = static_cast<uint32_t>(GetFileSize()) / 1048576;
SetInt16(buf, 8, capacity > 0 ? capacity : 1);
}
// Fixed data partitions, PSUM (descriptor unit in MB)
buf[4] = (byte)0b10010000;
}

pages[17] = buf;
Expand Down
13 changes: 12 additions & 1 deletion cpp/test/controller_factory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,18 @@ TEST(ControllerFactoryTest, AttachToController)

TEST(ControllerFactoryTest, ProcessOnController)
{
const int VALID_ID = 0;
const int INVALID_ID = 1;

MockBus bus;
ControllerFactory controller_factory;

EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(0));
EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(VALID_ID));

const auto device = make_shared<MockPrimaryDevice>(0);
EXPECT_TRUE(controller_factory.AttachToController(bus, VALID_ID, device));

EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(VALID_ID));

EXPECT_EQ(shutdown_mode::none, controller_factory.ProcessOnController(INVALID_ID));
}
2 changes: 2 additions & 0 deletions cpp/test/host_services_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ TEST(HostServicesTest, WriteData)
auto [controller, services] = CreateDevice(SCHS);
array<uint8_t, 1> buf = { };

EXPECT_THROW(services->WriteData(buf, scsi_command::test_unit_ready), scsi_exception)<< "Illegal command";

EXPECT_EQ(0, services->WriteData(buf, scsi_command::execute_operation));

controller->SetCdbByte(8, 1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/tape_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void ValidateModePages(map<int, vector<byte>> &pages)
EXPECT_EQ(8U, pages[10].size());
EXPECT_EQ(16U, pages[15].size());
EXPECT_EQ(16U, pages[16].size());
EXPECT_EQ(10U, pages[17].size());
EXPECT_EQ(8U, pages[17].size());
}

static void CheckPosition(AbstractController &controller, PrimaryDevice &tape, uint32_t position)
Expand Down
2 changes: 1 addition & 1 deletion doc/s2pctl.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH s2p 1
.TH s2pctl 1
.SH NAME
s2pctl \- SCSI2Pi Server Controller Tool
.SH SYNOPSIS
Expand Down

0 comments on commit 8aee1fd

Please sign in to comment.