*参照元 [#cf0dfa3e]
#backlinks

*説明 [#mb290d03]
-パス: [[linux-2.6.33/kernel/resource.c]]

-FIXME: これは何?
--説明


**引数 [#ua56f236]
-struct resource *parent
--
--[[linux-2.6.33/resource]]
-struct resource *new
--


**返り値 [#h1ee589f]
-struct resource *
--成功ならば NULL、失敗ならば衝突したリソースへのポインタを返す。


**参考 [#l72083f8]


*実装 [#lac78117]
 /*
  * Insert a resource into the resource tree. If successful, return NULL,
  * otherwise return the conflicting resource (compare to __request_resource())
  */
 static struct resource * __insert_resource(struct resource *parent, struct resource *new)
 {
 	struct resource *first, *next;
 
 	for (;; parent = first) {
 		first = __request_resource(parent, new);
 		if (!first)
 			return first;
 
 		if (first == parent)
 			return first;
 
 		if ((first->start > new->start) || (first->end < new->end))
 			break;
 		if ((first->start == new->start) && (first->end == new->end))
 			break;
 	}
 
-
--[[linux-2.6.33/__request_resource()]]

 	for (next = first; ; next = next->sibling) {
 		/* Partial overlap? Bad, and unfixable */
 		if (next->start < new->start || next->end > new->end)
 			return next;
 		if (!next->sibling)
 			break;
 		if (next->sibling->start > new->end)
 			break;
 	}
 
 	new->parent = parent;
 	new->sibling = next->sibling;
 	new->child = first;
 
 	next->sibling = NULL;
 	for (next = first; next; next = next->sibling)
 		next->parent = new;
 
 	if (parent->child == first) {
 		parent->child = new;
 	} else {
 		next = parent->child;
 		while (next->sibling != first)
 			next = next->sibling;
 		next->sibling = new;
 	}
 	return NULL;
 }


*コメント [#p5abafda]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS