半肾
精华
|
战斗力 鹅
|
回帖 0
注册时间 2004-10-27
|
在看3.x中的sysctl.c这部分代码,有个函数看不懂
- /* see if attaching q to p would be an improvement */
- static void try_attach(struct ctl_table_header *p, struct ctl_table_header *q)
- {
- struct ctl_table *to = p->ctl_table, *by = q->ctl_table;
- struct ctl_table *next;
- int is_better = 0;
- int not_in_parent = !p->attached_by;
- while ((next = is_branch_in(by, to)) != NULL) {
- if (by == q->attached_by)
- is_better = 1;
- if (to == p->attached_by)
- not_in_parent = 1; 《---- 这里为什么不添加个判断 if (is_better && not_in_parent) 就break; 提前结束循环
- by = by->child;
- to = next->child;
- }
- if (is_better && not_in_parent) {
- q->attached_by = by;
- q->attached_to = to;
- q->parent = p;
- }
- }
复制代码
另外,网络上关于sysctl这部分代码分析没有看见,有疑问不知道找谁交流,直接问源代码作者吗,
|
|