autochanger.7 (2010 09)

a
autochanger(7) autochanger(7)
DEFAULT CONFIGURATIONS
By default, schgr and eschgr are not included in the system configuration (
/stand/system
) file.
EXAMPLES
The following example uses the
SIOC_ELEMENT_ADDRESSES
and SIOC_ELEMENT_STATUS ioctl
functions to get bus address information about the drives in an autochanger device:
int last_drive_el;
struct element_addresses el_addrs;
struct element_status el_stat; drive[1024];
int fd = -1, error = 0, i = 0;
fd = open("/dev/rchgr/autoch0",O_RDWR);
if ((error = ioctl(fd, SIOC_ELEMENT_ADDRESSES, &el_addrs)) != 0) {
perror("ioctl: SIOC_ELEMENT_ADDRESSES");
return -1;
} else {
last_drive_el = el_addrs.first_data_transfer
+ el_addrs.num_data_transfers - 1;
for (i = el_addrs.first_data_transfer; i <= last_drive_el; i++) {
el_stat.element = i;
if ((error = ioctl(fd, SIOC_ELEMENT_STATUS, &el_stat)) != 0) {
perror("ioctl: SIOC_ELEMENT_ADDRESSES");
return -1;
} else {
/*
* You may wish to also check some of the other fields
* in the el_stat structure to verify that the data is
* valid. Fields: el_stat.access (ac accessible),
* el_stat.except (exception).
*/
if (! el_stat.not_bus && el_stat.id_valid) {
drive[i].bus_address = el_stat.bus_address;
if (! el_stat.lu_valid) {
drive[i].lun = 0;
} else {
drive[i].lun = el_stat.lun;
}
}
}
}
}
WARNINGS
Some non-HP media changer devices do not support the
SIOC_INIT_ELEM_STAT and
SIOC_ELEMENT_STATUS ioctls.
Some older media changer devices do not support the
SIOC_EXCHANGE_MEDIUM ioctl. For these
devices, multiple SIOC_MOVE_MEDIUM ioctl operations may be used to accomplish the same results,
provided a suitable temporary element address may be found.
SEE ALSO
insf(1M), mknod(1M), scsictl(1M), ioctl(2), scsi(7), scsi_ctl(7), intro(7).
4 Hewlett-Packard Company 4 HP-UX 11i Version 3: September 2010