To assist device driver writers in allocating state structures, the DDI/DKI provides a set of memory management routines called the software state management routines, also known as the soft-state routines. These routines dynamically allocate, retrieve, and destroy memory items of a specified size, and hide the details of list management. An instance number is used to identify the desired memory item. This number is typically the instance number assigned by the system.
Routines are provided for the following tasks:
Initialize a driver's soft-state list
Allocate space for an instance of a driver's soft state
Retrieve a pointer to an instance of a driver's soft state
Free the memory for an instance of a driver's soft state
Finish using a driver's soft-state list
See Loadable Driver Interfaces for an example of how to use these routines.