独辟蹊径品内核:linux内核源代码导读 pdf,linux内核源代码导读.pdf

linux内核源代码导读.pdf

114411f07c08103eaffd6cb1c6dc2f5b.gif

还剩

30页未读,

继续阅读

下载文档到电脑,马上远离加班熬夜!

亲,很抱歉,此页已超出免费预览范围啦!

如果喜欢就下载吧,价低环保!

内容要点:

独辟蹊径品内核 —— Linux 内核源代码导读 31 23 * so the expression can be used e.g. in a structure 24 * initializer (or where-ever else comma expressions 25 * aren't permitted). 26 */ 27 28 /* 本例中条件 (p独辟蹊径品内核 —— Linux 内核源代码导读 30 13 int *__check_debug(void) 14 { 15 return(&(debug)); 16 }; 17 18 /* __param_check(debug, debug, byte)展开: */ 19 static inline __attribute__((always_inline)) 2独辟蹊径品内核 —— Linux 内核源代码导读 29 15 }; 16 }; 模块可以使用宏 module_param()添加一个 kernel_param 实例到 __start_param 数组中。例如 AMD PCnet32 网卡驱动模块 pcnet32.c 中使用 module_param(debug, int, 0)告诉内核,该模块接收一个 int 型的 debug 参数。参独辟蹊径品内核 —— Linux 内核源代码导读 28 27 ...... 28 /* 29 * We try each of these until one succeeds. 30 * 31 * The Bourne shell can be used instead of init if we are 32 * trying to recover a really 独辟蹊径品内核 —— Linux 内核源代码导读 27 段的内存在启动结束后会被释放,但是没关系,因为它的值在随后的 18 行将被复制到obs_kernel_param 结构的实例中。而这个实例是在第 14 行定义的,并且由第 16 行指定这个结构放到 .init.setup 段中。在链接脚本 vmlinux.lds 中指定把所有 .o 文件中的 .init.setup 段都合成到一起。 __s独辟蹊径品内核 —— Linux 内核源代码导读 26 个注册的项目在内核中使用一个 obs_kernel_param 结构来表示,该结构定义如下: 代码片段 4.26. 节自 include/linux/init.h 1 struct obs_kernel_param { 2 /* 参数的名字。 */ 3 const char *str; 4 /* 参数对应的处理函独辟蹊径品内核 —— Linux 内核源代码导读 25 行处理。 代码片段 4.25. 节自 init/main.c 1 void __init parse_early_param(void) 2 { 3 static __initdata int done = 0; 4 static __initdata char tmp_cmdline[COMMAND_LINE_SI独辟蹊径品内核 —— Linux 内核源代码导读 24 26 __attribute__((__section__(".initcall" level ".init")))=fn 如果希望 do_initcalls()调用某一个初始化函数,就需要使用这些宏。比如上面的postcore_initcall 函数就是使用 postcore_initcall(pci_driver_in

发表评论

暂无评论,赶快抢占沙发吧。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值