SET_ACTIVE_PARTITION
The SET_ACTIVE_PARTITION IOCTL is used to position the tape to a specific partition. Then, it becomes the current active partition for subsequent commands and a specific logical bock id in the partition. To position to the beginning of the partition, the logical_block_id field is set to 0.
The data structure that is used with this IOCTL is
struct set_active_partition {
uchar partition_number; /* Partition number 0-n to change to */
ullong logical_block_id; /* Blockid to locate to within partition */
char reserved[32];
};
Examples of the SET_ACTIVE_PARTITION IOCTL
#include <sys/Atape.h>
struct set_active_partition partition;
/* position the tape to partition 1 and logical block id 12 */
partition.partition_number = 1;
partition.logical_block_id = 12;
ioctl(fd, SET_ACTIVE_PARTITION, &partition);
/* position the tape to the beginning of partition 0 */
partition.partition_number = 0;
partition.logical_block_id = 0;
ioctl(fd, SET_ACTIVE_PARTITION, &partition);