mtd/fs/jffs2 rbtree.c,NONE,1.1 nodelist.c,1.64,1.65
David Woodhouse
dwmw2 at infradead.org
Tue Nov 12 04:50:15 EST 2002
Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv30368
Modified Files:
nodelist.c
Added Files:
rbtree.c
Log Message:
Switch rbtree stuff to typedef-abuse-free, move rb functions to rbtree.c
***** Error reading new file: [Errno 2] No such file or directory: 'rbtree.c'
Index: nodelist.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- nodelist.c 20 Sep 2002 14:54:50 -0000 1.64
+++ nodelist.c 12 Nov 2002 09:50:13 -0000 1.65
@@ -465,11 +465,11 @@
}
}
-struct jffs2_node_frag *jffs2_lookup_node_frag(rb_root_t *fragtree, uint32_t offset)
+struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_t offset)
{
/* The common case in lookup is that there will be a node
which precisely matches. So we go looking for that first */
- rb_node_t *next;
+ struct rb_node *next;
struct jffs2_node_frag *prev = NULL;
struct jffs2_node_frag *frag = NULL;
@@ -514,7 +514,7 @@
/* Pass 'c' argument to indicate that nodes should be marked obsolete as
they're killed. */
-void jffs2_kill_fragtree(rb_root_t *root, struct jffs2_sb_info *c)
+void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c)
{
struct jffs2_node_frag *frag;
struct jffs2_node_frag *parent;
@@ -565,8 +565,8 @@
void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_node_frag *base)
{
- rb_node_t *parent = &base->rb;
- rb_node_t **link = &parent;
+ struct rb_node *parent = &base->rb;
+ struct rb_node **link = &parent;
D2(printk(KERN_DEBUG "jffs2_fragtree_insert(%p; %d-%d, %p)\n", newfrag,
newfrag->ofs, newfrag->ofs+newfrag->size, base));
@@ -587,63 +587,4 @@
}
rb_link_node(&newfrag->rb, &base->rb, link);
-}
-
-rb_node_t *rb_next(rb_node_t *node)
-{
- /* If we have a right-hand child, go down and then left as far
- as we can. */
- if (node->rb_right) {
- node = node->rb_right;
- while (node->rb_left)
- node=node->rb_left;
- return node;
- }
-
- /* No right-hand children. Everything down and left is
- smaller than us, so any 'next' node must be in the general
- direction of our parent. Go up the tree; any time the
- ancestor is a right-hand child of its parent, keep going
- up. First time it's a left-hand child of its parent, said
- parent is our 'next' node. */
- while (node->rb_parent && node == node->rb_parent->rb_right)
- node = node->rb_parent;
-
- return node->rb_parent;
-}
-
-rb_node_t *rb_prev(rb_node_t *node)
-{
- if (node->rb_left) {
- node = node->rb_left;
- while (node->rb_right)
- node=node->rb_right;
- return node;
- }
- while (node->rb_parent && node == node->rb_parent->rb_left)
- node = node->rb_parent;
-
- return node->rb_parent;
-}
-
-void rb_replace_node(rb_node_t *victim, rb_node_t *new, rb_root_t *root)
-{
- rb_node_t *parent = victim->rb_parent;
-
- /* Set the surrounding nodes to point to the replacement */
- if (parent) {
- if (victim == parent->rb_left)
- parent->rb_left = new;
- else
- parent->rb_right = new;
- } else {
- root->rb_node = new;
- }
- if (victim->rb_left)
- victim->rb_left->rb_parent = new;
- if (victim->rb_right)
- victim->rb_right->rb_parent = new;
-
- /* Copy the pointers/colour from the victim to the replacement */
- *new = *victim;
}
More information about the linux-mtd-cvs
mailing list