Linux内核中__setup的用途
来源:互联网 发布:南通大学网络教学平台 编辑:程序博客网 时间:2024/05/22 11:37
在Linux内核代码中经常会看到__setup,如下所示:
__setup("nfsroot=", nfs_root_setup);
这是一个宏,它的定义在include/linux/init.h
#define __setup(str, fn) __setup_param(str, fn, fn, 0)
我们这里暂不管__setup_param的具体内容,只要搞清楚 __setup的作用即可。 __setup与Linux启动时的配置参数command line有关,下面是一个常见的配置格式:
console=ttySAC0,115200 root=nfs nfsroot=192.168.1.9:/source/rootfs initrd=0x10800000,0x14af47
可以看到,该配置里有nfsroot,它与__setup有何关系?
在一个一般化的 __setup定义中,
__setup(string, function_handler)
其中string是关键字,function_handler是关联处理函数。__setup只是告诉内核在启动时输入串中含有string时,内核要去执行function_handler。
也就是说对于上面的例子,在内核启动时需要执行nfs_root_setup函数。
阅读全文
0 0
- Linux内核中__setup的用途
- Linux内核代码中的__setup的用途
- Linux内核代码中的__setup的用途
- Linux内核代码中的__setup的用途
- linux __setup的作用
- linux3.* 内核的__setup函数
- linux中的__setup的作用
- linux __setup
- linux __setup
- linux驱动中宏__setup(str, fn)
- Linux的 __setup解析 -- 命令行处理
- Linux __setup解析
- Linux __setup解析
- Linux __setup解析
- Linux __setup解析
- Linux __setup解析
- Linux __setup解析
- Linux __setup解析
- template might not exist or might not be accessible by any of the configured Template Resolvers
- 【WEB开发技术】一个简单的WEB项目验证码校验(如何从前端到后台一步一步的搭建、配置、发布整个Web项目?)
- Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found在Studio里导入moudle时报错解决方案
- c语言经典面试题
- android 7.0 兼容多语言切换总结
- Linux内核中__setup的用途
- strlen()和sizeof()区别
- oracle创建用户、授权、建表空间
- FZU 2207 以撒的结合(LCA+记录路径)
- 本地项目上传到GitHub中
- Windows下安装并设置Redis
- [技巧]标准IO重定向
- 使用反射在 ArrayList<Integer> 集合中添加一个字符串数据;
- UVa 1451 Average——斜率优化