/dev/ru

Каталог /dev
Most Linux users understand that is just a fast way of referring to the primary master SATA hard drive, first partition. That's pretty easy, right?

But consider hotpluggable devices like USB, IEEE1394, hot-swappable PCI, etc. What is the first device for each of these? And for how long? What will the other devices be named when the first one disappears? How will that affect ongoing transactions? Wouldn't it be fun if a printing job were suddenly moved from a high-end laser printer to an almost-dead matrix printer just because someone's mom decided to pull the plug on the laser printer (which just happened to be the first printer)?

Enter the device manager. A modern device manager (including and ) must:


 * Run in userspace;
 * Dynamically create and remove device files;
 * Provide consistent device naming;
 * Provide a userspace application program interface (API).

Every time a change happens within the device structure, the kernel emits a uevent which gets picked up by the device manager. The device manager then follows the rules declared in the, and  directories. Based on the information contained within the uevent, it finds the rule or rules it needs to trigger and performs the required actions. These actions may involve the creation or deletion of device files, and may also trigger the loading of particular firmware files into kernel memory.