DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sdi_xgetblk(D3sdi)


sdi_xgetblk -- allocate an sb(D4sdi) command block for the target driver

Synopsis

   #include <sys/types.h>
   #include <sys/sdi.h>
   #include <sys/ddi.h>
   

struct sb * sdi_xgetblk(int hbaflag, int flag);

Description

sdi_xgetblk( ) allocates an sb(D4sdi) structure.

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.

flag
Set to KM_SLEEP or KM_NOSLEEP to indicate whether or not the allocation may block.

Return values

On success, sdi_xgetblk( ) returns a pointer to an sb(D4sdi) structure.

Usage

Only sdi_xgetblk( ) should be used to allocate an sb. function to allocate an sb structure. This is because SDI may add information to the end of the sb structure for internal use.

When the sb is allocated, sc_comp_code(D5sdi) is set to SDI_UNUSED.

Context and synchronization

If flag is set to KM_NOSLEEP, non-blockable, initialization, or interrupt context.

If flag is set to KM_SLEEP, user context.

Hardware applicability

All

Version applicability

sdi: 4 target and HBA drivers.

Differences between versions

SDI versions prior to SDI version 4 use the sdi_getblk( ) function, which cannot be used with extended SCSI addresses, rather than sdi_xgetblk( ). The syntax is:
   struct sb * sdi_getblk(int flag);

References

sb(D4sdi), scsi_ad(D4sdi), sdi_xfreeblk(D3sdi)

``Extended SCSI addressing scheme'' in HDK Technical Reference

Examples

In the following example, diskopen( ) is called by the disk target driver's open(D2sdi) function. In the routine, a disk-specific structure is initialized the first time the disk is accessed. This initialization includes allocating an sb for sending request sense commands to the disk. The disk_st structure is used in the example.

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); } ...


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005