[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts

Understanding Device States

Device methods are responsible for changing the state of a device in the system. A device can be in one of four states as represented by the Device Status Flag descriptor in the device's object in the Customized Devices (CuDv) object class.

The Device States diagram illustrates both the possible states and the device methods that affect them.

Defined Represented in the Customized database, but neither configured nor available for use in the system.
Available Configured and available for use.
Undefined Not represented in the Customized database.
Stopped Configured, but not available for use by applications. (Optional state)

The Define method is responsible for creating a device instance in the Customized database and setting the state to Defined. The Configure method performs all operations necessary to make the device usable and then sets the state to Available.

The Change method usually does not change the state of the device. If the device is in the Defined state, the Change method applies all changes to the database and leaves the device defined. If the device is in the Available state, the Change method attempts to apply the changes to both the database and the actual device, while leaving the device available. However, if an error occurs when applying the changes to the actual device, the Change method may need to unconfigure the device, thus changing the state to Defined.

Any Unconfigure method you write must perform the operations necessary to make a device unusable. Basically, this method undoes the operations performed by the Configure method and sets the device state to Defined. Finally, the Undefine method actually deletes all information for a device instance from the Customized database, thus reverting the instance to the Undefined state.

The Stopped state is an optional state that some devices require. A device that supports this state needs Start and Stop methods. The Stop method changes the state from Available to Stopped. The Start method changes it from Stopped back to Available.

Related Information

Customized Devices (CuDv) Object Class in AIX Technical Reference: Kernel and Subsystems Volume 1.

Writing a Define Method, Writing a Configure Method, Writing a Change Method, Writing an Unconfigure Method, Writing an Undefine Method, Writing Optional Start and Stop Methods in AIX Technical Reference: Kernel and Subsystems Volume 1.


[ Previous | Next | Contents | Home | Search ]