LINUX的热插拔机制(经典文章)
linux的热插拔是Greg Kroah-Hartman维护,所以这是篇经典文章。如果你有USB或者PCI设备驱动开发基础,一读就可以理解。
Hot-pluggable devices have been created to solve a number of user needs. On laptop computers, PCMCIA devices were designed to allow the user to swap cards while the computer was still running. This allowed people to change network adaptors, memory cards and even disk drives without shutting down the machine.
The success of this led to the creation of the USB and IEEE1394 (FireWire) buses. These designs allow for peripherals to be attached and removed at any point. They also were created to try to move systems away from the ISA bus to a full Plug-and-Play-type system.
from the operating system's point of view, there are many problems with hot plugging devices. In the past, the operating system only had to search for the various devices connected to it on power-up, and once seen, the device would never go away. from the view of the device driver, it never expects to have the hardware that it is trying to control disappear. But with hot-pluggable devices, all of this changes.
Now the operating system has to have a mechanism that constantly detects if a new device appears. This usually is done by a bus-specific manager. This manager handles the scanning for new devices and recognizes this disappearance. It must be able to create system resources for the new device and pass control off to a specific driver. The device driver for a hot-pluggable device has to be able to recover gracefully when the hardware is removed and be able to bind itself to new hardware at any moment. Not only does the kernel need to know when devices are removed or added, but the user also should be notified when this happens. Other kinds of kernel events, such as the creation of network devices or the insertion of a laptop into a docking station, also would be useful for the user to know about.
This article describes the new framework in the Linux kernel for supporting USB and
相关文档:
尚学堂Linux笔记(一)
MBR:硬盘MBR(Master Boot Record)就是我们经常说的”硬盘主引导记录”,它是由FDISK等磁盘分区命令写在硬盘绝对0扇区的一段数据,它由主引导程序、硬盘分区表及扇区结束标志字(55AA).
这三部分组成,如下:
组成部分
所占字节数
内容
主引导程序
4 ......
getenv(取得环境变量内容)
相关函数 putenv,setenv,unsetenv
表头文件 #include<stdlib.h>
定义函数 char * getenv(const char *name);
函数说明 getenv()用来取得参数name环境变量的内容。参数name为环境变量的名称,如果该变量存在则会返回 ......
Linux下动态库的生成及链接方法 (1)
Linux 下动态库文件的扩展名为".so"(Shared Object)。按照约定,所有动态库文件名的形式是libname.so(可能在名字中加入版本号)。这样,线程函数库被称作 ......
在上一部分提到过了,vivi作为bootloader,向内核传递启动参数是其本职工作之一。要把这个情景分析清楚,不仅仅需要分析vivi的参数机 制,而且要分析Linux kernel的接收机制。因为这是一个简单的通信过程,比起本科所学习的TCP/IP来简单的多,但是因为简单,所以在协议上并不规范,理解上反而不如 TCP/IP协议。下面就分为两 ......
~ 当前用户目录的缩写
cd ~
cd /home/<user-name>/
--help 获取帮助
vi --help
tab 自动补全。双击tab给出补全提示。
若当前命令无歧义,则完整补全。若有歧义双击可列出提示选项。
cd /e [tab], 补全为cd /etc/
cd /b [tab-tab], 列出选项bin/ bo ......