3 struct pageframe *pf_insert(struct rb_root *root, struct pageframe *pf)
5 struct rb_node **new = &(root->rb_node), *parent = NULL;
7 /* Figure out where to put new node */
9 struct pageframe *this = rb_to_pageframe(*new);
10 int result = pf->pf - this->pf;
14 new = &((*new)->rb_left);
16 new = &((*new)->rb_right);
19 * We already have a matching node in the
20 * tree. Return that node to indicate the
26 /* Add new node and rebalance tree. */
27 rb_link_node(&pf->tree, parent, new);
28 rb_insert_color(&pf->tree, root);
33 struct pageframe *pf_search(struct rb_root *root, struct pageframe *pf)
35 struct rb_node *node = root->rb_node;
38 struct pageframe *this = rb_to_pageframe(node);
41 result = pf->pf - this->pf;
46 node = node->rb_right;