Abort SCSI I/O Command

Prototype: DWORD SendASPI32Command(LPSRB)

Declaration: LPSRB lpSRB;

The SendASPI32Command function with command code SC_ABORT_SRB is used to request that a pending SRB be aborted. It should be issued on any I/O request that has not completed if the application wishes to time-out on that request. Success of the abort command is never assured.

Parameter

Description

lpSRB

Points to the following SCSI request block



typedef struct {

 BYTE  SRB_Cmd;    // ASPI command code = SC_ABORT_SRB  
 BYTE  SRB_Status;   // ASPI command status byte
 BYTE  SRB_HaId;    // ASPI host adapter number
 BYTE  SRB_Flags;   // Reserved
 DWORD  SRB_Hdr_Rsvd;  // Reserved
 void  *SRB_ToAbort;  // Pointer to SRB to abort

} SRB_Abort, *PSRB_Abort;

Table 4-8. Abort SCSI I/O Command

Member

Description

SRB_Cmd

[IN] This field must contain SC_ABORT_SRB.

SRB_Status

[OUT] On return, this field will be the same as the return status defined below.

SRB_HaId

[IN] This field specifies which installed host adapter the request is intended for. Host adapter numbers are always assigned by the ASPI manager layer beginning with zero.

SRB_Flags

[IN] Reserved = 0

SRB_Hdr_Rsvd

Reserved = 0

SRB_ToAbort

[IN] This fields contains a pointer to the SRB which is to be aborted. The actual failure or success of the abort operation is indicated by the status eventually returned in this SRB.


Table 4-9. Return Values from Abort SCSI I/O Command

Value

Meaning

SS_COMP

SCSI/ASPI request has completed without error.

SS_INVALID_HA

Invalid host adapter number.

SS_INVALID_SRB

One or more parameters in the SCSI Request Block (SRB) are set incorrectly.


Example

This example shows how to abort a "stuck" SCSI I/O.


 SRB_ExecSCSICmd StuckSRB;
 SRB_Abort AbortSRB;
 DWORD ASPIStatus;
  .
  .
 AbortSRB.SRB_Cmd    = SC_ABORT_SRB;
 AbortSRB.SRB_HaId   = 0;
 AbortSRB.SRB_Flags   = 0;
 AbortSRB.SRB_Hdr_Rsvd  = 0;
 AbortSRB.SRB_ToAbort  = (LPSRB) &StuckSRB;
 ASPIStatus      = SendASPI32Command ( (LPSRB) &AbortSRB );
  .
  .