STIOC_SET_SPDEV
With the latest lin_tape versions, the IBMSpecial device is created. It allows the use of ioctls for preemption purposes. Applications must use it cautiously and manage persistent reservation properly.
This ioctl is for usage through IBMSpecial open handle only. It sets the drive that processes the command requests, and to do so it needs the serial number of the drive as input. If /dev/IBMSpecial is not created, it is not supported.
The data structure
is
#define DD_MAX_DEVICE_SERIAL 36
struct sp_dev{
char device_serial[DD_MAX_DEVICE_SERIAL];
};
An example of the STIOC_SET_SPDEV command
is
#include <sys/IBM_tape.h>
struct sp_dev spd;
setDriveSN(spd.device_serial);
if (!ioctl (fd, STIOC_SET_SPDEV, &spd)) {
printf ("The STIOC_SET_SPDEV ioctl succeeded\n");
}
else {
perror ("The STIOC_SET_SPDEV ioctl failed the drive to work with was not set");
}
When the STIOC_SET_SPDEV ioctl succeeds, it is possible to send any of these ioctls to the drive previously set and identified by serial number: STIOC_READ_RESERVEKEYS, STIOC_READ_RESERVATIONS, STIOC_REGISTER_KEY, STIOC_REMOVE_REGISTRATION, STIOC_CLEAR_ALL_REGSITRATION.