Skip to content

Commit

Permalink
Do not write data when executing VERIFY10/VERIFY16 (#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet authored Oct 22, 2023
1 parent 2ec4433 commit 02d18b3
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions cpp/controllers/scsi_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 02d18b3

Please sign in to comment.