Next | Prev | Up | Top | Contents | Index

The dsreq Structure

The primary input to most dsreq ioctl() calls, as well as the primary input to most dslib functions, is the dsreq structure. This structure is declared in /usr/include/sys/dsreq.h, a header file that rewards careful study.

The important fields of the dsreq structure are shown in Table 5-1. Some of the field values are expanded in the following topics. The sys/dsreq.h file declares macros for access to many of the fields. Use these macros (listed in Table 5-1) in both expressions and assignments in order to insulate your code against future changes.

Fields of the dsreq Structure
Field NameMacroPurpose
ds_flags FLAGS(dp)Bits used to determine device driver actions. See "Values for ds_flags".
ds_time TIME(dp)Timeout value in milliseconds. If the command does not complete, it is ended with an error code. The driver sets a default of 5000 (5 seconds) when this is set to zero. dsopen() initializes it to 10000.
ds_private PRIVATE(dp)Field for use by the calling program. dsopen() uses this field to point to its "context" data (see "Using dsopen() and dsclose()").
ds_cmdbuf CMDBUF(dp)Address of SCSI command string to be sent.
ds_cmdlen CMDLEN(dp)Length of the SCSI command string.
ds_databuf DATABUF(dp)Address of a single data buffer. See "Data Transfer Options".
ds_datalen DATALEN(dp)Length of data buffer.
ds_sensebuf SENSEBUF(dp)Address to receive sense data after an error.
ds_senselen SENSELEN(dp)Length of sense buffer in bytes.
ds_iovbuf IOVBUF(dp)Address of an iov_t structure. See "Data Transfer Options".
ds_iovlen IOVLEN(dp)Length of data described by ds_iovbuf.
ds_link  This field is not supported, and should be zero-filled.
ds_synch  This field is not supported, and should be zero-filled.
ds_revcode  Intended for the version code of the dsreq driver, not currently set to a useful value.
ds_ret RET(dp)Return code for the requested operation. See Table 5-3.
ds_status STATUS(dp)SCSI status byte from the operation. See Table 5-4.
ds_msg MSG(dp)The first byte of a message returned by the target. See Table 5-5.
ds_cmdsent CMDSENT(dp)Length of command string actually sent (same as ds_cmdlen, unless an error occurs).
ds_datasent DATASENT(dp)Length of data transferred.
ds_sensesent SENSESENT(dp)Length of sense data received.

The dslib library contains functions to simplify the preparation and execution of a dsreq request; see "Using dslib Functions".


Values for ds_flags
Data Transfer Options
Return Codes and Status Values

Next | Prev | Up | Top | Contents | Index