Q:热插拔
A:一个完整的热插拔系统包括热插拔系统的硬件,支持热插拔的软件和操作系统,支持热
插拔的设备驱动程序和支持热插拔的用户接口。
- 硬件支持:插入,先数据,后电源;拔出,先电源,后数据,最重要的是检测电平变化的引脚
- uevent, user space event. 内核与用户空间的一种通信机制
http://www.wowotech.net/linux_kenrel/uevent.html 主要讲述的是头文件热插拔事件从内核空间到用户空间
http://blog.youkuaiyun.com/bingqingsuimeng/article/details/7922217 一般,并且知识体系太老了
http://blog.youkuaiyun.com/bingqingsuimeng/article/details/7924300 有源代码的讲解,比较清晰
http://www.cnblogs.com/image-eye/archive/2011/08/19/2145858.html 内核启动过程的驱动加载
http://blog.chinaunix.net/uid-25721104-id-3023525.html 讨论的关于热插拔
http://blog.youkuaiyun.com/zirconsdu/article/details/8792184 图解很清晰
讲清楚了koject_uevent_env在做了什么,如何进入用户空间:https://elixir.bootlin.com/linux/latest/source/lib/kobject_uevent.c#L456
/**
* kobject_uevent_env - send an uevent with environmental data
*
* @kobj: struct kobject that the action is happening to
* @action: action that is happening
* @envp_ext: pointer to environmental data
*
* Returns 0 if kobject_uevent_env() is completed with success or the
* corresponding error when it fails.
*/
int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
char *envp_ext[])
{
struct kobj_uevent_env *env;
const char *action_string = kobject_actions[action];
const char *devpath = NULL;
const char *subsystem;
struct kobject *top_kobj;
st