SMCIOC_EXCHANGE_MEDIUM

This IOCTL command exchanges a cartridge in an element with another cartridge. This command is equivalent to two SCSI Move Medium commands. The first moves the cartridge from the source element to the destination1 element. The second moves the cartridge that was previously in the destination1 element to the destination 2 element. This function is available only in the IBM® 3584 UltraScalable tape library. The destination2 element can be the same as the source element.

The input data structure is
struct exchange_medium {
   ushort robot;        /* robot address */
   ushort source;       /* source address for exchange */
   ushort destination1; /* first destination address for exchange */
   ushort destination2; /* second destination address for exchange */
   char   invert1;      /* invert before placement into destination1 */
   char   invert2;      /* invert before placement into destination2 */
};
An example of the SMCIOC_EXCHANGE_MEDIUM command is
#include <sys/IBM_tape.h>
struct exchange_medium exchange_medium;
exchange_medium.robot = 0;
exchange_medium.invert1 = 0;
exchange_medium.invert2 = 0;
exchange_medium.source = 32;       /* slot 32 */
exchange_medium.destination1 = 16; /* drive address 16 */
exchange_medium.destination2 = 35; /* slot 35 */

/* exchange cartridge in drive address 16 with cartridge from */
/* slot 32 and return the cartridge currently in the drive to */
/* slot 35 */
if (!ioctl (smcfd, SMCIOC_EXCHANGE_MEDIUM, &exchange_medium))
   printf("The SMCIOC_EXCHANGE_MEDIUM ioctl succeeded\n");
else {
	perror ("The SMCIOC_EXCHANGE_MEDIUM ioctl failed");
		smcioc_request_sense();
}