(From my blog, with the hope that it will be useful.)
(#100) How coldplug works
Today I installed the coldplug package[0] on my system and verified
that not only it works, but it's also quite fast:
root@wonderland:~#time /etc/init.d/coldplug start
Starting hotplug subsystem: pci usb pnp ide ieee1394 macio scsi serio.
real 0m0.437s
user 0m0.051s
sys 0m0.113s
root@wonderland:~#
It's a bit slower when using bash instead of dash, but it still takes
less than one second most of the times.
The process called coldplugging is performed by the /lib/hotplug/*.rc
scripts (formerly installed in /etc/hotplug/), and its purpose is to
load the drivers for devices which are supported by the kernel hotplug
framework but are already connected at the time the system is booted.
I had to rename the package to be able to coexist in the archive with
hotplug, which is still needed to support 2.4 kernels. Since the old
/etc/hotplug/*.agent scripts which performed the core hotplug functions
have been replaced by udev and the $MODALIAS variable (look at the
hotplug.rules file to learn how), I choose to call it coldplug instead
of hotplug-light as in my previous attempt to better reflect its
purpose.
With the new design, instead of having the *.rc scripts directly start
the *.agent scripts, they generate a complete set of synthetic hotplug
events which are later replayed at udev. udev then will process the
events as specified in its rules files, usually loading the driver
specified in the $MODALIAS variable or running the configured user
space drivers or helper scripts.
One of the goals is to simplify the scripts by decoupling the
components as much as possible and interfacing them with their native
communication method, kernel hotplug events. This will also support
with minimal changes replying real kernel hotplug events captured in
the initramfs, which is an alternative design being tested by SuSE.
[0] http://www.bofh.it/~md/debian/
--
ciao,
Marco