VERIFY_TAPE_DATA

The IOCTL issues a VERIFY command. This command causes data to be read from the tape and passed through the drive’s error detection and correction hardware. This action determines whether it can be recovered from the tape, whether the protection information is present, and validates correctly on logical block on the medium. The driver returns the IOCTL a failure or a success if the VERIFY SCSI command is completed in a Good SCSI status.
Note:
  1. When an application sets the VBF method, it considers the driver’s close operation in which the driver can write filemarks in its close, which the application did not explicitly request. For example, some drivers write two consecutive filemarks that mark the end of data on the tape in its close, if the last tape operation was a WRITE command.
  2. Per the user's or application's request, Atape driver sets the block size in the field of Block Length in mode block descriptor for Read and Write commands. Then, it maintains this block size setting in a whole open. For instance, the tape driver sets a zero in the Block Length field for the variable block size. This act causes the missing of an overlength condition on a SILI Read. Block Length must be set to a non-zero value.

    Before Fixed bit is set to ON with VTE or VBF ON in Verify IOCTL, the application is requested to set the block size in mode block descriptor. Then, the drive uses it to verify the length of each logical block. For example, a 256 KB length is set in Block Length field to verify the data. The setup overrides the early setting from IBM® tape driver.

    When the application completes the Verify IOCTL call, the original block size setting must be restored for Read and Write commands, the application either issues set block size IOCTL. Or, it closes the drive immediately and reopens the drive for the next tape operation. It is recommended to reopen the drive for the next tape operation. Otherwise, it causes next Read and Write command misbehavior.

  3. To support DPF for Verify command with FIXED bit on, it is requested to issue an IBM tape driver to set blksize in STIOCSETP IOCTL. IBM tape driver sets the block length in mode block descriptor same as the block size and save the block size in kernel memory. The driver restores the block length before it tries the Verify SCSI command again. Otherwise, it causes the Verify command to fail.
  4. The IOCTL can be returned longer than the timeout when DPF occurs.
The structure is defined for this IOCTL as
struct verify_data
{
  uint     : 2, /* reserved */
        vte: 1, /* [IN] verify to end-of-data */
      vlbpm: 1, /* [IN] verify logical block protection info */
        vbf: 1, /* [IN] verify by filemarks */
      immed: 1, /* [IN] return SCSI status immediately */
     bytcmp: 1, /* No use currently */
      fixed: 1; /* [IN] set Fixed bit to verify the length of each logical block */
uchar reseved[15];
uint verify_length; /* [IN] amount of data to be verified */
} ;
An example of the VERIFY_TAPE_DATA command is to verify all of logical block from the current position to end of data. It includes a verification that each logical block uses the logical block protection method that is specified in the Control Data Protection mode page, when vte is set to 1 with vlbpm on.
#include <sys/Atape.h>

int rc;
struct verify_data vrf_data;

memset(&vrf_data,0,sizeof(struct verify_data)); 
vrf_data.vte=1; 
vrf_data.vlbpm=1; 
vrf_data.vbf=0; 
vrf_data.immed=0; 
vrf_data.fixed=0; 
vrf_data.verify_length=0; 

printf("Verify Tape Data command ....\n"); 
rc=ioctl(fd,VERIFY_TAPE_DATA, &vrf_data); 

if (rc)
 printf ("Verify Tape Data failed (rc %d)",rc); 
else printf
 ("Verify Tape Data Succeeded!");