Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sdi_getblk(D3I) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought






       sdi_getblk(D3I)                                      sdi_getblk(D3I)


       NAME
             sdi_getblk - allocate an sb (command block) for the target
             driver

       SYNOPSIS
             #include <sys/sdi.h>
             struct sb * sdi_getblk(int flag);

          Arguments
             flag  Indicates whether the allocation may sleep or not, and
                   is set to either KM_SLEEP or KM_NOSLEEP.

       DESCRIPTION
             sdi_getblk allocates an sb structure.

          Return Values
             Pointer to an sb structure.

       USAGE
             Only sdi_getblk should be used to allocate an sb. sc_comp_code
             is set to SDI_UNUSED in the returned sb.

             PDI may add fields to the end of the sb for use by PDI.  This
             implies that target drivers may not use sb structures
             allocated themselves.  Target drivers must allocate an sb
             structure with sdi_getblk.

          Level
             Base or Interrupt.

          Examples
             In the following example, diskopen1 is called by the open
             routine for a disk target driver.  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.

                   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)


                           Copyright 1994 Novell, Inc.               Page 1













      sdi_getblk(D3I)                                      sdi_getblk(D3I)


                  long major, minor;
                  {
                        struct disk_st *disk;
                        /* Based 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);
                        }
                        ...

      REFERENCES
            sb(D4I), scsi_ad(D4I), sdi_freeblk(D3I)

      NOTICES
         Applicability
            sdi: 1, 2
















                          Copyright 1994 Novell, Inc.               Page 2








Typewritten Software • bear@typewritten.org • Edmonds, WA 98026