QUERY_LOGICAL_BLOCK_PROTECTION

The IOCTL queries whether the drive can support this feature, what Logical Block Protection (LBP) method is used, and where the protection information is included.

The lbp_capable field indicates whether the drive has logical block protection capability. The lbp_method field displays if LBP is enabled and what the protection method is. The LBP information length is shown in the lbp_info_length field. The fields of lbp_w, lbp_r, and rbdp present that the protection information is included in write, read, or recover buffer data.

The data structure that is used with this IOCTL is
struct logical_block_protection
{
   uchar lbp_capable;     /* [OUTPUT] the capability of lbp for QUERY ioctl only */
   uchar lbp_method;      /* lbp method used for QUERY [OUTPUT]and SET [INPUT] ioctls */
     #define  LBP_DISABLE           0x00
     #define  REED_SOLOMON_CRC      0x01
   uchar lbp_info_length; /* lbp info length for QUERY [OUTPUT] and SET [INPUT] ioctls */
   uchar lbp_w;           /* protection info included in write data */
                          /* a boolean for QUERY [OUTPUT] and SET [INPUT] ioctls */ 
   uchar lbp_r;           /* protection info included in read data */
                          /* a boolean for QUERY [OUTPUT] and SET [INPUT] ioctls */
   uchar rbdp;            /* protection info included in recover buffer data */ 
                          /* a boolean for QUERY [OUTPUT] and SET [INPUT] ioctls */
   uchar reserved[26];   
};
Examples of the QUERY_LOGICAL_BLOCK_PROTECTION IOCTL
#include <sys/Atape.h>

  struct logical_block_protection lbp_protect;

  printf("Querying Logical Block Protection....\n");

  if (ioctl(fd, QUERY_LOGICAL_BLOCK_PROTECTION, &lbp_protect) < 0)
      return errno;
  printf("  Logical Block Protection capable........ %d\n",lbp_protect.lbp_capable);  
  printf("  Logical Block Protection method.......... %d\n",lbp_protect.lbp_method);
  printf("  Logical Block Protection Info Length... %d\n",lbp_protect.lbp_info_length);
  printf("  Logical Block Protection for Write........ %d\n",lbp_protect.lbp_w);
  printf("  Logical Block Protection for Read....... %d\n",lbp_protect.lbp_r);
  printf("  Logical Block Protection for RBDP...... %d\n",lbp_protect.rbdp);