- 论坛徽章:
- 0
|
本帖最后由 313675178 于 2012-09-04 10:04 编辑
在看linux内核时,有如下函数
__setup("init=", init_setup);
有查找到#define __setup(str, fn) \
__setup_param(str, fn, fn, 0)
#define __setup_param(str, unique_id, fn, early) \
static char __setup_str_##unique_id[] __initdata = str; \
static struct obs_kernel_param __setup_##unique_id \
__attribute_used__ \
__attribute__((__section__(".init.setup"))) \
__attribute__((aligned((sizeof(long))))) \
= { __setup_str_##unique_id, fn, early }
struct obs_kernel_param {
const char *str;
int (*setup_func)(char *);
int early;
};
网上说:
变量__setup_root_dev_setup_id的三个成员分别被初始化为:
__setup_str_root_dev_setup_id --> 前面定义的字符数组变量,初始内容为"root="。
root_dev_setup --> 通过宏传过来的处理函数。
0 -->常量0,该成员的作用以后分析。
我知道root_dev_setup是传过来的函数,为什么他就是处理__setup_str_root_dev_setup_id变量的函数?
|
|