mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-27 17:48:29 +00:00
Revert "Multiple fixes for ModeSelect (#1405)"
This reverts commit ad5eae93e7
.
This commit is contained in:
parent
594e5b052a
commit
f50959d72d
|
@ -40,8 +40,7 @@ string scsi_command_util::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uin
|
||||||
}
|
}
|
||||||
length -= offset;
|
length -= offset;
|
||||||
|
|
||||||
// treat zero length as valid
|
bool has_valid_page_code = false;
|
||||||
bool has_valid_page_code = (length == 0);
|
|
||||||
|
|
||||||
// Parse the pages
|
// Parse the pages
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
|
@ -63,10 +62,6 @@ string scsi_command_util::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uin
|
||||||
|
|
||||||
has_valid_page_code = true;
|
has_valid_page_code = true;
|
||||||
}
|
}
|
||||||
else if (page == 0x01) {
|
|
||||||
// OpenVMS Alpha 7.3 uses this
|
|
||||||
has_valid_page_code = true;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
stringstream s;
|
stringstream s;
|
||||||
s << "Unknown MODE SELECT page code: $" << setfill('0') << setw(2) << hex << page;
|
s << "Unknown MODE SELECT page code: $" << setfill('0') << setw(2) << hex << page;
|
||||||
|
@ -76,7 +71,7 @@ string scsi_command_util::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uin
|
||||||
// Advance to the next page
|
// Advance to the next page
|
||||||
const int size = buf[offset + 1] + 2;
|
const int size = buf[offset + 1] + 2;
|
||||||
|
|
||||||
length -= size + 1;
|
length -= size;
|
||||||
offset += size;
|
offset += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,6 @@ TEST(ScsiCommandUtilTest, ModeSelect6)
|
||||||
Property(&scsi_exception::get_asc, asc::invalid_field_in_parameter_list))))
|
Property(&scsi_exception::get_asc, asc::invalid_field_in_parameter_list))))
|
||||||
<< "Unsupported page 0 was not rejected";
|
<< "Unsupported page 0 was not rejected";
|
||||||
|
|
||||||
// Page 1
|
|
||||||
buf[12] = 0x01;
|
|
||||||
EXPECT_NO_THROW(ModeSelect(scsi_command::eCmdModeSelect6, cdb, buf, LENGTH, 512))
|
|
||||||
<< "Page 1 is supported";
|
|
||||||
|
|
||||||
// Page 3 (Format Device Page)
|
// Page 3 (Format Device Page)
|
||||||
buf[12] = 0x03;
|
buf[12] = 0x03;
|
||||||
EXPECT_THAT([&] { ModeSelect(scsi_command::eCmdModeSelect6, cdb, buf, LENGTH, 512); },
|
EXPECT_THAT([&] { ModeSelect(scsi_command::eCmdModeSelect6, cdb, buf, LENGTH, 512); },
|
||||||
|
@ -67,25 +62,7 @@ TEST(ScsiCommandUtilTest, ModeSelect6)
|
||||||
Property(&scsi_exception::get_asc, asc::invalid_field_in_parameter_list))))
|
Property(&scsi_exception::get_asc, asc::invalid_field_in_parameter_list))))
|
||||||
<< "Not enough command parameters";
|
<< "Not enough command parameters";
|
||||||
|
|
||||||
// check length computation
|
EXPECT_FALSE(ModeSelect(scsi_command::eCmdModeSelect6, cdb, buf, LENGTH, 512).empty());
|
||||||
buf[3] = 8;
|
|
||||||
buf[10] = 2;
|
|
||||||
buf[12] = 1;
|
|
||||||
buf[13] = 10;
|
|
||||||
buf[14] = 0x24;
|
|
||||||
buf[24] = 0;
|
|
||||||
EXPECT_NO_THROW(ModeSelect(scsi_command::eCmdModeSelect6, cdb, buf, LENGTH, 512))
|
|
||||||
<< "Multi-page length computation";
|
|
||||||
|
|
||||||
// check length computation
|
|
||||||
buf[3] = 8;
|
|
||||||
buf[10] = 12;
|
|
||||||
buf[12] = 0;
|
|
||||||
buf[13] = 0;
|
|
||||||
buf[14] = 0;
|
|
||||||
buf[24] = 0;
|
|
||||||
EXPECT_NO_THROW(ModeSelect(scsi_command::eCmdModeSelect6, cdb, buf, 12, 512))
|
|
||||||
<< "Empty ModeSelect6";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ScsiCommandUtilTest, ModeSelect10)
|
TEST(ScsiCommandUtilTest, ModeSelect10)
|
||||||
|
@ -134,6 +111,8 @@ TEST(ScsiCommandUtilTest, ModeSelect10)
|
||||||
Property(&scsi_exception::get_sense_key, sense_key::illegal_request),
|
Property(&scsi_exception::get_sense_key, sense_key::illegal_request),
|
||||||
Property(&scsi_exception::get_asc, asc::invalid_field_in_parameter_list))))
|
Property(&scsi_exception::get_asc, asc::invalid_field_in_parameter_list))))
|
||||||
<< "Not enough command parameters";
|
<< "Not enough command parameters";
|
||||||
|
|
||||||
|
EXPECT_FALSE(ModeSelect(scsi_command::eCmdModeSelect10, cdb, buf, LENGTH, 512).empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ScsiCommandUtilTest, EnrichFormatPage)
|
TEST(ScsiCommandUtilTest, EnrichFormatPage)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user