From 02d18b33592ec522c65936b35dc57848c61fa9ba Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Sun, 22 Oct 2023 16:18:33 +0200 Subject: [PATCH] Do not write data when executing VERIFY10/VERIFY16 (#1250) --- cpp/controllers/scsi_controller.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/cpp/controllers/scsi_controller.cpp b/cpp/controllers/scsi_controller.cpp index e6acca41a7..9d90d267df 100644 --- a/cpp/controllers/scsi_controller.cpp +++ b/cpp/controllers/scsi_controller.cpp @@ -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(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(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; }