USB Tape Client Device Driver
Purpose
Supports the Universal Serial Bus (USB) protocol for sequential access tape device driver.
Syntax
#include <sys/devinfo.h>
#include <sys/usb.h>
#include <sys/tape.h>
#include <sys/usbdi.h>
Device-dependent subroutines
Most of the
tape operations are implemented by using the open
, close
, read
,
and write
subroutines. However, the openx
subroutine
must be used if the device must be opened in the Diagnostic
mode.
open and close subroutines
The openx
subroutine
is primarily used for the diagnostic commands and utilities. Appropriate
authority is required for to run the subroutine. If you run the openx
subroutine
without the required authority, the subroutine returns a value of
-1 and sets the errno global variable to a value
of EPERM
.
The openx
subroutine
enables the Diagnostic
mode for the device driver
and disables command-retry logic. This action allows the ioctl
operations
that perform special functions that are associated with diagnostic
processing. The openx
subroutine can also force-open
and retain reservations.
The open
subroutine
applies a reservation policy that is based on the Object Data Manager
(ODM) reserve_policy
attribute. The USB tape devices
might not support Small Computer System Interface (SCSI) reservation
command and therefore, these commands might be ignored.
The ext parameter
that is passed to the openx
subroutine selects the
operation to be used for the target device. The /usr/include/sys/scsi.h file
defines the possible values for the ext parameter.
The ext parameter can contain any logical combination of the following flag values:
Item | Description |
---|---|
SC_FORCED_OPEN | Forces access to a device by removing any type of reservation on the device that can inhibit access. The type of action to remove the reservation depends upon the specific type of the established reservation. If this flag is specified, a mass storage reset command is issued for a USB tape, which is a mass storage bulk device. |
SC_DIAGNOSTIC | Places the selected device in the Diagnostic mode.
This mode is singularly entrant. It means when a device is in the Diagnostic mode,
SCSI operations are performed during the open or close operations,
and error logging is disabled. In the Diagnostic mode,
only the close and ioctl operations
are accepted. All other device-supported subroutines return a value
of -1 and set the errno global variable to a value
of EACCES . A device can be opened in the |
ioctl subroutine
The following ioctl
operations
are supported on USB tape devices:
Operation | Description |
---|---|
IOCINFO | Populates the devinfo argument
that is passed by the caller with the following values:
|
STIOCTOP | Specifies the address of a stop structure that
is defined in the src/bos/usr/include/sys/tape.h file.
The operation that is found in the st_op field in
the stop structure is run st_count times, except
for rewind, erase, and retention operations.This
|
STIOCTOP (continued) |
|
STPASSTHRU | Takes the SCSI command in the scsi_cdb section
of the sc_passthru structure and issues it to the
USB tape driver. This operation is similar to the STIOCMD
ioctl operation with the only exception of additional informative
fields in the sc_passthru structure that provides
more information on the error.The following example is a pseudo
code to issue the
|