The Change method must ensure consistency between the Configuration
database and the view that any device driver might have of the device.
The Change method is invoked when changing the configuration
of a device. This is accomplished by:
- Not allowing the configuration to be changed if the device
has configured children; that is, children in either the Available
or Stopped states. This ensures that a DDS built using information
in the database about a parent device remains valid because the parent
cannot be changed.
- If a device has a device driver and the device is in either
the Available or Stopped state, the Change method must communicate
to the device driver any changes that would affect the DDS. This can
be accomplished with ioctl operations, if the device driver
provides the support to do so. It can also be accomplished by taking
the following steps:
- Terminating the device instance by calling the sysconfig subroutine with the SYS_CFGDD operation.
This operation calls the device driver's ddconfig subroutine with the CFG_TERM command.
- Rebuilding the DDS using the changed information.
- Passing the new DDS to the device driver by calling the sysconfig subroutine SYS_CFGDD operation.
This operation then calls the ddconfig subroutine with the CFG_INIT command.
Many Change methods simply invoke
the device’s Unconfigure method, apply changes to the database, and
then invoke the device's Configure method. This process ensures the
two stipulated conditions since the Unconfigure method, and thus the
change, will fail, if the device has Available or Stopped children.
Also, if the device has a device driver, its Unconfigure method terminates
the device instance. Its Configure method also rebuilds the DDS and
passes it to the driver.