Writing Device Drivers

SCSI Additions to the State Structure

This section adds the following fields to the state structure. See "Software State Structure" for more information.

	
struct scsi_pkt					*rqs;			/* Request Sense packet */
struct buf							*rqsbuf;		/* buf for Request Sense */
struct scsi_pkt					*pkt;			/* packet for current command */
struct scsi_device				*sdp;			/* pointer to device's */
 														/* scsi_device(9S) structure. */

rqs is a pointer to a SCSI request sense command scsi_pkt(9S) structure, allocated in the attach(9E) routine. This packet is preallocated because the request sense command is small and may be used in time-critical areas of the driver (such as when handling errors).