The QUERY_PARTITION IOCTL is used to return partition information for the tape drive and the current media in the tape drive. It includes the current active partition the tape drive is using for the media. The number_of partitions field is the current number of partitions on the media and the max_partitions is the maximum partitions that the tape drive supports. The size_unit field can be either one of the defined values or another value such as 8. It is used with the size array field value for each partition to specify the actual size partition sizes. The partition_method field is either Wrap-wise Partitioning or Longitudinal Partitioning. Refer to CREATE_PARTITION for details.

The data structure that is used with this IOCTL is
The define for “partition_method”:
#define UNKNOWN_TYPE                       0 /* vendor-specific or unknown          */
#define WRAP_WISE_PARTITION                1 /* Wrap-wise Partitioning without RABF */
#define LONGITUDINAL_PARTITION             2 /* Longitudinal Partitioning           */
#define WRAP_WISE_PARTITION_WITH_FASTSYNC  3 /* Wrap-wise Partitioning with RABF    */
The define for "size_unit":
#define SIZE_UNIT_BYTES     0      /* Bytes                              */
#define SIZE_UNIT_KBYTES    3      /* Kilobytes                          */
#define SIZE_UNIT_MBYTES    6      /* Megabytes                          */
#define SIZE_UNIT_GBYTES    9      /* Gigabytes                          */
#define SIZE_UNIT_TBYTES   12      /* Terabytes                          */

struct query_partition {
  uchar max_partitions;           /* Max number of supported partitions      */
  uchar active_partition;         /* current active partition on tape        */
  uchar number_of_partitions;     /* Number of partitions from 1 to max      */
  uchar size_unit;                /* Size unit of partition sizes below      */
  ushort size[MAX_PARTITIONS];    /* Array of partition sizes in size units  */
                                  /* for each partition, 0 to (number - 1)   */
  uchar partition_method;         /* partitioning type                       */
  char reserved [31];
#include <sys/Atape.h>

  struct query_partition partition;
  int i;

  if (ioctl(fd, QUERY_PARTITION, &partition) < 0)
     return errno;

  printf("  Max supported partitions ... %d\n",partition.max_partitions);
  printf("  Number of partitions ....... %d\n",partition.number_of_partitions);
  printf("  Active partition ........... %d\n",partition.active_partition);
  printf(" Partition Method ......... %d\n",partition.partition_method);
  if (partition.size_unit == SIZE_UNIT_BYTES)
    printf("  Partition size unit ........ Bytes\n");
  else if  (partition.size_unit == SIZE_UNIT_KBYTES)
    printf("  Partition size unit ........ Kilobytes\n");
  else if  (partition.size_unit == SIZE_UNIT_MBYTES)
    printf("  Partition size unit ........ Megabytes\n");
  else if  (partition.size_unit == SIZE_UNIT_GBYTES
    printf("  Partition size unit ........ Gigabytes\n");
  else if  (partition.size_unit == SIZE_UNIT_TBYTES)
    printf("  Partition size unit ........ Terabytes\n");
    printf("  Partition size unit ........ %d\n",partition.size_unit);

  for (i=0; i < partition.number_of_partitions; i++)
    printf("  Partition %d size ........... %d\n",i,partition.size[i]);