sdi_get(D3I) sdi_get(D3I)
NAME
sdi_get - allocate a structure from the pool of structures
SYNOPSIS
#include <sys/sdi.h>
struct jpool * sdi_get(struct head *headp, int flag);
Arguments
headp Pointer to the head structure of the pool from which the
memory piece was allocated.
flag The flag which is used to decide whether sdi_get can
sleep if no structures are currently available.
DESCRIPTION
sdi_get allocates a structure from the available pool of
headp. If the pool is empty, an attempt is made to allocate
more kernel memory to satisfy the current request. If
additional memory cannot be allocated and flag was enabled,
the routine will sleep.
Return Values
Pointer to a jpool structure.
USAGE
sdi_get is typically used in a local getblk/getjob routine.
Rather than having a local pool of job or command structures,
PDI drivers should use one of the two existing shared pools.
If the size of structures in these pools are too small, a new
pool can be created and used by the PDI driver.
There are two pools initialized and used by existing PDI
drivers. They are struct head sm_poolhead (28 bytes per
structure) and struct head lg_poolhead (76 bytes per
structure). Currently, most of the HBA drivers use the small
structures for command blocks, and the target drivers use the
large structures for job structures.
There are two rules for use of the structures:
1. The third word (long/bytes 8 through 11) is reserved and
must not be modified.
2. Once a structure is freed, the driver cannot keep
references to the structure or reference the structure
in any way.
Copyright 1994 Novell, Inc. Page 1
sdi_get(D3I) sdi_get(D3I)
If you need to bcopy another structure into the structure
allocated from sdi_get, save the third word and restore it
after the copy.
In SVR4.2 MP, the sdi_get and sdi_free(D3I) routines do
nothing more than call kmem_zalloc(D3) and kmem_free(D3). The
headp parameter is maintained simply to keep a record of the
allocation size.
Level
Base or Interrupt.
REFERENCES
kmem_free(D3), kmem_zalloc(D3), sdi_free(D3I)
NOTICES
Applicability
sdi: 1, 2
Copyright 1994 Novell, Inc. Page 2