| 
 |  | 
#include <sys/types.h> #include <sys/sdi.h> #include <sys/ddi.h>struct sb * sdi_xgetblk(int hbaflag, int flag);
When the sb is allocated, sc_comp_code(D5sdi) is set to SDI_UNUSED.
If flag is set to KM_SLEEP, user context.
struct sb * sdi_getblk(int flag);
``Extended SCSI addressing scheme'' in HDK Technical Reference
The example uses sdi_getblk( ) but would be the same for sdi_xgetblk( ).
   struct disk_st {
     long disk_state;          /* State of this disk */
     struct scsi_ad disk_addr; /* Major/Minor number of device */
     struct sb *disk_fltreq;   /* SCSI block for request sense */
   	...
   };
   
   diskopen1(major, minor)
   long major, minor;
   {
   	struct disk_st *disk;
   	/* Base on the major and minor numbers of the disk,
   	 * index into the array of disk structures and get the
   	 * pointer to the one for this disk.
   	 */
   	disk = &Disk[diskintmin(major, minor)];
   	/* Check to see if this disk has been initialized */
   	if ((disk->disk_state & DISK_INIT) == 0)
           {
   		/* This is first access to the disk so initialize
   		 * some of the data structures for the disk.
   		 */
   		/* Get SB for request sense jobs for this disk */
   		disk->disk_fltreq = sdi_getblk(flag);
   
   		/* Fill in the major and minor numbers and the
   		 * logical unit number in the address structure.
   		 */
   		disk->disk_addr.sa_major = major;
   		disk->disk_addr.sa_minor = minor;
   		disk->disk_addr.sa_lun = LUN(minor);
   	}
   	...