Automation and Hotplugging

Modules can be loaded not only on the initiative of the user or by means of an automated script, but can also be requested by the kernel itself. There are two situations where this kind of loading is useful:

1. The kernel establishes that a required function is not available. For example, a filesystem needs to be mounted but is not supported by the kernel.

The kernel can attempt to load the required module and then retry file mounting.

2. A new device is connected to a hotpluggable bus (USB, FireWire, PCI, etc.). The kernel detects the new device and automatically loads the module with the appropriate driver.

18Two flags can be passed in addition to the name: O_TRUNC, which indicates that the module may also be removed from the kernel ''by force'' (despite, e.g., the fact that the reference counter is positive); O_NONBLOCK, which specifies that the operation must be performed without blocking. To keep things simple, the flags are not discussed here.

The implementation of this feature is interesting because, in both cases, the kernel relies on utilities in userspace. On the basis of the information provided by the kernel, the utilities find the appropriate module and insert it into the kernel in the usual way.

Continue reading here: Hotplugging

Was this article helpful?

0 0