sdi_xfreeblk(D3sdi)
sdi_xfreeblk --
release a previously allocated sb(D4sdi)
Synopsis
   #include <sys/types.h>
   #include <sys/ddi.h>
   #include <sys/sdi.h>
   
   long sdi_xfreeblk(int hbaflag, struct sb *sbp);
Description
sdi_xfreeblk( )
returns an
sb(D4sdi)
command block to the free block pool.
This routine is used in drivers written for
The sb_type member of the sb structure
is checked to ensure that a valid sb is returned.
Arguments
 hbaflag
- 
Initialize to HBA_EXT_ADDRESS
for drivers that understand extended SCSI addressing,
or to 0 for drivers that only understand
conventional SCSI addressing.
 sbp
- 
Pointer to the
sb(D4sdi)
command block structure.
Return values
On success, returns SDI_RET_OK.
A return value of SDI_RET_ERR indicates an
error with the pointer.
Usage
sdi_xfreeblk( )
is typically used after a job completes.
Context and synchronization
Non-blockable
context.
Hardware applicability
All
Version applicability
sdi:
4
HBA drivers
Differences between versions
SDI versions prior to SDI version 4
use the
sdi_freeblk( )
function, which cannot be used with
extended SCSI addresses,
rather than
sdi_xfreeblk( ).
The syntax is:
   long sdi_freeblk(struct sb *pt);
References
sb(D4sdi)
``Extended SCSI addressing scheme'' in HDK Technical Reference
Examples
In this example,
diskfreejob( )
cleans up after a disk job completes
and is called with a pointer to the job structure.
The job structure contains information
about the disk job,
including a pointer to the sb for the job.
sdi_xfreeblk( )
is called with the pointer to
the job structure
as part of the clean-up operation.
Similar coding is used for the
sdi_freeblk( )
function.
   struct job {
          struct sb *j_sbptr;
           ...
   }
   
   diskfreejob(jp)
   struct job *jp;
   {
           /* Perform job clean up */
           ...
   
           /*  Return SB to SDI */
           if( sdi_xfreeblk(HBA_EXT_ADDRESS, jp->j_sbptr) != SDI_RET_OK)
           {
            /* SB rejected - print error message */
            cmn_err(CE_WARN, "DISK: SB rejected by SDI.");
           }
           ...       
   }
19 June 2005
© 2005 The SCO Group, Inc.  All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005