scsi compare and write command code example

Example: compare and write in scsi

Send the SCSI COMPARE AND WRITE command to DEVICE. This command  receives  a  data  buffer
       which  contains  a  verify  instance  and a write instance each containing num blocks, the
       DEVICE will read num blocks starting at logical block address LBA, compare the  data  read
       from  the  specified  blocks  to  the  verify  instance and if they match, write the write
       instance to the DEVICE at the same logical block address LBA.  All of the above operations
       shall be performed as an uninterrupted series of actions.

       The  data buffer which contains the verify and write instances are obtained from the input
       file IF, this file is expected to be 2*num blocks long. If bs is not specified, then  READ
       CAPACITY(10) is used to determine the block size. If not specified, the transfer size will
       be the 2*num blocks.

       In case of a mismatch between the blocks read from DEVICE and the verify instance  in  the
       data buffer, a check condition will be returned with sense key set to miscompare.

       This  command  is defined in SBC-3 whose most recent revision is 35d. SBC-3 and other SCSI
       documents can be found at http://www.t10.org .

Tags:

Misc Example