DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sdi_device_alloc(D3sdi)


sdi_device_alloc -- allocate an SDI layered device descriptor structure

Synopsis

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

sdi_device_t *sdi_device_alloc(int flag);

Description

The sdi_device_alloc( ) function allocates an sdi_device(D4sdi) structure that is used by functions such as sdi_device_add(D3sdi) and sdi_device_rm(D3sdi) to register devices with SDI.

Arguments


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

Return values

On success, sdi_device_alloc( ) returns a pointer to an sdi_device(D4sdi) structure.

If KM_NOSLEEP is specified and sufficient memory is not immediately available, sdi_device_alloc( ) returns a NULL pointer.

Usage

sdi_device_alloc( ) is typically called at device discovery time to allocate a sdi_device structure for registering the device with SDI.

The sdi_device must be prepped with the sdi_device_prep(D3sdi) function before it is used.

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.

Driver-defined basic locks and read/write locks may be held across calls to this function if flag is KM_NOSLEEP, but may not be held if flag is KM_SLEEP.

Driver-defined sleep locks may be held across calls to this function regardless of the value of flag.

Hardware applicability

All

Version applicability

sdi: 4 layered drivers

References

sdi_device_free(D3sdi), sdi_device_prep(D3sdi), sdi_device_add(D3sdi), sdi_device_rm(D3sdi), sdi_device(D4sdi),
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005