Table of Contents
The hotplug system in SUSE LINUX was developed in connection with the Linux Hotplug project, but it has a few distinguishing features. The main difference in SUSE LINUX is that instead of using the event multiplexer /etc/hotplug.d, the hotplug scripts are executed directly. Whenever possible the scripts /sbin/hwup and /sbin/hwdown are used to initialize or stop hotplug devices.
The hotplug system is not only used for devices that can be inserted and removed during operation, but also for all devices that are only detected after the kernel has been booted. These devices and their interfaces are entered in the sysfs file system, which is mounted under /sys. Until the kernel has been booted, only devices that are absolutely necessary, such as bus system, boot disks, and keyboard, are initialized.
Normally, devices are detected by a driver, which triggers a hotplug event that is handled by suitable scripts. For devices that cannot be detected automatically, coldplug uses static configurations.
Apart from a few historic exceptions, most devices are now initialized when the system is booted or when the devices are connected. The initialization often results in the registration of an interface. The registration of the interface, in turn, triggers hotplug events that cause an automatic configuration of the respective interface. Formerly, a set of configuration data was used as the basis for initializing devices. Now, the system searches for suitable configuration data on the basis of existing devices. Thus, the initialization procedure has been reversed, enabling a more flexible use of hotplug devices.
The most important hotplug functions are configured in two files. The first of these, /etc/sysconfig/hotplug, contains variables that influence the behavior of hotplug and coldplug. All variables are commented. The second file, /proc/sys/kernel/hotplug, contains the name of the executable program called by the kernel. Device configurations are located in /etc/sysconfig/hardware.
As well as devices, the hotplug system also administers interfaces. A device is linked to either a bus or an interface. An interface links devices to each other or to an application.
A device is always connected to an interface. A bus can be regarded as a multiple interface. There are also virtual devices, such as network tunnels. Every interface is connected to another device or to an application. The distinction of devices or interfaces is important for understanding the overall concept.
Devices entered in sysfs are found under /sys/devices. Interfaces are located under /sys/class or /sys/block. All interfaces in sysfs should have a link to their devices. However, there are still some drivers that do not automatically add this link.
Devices are addressed by means of a device description. This may be the device path in sysfs (/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0), a description of the connection point (bus-pci-0000:02:00.0), an individual ID (id-32311AE03FB82538), or something similar. In the past, interfaces were addressed by means of their names. However, these names represent a simple numbering of the existing devices and may change when devices are added or removed. Therefore, interfaces can also be addressed by means of a description of the associated device. Usually, the context indicates whether the description refers to the device itself or to its interface. Typical examples of devices, interfaces, and descriptions include:
A device that is connected to the PCI bus (/sys/devices/pci0000:00/0000:00:1e.0/0000:02:00.0 or bus-pci-0000:02:00.0) and has a network interface (eth0, id-00:0d:60:7f:0b:22 or bus-pci-0000:02:00.0). The network interface is used by network services or connected to a virtual network device, such as a tunnel or VLAN, which in turn has an interface.
A device (/sys/devices/pci0000:20/0000:20:01.1/host1/1:0:0:0 or bus-scsi-1:0:0:0) that makes several physical interfaces available in the form of a bus (/sys/class/scsi_host/host1).
A device (/sys/devices/pci0000:20/0000:20:01.1/host1/1:0:0:0 or bus-scsi-1:0:0:0) with several interfaces (/sys/block/sda*).