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

Understanding Device Methods Interfaces

Device methods are not executed directly from the command line. They are only invoked by the Configuration Manager at boot time or by the cfgmgr, mkdev, chdev, and rmdev configuration commands at run time. As a result, any device method you write should meet well-defined interfaces.

The parameters that are passed into the methods as well as the exit codes returned must both satisfy the requirements for each type of method. Additionally, some methods must write information to the stdout and stderr files.

These interfaces are defined for each of the device methods in the individual articles on writing each method.

To better understand how these interfaces work, one needs to understand, at least superficially, the flow of operations through the Configuration Manager and the run-time configuration commands.

Configuration Manager

The Configuration Manager begins by invoking a Node Configuration program listed in one of the rules in the Configuration Rules (Config_Rules) object class. A node is a group of devices organized into a tree structure representing the various interconnections of the devices. The Node Configuration program is responsible for starting the configuration process for a node. It does this by querying the Customized database to see if the device at the top of the node is represented in the database. If so, the program writes the logical name of the device to the stdout file and then returns to the Configuration Manager.

The Configuration Manager intercepts the Node Configuration program's stdout file to obtain the name of the device that was written. It then invokes the Configure method for that device. The device's Configure method performs the steps necessary to make the device available. If the device is not an intermediate one, the Configure method simply returns to the Configuration Manager. However, if the device is an intermediate device that has child devices, the Configure method must determine whether any of the child devices need to be configured. If so, the Configure method writes the names of all the child devices to be configured to the stdout file and then returns to the Configuration Manager.

The Configuration Manager intercepts the Configure method's stdout file to retrieve the names of the children. It then invokes, one at a time, the Configure methods for each child device. Each of these Configure methods operates as described for the parent device. For example, it might simply exit when complete, or write to its stdout file a list of additional device names to be configured and then exit. The Configuration Manager will continue to intercept the device names written to the stdout file and to invoke the Configure methods for those devices until the Configure methods for all the devices have been run and no more names are written to the stdout file.

Run-Time Configuration Commands

User configuration commands invoke device methods during run time.

mkdev The mkdev command is invoked to define or configure, or define and configure, devices at run time. If just defining a device, the mkdev command invokes the Define method for the device. The Define method creates the customized device instance in the Customized Devices (CuDv) object class and writes the name assigned to the device to the stdout file. The mkdev command intercepts the device name written to the stdout file by the Define method to learn the name of the device. If user-specified attributes are supplied with the -a flag, the mkdev command then invokes the Change method for the device.

If defining and configuring a device, the mkdev command invokes the Define method, gets the name written to the stdout file with the Define method, invokes the Change method for the device if user-specified attributes were supplied, and finally invokes the device's Configure method.

If only configuring a device, the device must already exist in the CuDv object class and its name must be specified to the mkdev command. In this case, the mkdev command simply invokes the Configure method for the device.

chdev The chdev command is used to change the characteristics, or attributes, of a device. The device must already exist in the CuDv object class, and the name of the device must be supplied to the chdev command. The chdev command simply invokes the Change method for the device.
rmdev The rmdev command can be used to undefine or unconfigure, or unconfigure and undefine, a device. In all cases, the device must already exist in the CuDv object class and the name of the device must be supplied to the rmdev command. The rmdev command then invokes the Undefine method, the Unconfigure method, or the Unconfigure method followed by the Undefine method, depending on the function requested by the user.
cfgmgr The cfgmgr command can be used to configure all detectable devices that did not get configured at boot time. This might occur if the devices had been powered off at boot time. The cfgmgr command is the Configuration Manager and operates in the same way at run time as it does at boot time. The boot time operation is described in "Device Configuration Manager Overview".

Related Information

Writing a Define Method, Writing an Undefine Method, Writing an Unconfigure Method, Writing a Configure Method, Writing a Change Method.

ODM Device Configuration Object Classes.

The cfgmgr command, mkdev command, chdev command, rmdev command.


[ Previous | Next | Contents | Home | Search ]