Do not write data when executing VERIFY10/VERIFY16 (#1250)

This commit is contained in:
Uwe Seimet 2023-10-22 16:18:33 +02:00 committed by GitHub
parent 2ec44332d0
commit 02d18b3359
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -813,9 +813,6 @@ bool ScsiController::XferOutBlockOriented(bool cont)
case scsi_command::eCmdWrite6:
case scsi_command::eCmdWrite10:
case scsi_command::eCmdWrite16:
// TODO Verify has to verify, not to write, see https://github.com/PiSCSI/piscsi/issues/807
case scsi_command::eCmdVerify10:
case scsi_command::eCmdVerify16:
{
// TODO Get rid of this special case for SCBR
if (auto bridge = dynamic_pointer_cast<SCSIBR>(device); bridge) {
@ -853,12 +850,29 @@ bool ScsiController::XferOutBlockOriented(bool cont)
// If you do not need the next block, end here
IncrementNext();
if (!cont) {
break;
if (cont) {
SetLength(disk->GetSectorSizeInBytes());
ResetOffset();
}
break;
}
case scsi_command::eCmdVerify10:
case scsi_command::eCmdVerify16:
{
auto disk = dynamic_pointer_cast<Disk>(device);
if (disk == nullptr) {
return false;
}
// If you do not need the next block, end here
IncrementNext();
if (cont) {
SetLength(disk->GetSectorSizeInBytes());
ResetOffset();
}
SetLength(disk->GetSectorSizeInBytes());
ResetOffset();
break;
}