VxWorks Reference Manual : Libraries

scsiSeqLib

NAME

scsiSeqLib - SCSI sequential access device library (SCSI-2)

ROUTINES

scsiSeqDevCreate( ) - create a SCSI sequential device
scsiErase( ) - issue an ERASE command to a SCSI device
scsiTapeModeSelect( ) - issue a MODE_SELECT command to a SCSI tape device
scsiTapeModeSense( ) - issue a MODE_SENSE command to a SCSI tape device
scsiSeqReadBlockLimits( ) - issue a READ_BLOCK_LIMITS command to a SCSI device
scsiRdTape( ) - read bytes or blocks from a SCSI tape device
scsiWrtTape( ) - write data to a SCSI tape device
scsiRewind( ) - issue a REWIND command to a SCSI device
scsiReserveUnit( ) - issue a RESERVE UNIT command to a SCSI device
scsiReleaseUnit( ) - issue a RELEASE UNIT command to a SCSI device
scsiLoadUnit( ) - issue a LOAD/UNLOAD command to a SCSI device
scsiWrtFileMarks( ) - write file marks to a SCSI sequential device
scsiSpace( ) - move the tape on a specified physical SCSI device
scsiSeqStatusCheck( ) - detect a change in media
scsiSeqIoctl( ) - perform an I/O control function for sequential access devices

DESCRIPTION

This library contains commands common to all sequential-access SCSI devices. Sequential-access SCSI devices are usually SCSI tape devices. These routines are separated from scsi2Lib in order to create an additional layer for better support of all SCSI sequential devices.

SCSI commands in this library include:

Command Op Code

ERASE (0x19)
MODE SELECT (6) (0x15)
MODE_SENSE (6) (0x1a)
READ (6) (0x08)
READ BLOCK LIMITS (0x05)
RELEASE UNIT (0x17)
RESERVE UNIT (0x16)
REWIND (0x01)
SPACE (0x11)
WRITE (6) (0x0a)
WRITE FILEMARKS (0x10)
LOAD/UNLOAD (0x1b)
The SCSI routines implemented here operate mostly on a SCSI_SEQ_DEV structure. This structure acts as an interface between this library and a higher-level layer. The SEQ_DEV structure is analogous to the BLK_DEV structure for block devices.

The scsiSeqDevCreate( ) routine creates a SCSI_SEQ_DEV structure whose first element is a SEQ_DEV, operated upon by higher layers. This routine publishes all functions to be invoked by higher layers and maintains some state information (for example, block size) for tracking SCSI-sequential-device information.

INCLUDE FILES

scsiLib.h, scsi2Lib.h

SEE ALSO

scsiSeqLib, tapeFsLib, scsi2Lib, VxWorks Programmer's Guide: I/O System, Local File Systems


Libraries : Routines

scsiSeqDevCreate( )

NAME

scsiSeqDevCreate( ) - create a SCSI sequential device

SYNOPSIS

SEQ_DEV *scsiSeqDevCreate
    (
    SCSI_PHYS_DEV * pScsiPhysDev /* ptr to SCSI physical device info */
    )

DESCRIPTION

This routine creates a SCSI sequential device and saves a pointer to this SEQ_DEV in the SCSI physical device. The following functions are initialized in this structure:

sd_seqRd - scsiRdTape( )
sd_seqWrt - scsiWrtTape( )
sd_ioctl - scsiIoctl( ) (in scsiLib)
sd_seqWrtFileMarks - scsiWrtFileMarks( )
sd_statusChk - scsiSeqStatusCheck( )
sd_reset - (not used)
sd_rewind - scsiRewind( )
sd_reserve - scsiReserve( )
sd_release - scsiRelease( )
sd_readBlkLim - scsiSeqReadBlockLimits( )
sd_load - scsiLoadUnit( )
sd_space - scsiSpace( )
sd_erase - scsiErase( )
Only one SEQ_DEV per SCSI_PHYS_DEV is allowed, unlike BLK_DEVs where an entire list is maintained. Therefore, this routine can be called only once per creation of a sequential device.

RETURNS

A pointer to the SEQ_DEV structure, or NULL if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiErase( )

NAME

scsiErase( ) - issue an ERASE command to a SCSI device

SYNOPSIS

STATUS scsiErase
    (
    SCSI_PHYS_DEV * pScsiPhysDev, /* ptr to SCSI physical device */
    BOOL            longErase     /* TRUE for entire tape erase */
    )

DESCRIPTION

This routine issues an ERASE command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiTapeModeSelect( )

NAME

scsiTapeModeSelect( ) - issue a MODE_SELECT command to a SCSI tape device

SYNOPSIS

STATUS scsiTapeModeSelect
    (
    SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI physical device */ int pageFormat, /* value of the page format bit (0-1) */ int saveParams, /* value of the save parameters bit (0-1) */ char * buffer, /* ptr to output data buffer */ int bufLength /* length of buffer in bytes */
    )

DESCRIPTION

This routine issues a MODE_SELECT command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiTapeModeSense( )

NAME

scsiTapeModeSense( ) - issue a MODE_SENSE command to a SCSI tape device

SYNOPSIS

STATUS scsiTapeModeSense
    (
    SCSI_PHYS_DEV * pScsiPhysDev,/* ptr to SCSI physical device */ int pageControl, /* value of the page control field (0-3) */ int pageCode, /* value of the page code field (0-0x3f) */ char * buffer, /* ptr to input data buffer */ int bufLength /* length of buffer in bytes */
    )

DESCRIPTION

This routine issues a MODE_SENSE command to a specified SCSI tape device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiSeqReadBlockLimits( )

NAME

scsiSeqReadBlockLimits( ) - issue a READ_BLOCK_LIMITS command to a SCSI device

SYNOPSIS

STATUS scsiSeqReadBlockLimits
    (
    SCSI_SEQ_DEV * pScsiSeqDev,     /* ptr to SCSI sequential device */
    int *          pMaxBlockLength, /* where to return maximum block length */
    UINT16 *       pMinBlockLength  /* where to return minimum block length */
    )

DESCRIPTION

This routine issues a READ_BLOCK_LIMITS command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiRdTape( )

NAME

scsiRdTape( ) - read bytes or blocks from a SCSI tape device

SYNOPSIS

int scsiRdTape
    (
    SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */
    UINT           count,       /* total bytes or blocks to be read */
    char *         buffer,      /* ptr to input data buffer */
    BOOL           fixedSize    /* if variable size blocks */
    )

DESCRIPTION

This routine reads the specified number of bytes or blocks from a specified physical device. If the boolean fixedSize is true, then numBytes represents the number of blocks of size blockSize, defined in the pScsiPhysDev structure. If variable block sizes are used (fixedSize = FALSE), then numBytes represents the actual number of bytes to be read.

RETURNS

Number of bytes or blocks actually read, 0 if EOF, or ERROR.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiWrtTape( )

NAME

scsiWrtTape( ) - write data to a SCSI tape device

SYNOPSIS

STATUS scsiWrtTape
    (
    SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */
    int            numBytes,    /* total bytes or blocks to be written */
    char *         buffer,      /* ptr to input data buffer */
    BOOL           fixedSize    /* if variable size blocks */
    )

DESCRIPTION

This routine writes data to the current block on a specified physical device. If the boolean fixedSize is true, then numBytes represents the number of blocks of size blockSize, defined in the pScsiPhysDev structure. If variable block sizes are used (fixedSize = FALSE), then numBytes represents the actual number of bytes to be written. If numBytes is greater than the maxBytesLimit field defined in the pScsiPhysDev structure, then more than one SCSI transaction is used to transfer the data.

RETURNS

OK, or ERROR if the data cannot be written or zero bytes are written.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiRewind( )

NAME

scsiRewind( ) - issue a REWIND command to a SCSI device

SYNOPSIS

STATUS scsiRewind
    (
    SCSI_SEQ_DEV * pScsiSeqDev /* ptr to SCSI Sequential device */
    )

DESCRIPTION

This routine issues a REWIND command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiReserveUnit( )

NAME

scsiReserveUnit( ) - issue a RESERVE UNIT command to a SCSI device

SYNOPSIS

STATUS scsiReserveUnit
    (
    SCSI_SEQ_DEV * pScsiSeqDev /* ptr to SCSI sequential device */
    )

DESCRIPTION

This routine issues a RESERVE UNIT command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiReleaseUnit( )

NAME

scsiReleaseUnit( ) - issue a RELEASE UNIT command to a SCSI device

SYNOPSIS

STATUS scsiReleaseUnit
    (
    SCSI_SEQ_DEV * pScsiSeqDev /* ptr to SCSI sequential device */
    )

DESCRIPTION

This routine issues a RELEASE UNIT command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiLoadUnit( )

NAME

scsiLoadUnit( ) - issue a LOAD/UNLOAD command to a SCSI device

SYNOPSIS

STATUS scsiLoadUnit
    (
    SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI physical device */
    BOOL           load,        /* TRUE=load, FALSE=unload */
    BOOL           reten,       /* TRUE=retention and unload */
    BOOL           eot          /* TRUE=end of tape and unload */
    )

DESCRIPTION

This routine issues a LOAD/UNLOAD command to a specified SCSI device.

RETURNS

OK, or ERROR if the command fails.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiWrtFileMarks( )

NAME

scsiWrtFileMarks( ) - write file marks to a SCSI sequential device

SYNOPSIS

STATUS scsiWrtFileMarks
    (
    SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */
    int            numMarks,    /* number of file marks to write */
    BOOL           shortMark    /* TRUE to write short file mark */
    )

DESCRIPTION

This routine writes file marks to a specified physical device.

RETURNS

OK, or ERROR if the file mark cannot be written.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiSpace( )

NAME

scsiSpace( ) - move the tape on a specified physical SCSI device

SYNOPSIS

STATUS scsiSpace
    (
    SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device info */
    int            count,       /* count for space command */
    int            spaceCode    /* code for the type of space command */
    )

DESCRIPTION

This routine moves the tape on a specified SCSI physical device. There are two types of space code that are mandatory in SCSI; currently these are the only two supported:

Code Description Support

000 Blocks Yes
001 File marks Yes
010 Sequential file marks No
011 End-of-data No
100 Set marks No
101 Sequential set marks No

RETURNS

OK, or ERROR if an error is returned by the device.

ERRNO

S_scsiLib_ILLEGAL_REQUEST

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiSeqStatusCheck( )

NAME

scsiSeqStatusCheck( ) - detect a change in media

SYNOPSIS

STATUS scsiSeqStatusCheck
    (
    SCSI_SEQ_DEV * pScsiSeqDev /* ptr to a sequential dev */
    )

DESCRIPTION

This routine issues a TEST_UNIT_READY command to a SCSI device to detect a change in media. It is called by file systems before executing open( ) or creat( ).

RETURNS

OK or ERROR.

SEE ALSO

scsiSeqLib


Libraries : Routines

scsiSeqIoctl( )

NAME

scsiSeqIoctl( ) - perform an I/O control function for sequential access devices

SYNOPSIS

int scsiSeqIoctl
    (
    SCSI_SEQ_DEV * pScsiSeqDev, /* ptr to SCSI sequential device */
    int            function,    /* ioctl function code */
    int            arg          /* argument to pass to called function */
    )

DESCRIPTION

This routine issues scsiSeqLib commands to perform sequential device-specific I/O control operations.

RETURNS

OK or ERROR.

ERRNO

S_scsiLib_INVALID_BLOCK_SIZE

SEE ALSO

scsiSeqLib