summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/jffs2/include/linux/rbtree.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-09-12 16:46:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-09-19 13:16:06 +0200
commit672038b174456ff89d46a5f16ecac90f43e364f3 (patch)
tree3970a083f83ee0d4e6af96db6f894710c36b837d /cpukit/libfs/src/jffs2/include/linux/rbtree.h
parentJFFS2: Import from Linux (diff)
downloadrtems-672038b174456ff89d46a5f16ecac90f43e364f3.tar.bz2
JFFS2: Import from eCos
Import of Linux compatibility layer and JFFS2 file system support from eCos. The files are imported from eCos CVS on 2013-09-16. cvs -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos login cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos The files "ecos/packages/compat/linux/current/asm/atomic.h", "ecos/packages/compat/linux/current/asm/bug.h", "ecos/packages/compat/linux/current/asm/page.h", "ecos/packages/compat/linux/current/cyg/crc/crc.h", "ecos/packages/compat/linux/current/cyg/infra/cyg_type.h", "ecos/packages/compat/linux/current/linux/compiler.h", "ecos/packages/compat/linux/current/linux/completion.h", "ecos/packages/compat/linux/current/linux/config.h", "ecos/packages/compat/linux/current/linux/crc32.h", "ecos/packages/compat/linux/current/linux/errno.h", "ecos/packages/compat/linux/current/linux/fs.h", "ecos/packages/compat/linux/current/linux/kernel.h", "ecos/packages/compat/linux/current/linux/list.h", "ecos/packages/compat/linux/current/linux/mtd/compatmac.h", "ecos/packages/compat/linux/current/linux/mtd/mtd.h", "ecos/packages/compat/linux/current/linux/pagemap.h", "ecos/packages/compat/linux/current/linux/rbtree.h", "ecos/packages/compat/linux/current/linux/rwsem.h", "ecos/packages/compat/linux/current/linux/sched.h", "ecos/packages/compat/linux/current/linux/slab.h", "ecos/packages/compat/linux/current/linux/spinlock.h", "ecos/packages/compat/linux/current/linux/stat.h", "ecos/packages/compat/linux/current/linux/string.h", "ecos/packages/compat/linux/current/linux/timer.h", "ecos/packages/compat/linux/current/linux/types.h", "ecos/packages/compat/linux/current/linux/version.h", "ecos/packages/compat/linux/current/linux/vmalloc.h", "ecos/packages/compat/linux/current/linux/wait.h", "ecos/packages/compat/linux/current/linux/workqueue.h", and "ecos/packages/compat/linux/current/linux/zlib.h" "ecos/packages/compat/linux/current/linux/zutil.h" are copied to "cpukit/libfs/src/jffs2/include". The file "ecos/packages/services/crc/current/src/crc32.c" is copied to "cpukit/libfs/src/jffs2/src/compat-crc32.c". The file "ecos/packages/compat/linux/current/src/rbtree.c" is copied to "cpukit/libfs/src/jffs2/src/compat-rbtree.c". The file "ecos/packages/fs/jffs2/current/src/dir-ecos.c" is copied to "cpukit/libfs/src/jffs2/src/dir-rtems.c". The file "ecos/packages/fs/jffs2/current/src/flashio.c" is copied to "cpukit/libfs/src/jffs2/src/flashio.c". The file "ecos/packages/fs/jffs2/current/src/fs-ecos.c" is copied to "cpukit/libfs/src/jffs2/src/fs-rtems.c". The file "ecos/packages/fs/jffs2/current/src/malloc-ecos.c" is copied to "cpukit/libfs/src/jffs2/src/malloc-rtems.c". The file "ecos/packages/fs/jffs2/current/src/os-ecos.h" is copied to "cpukit/libfs/src/jffs2/src/os-rtems.h". The LICENSE file referenced in some files of this patch set is part of a previous patch set imported from Linux.
Diffstat (limited to 'cpukit/libfs/src/jffs2/include/linux/rbtree.h')
-rw-r--r--cpukit/libfs/src/jffs2/include/linux/rbtree.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/cpukit/libfs/src/jffs2/include/linux/rbtree.h b/cpukit/libfs/src/jffs2/include/linux/rbtree.h
new file mode 100644
index 0000000000..fef5f718d6
--- /dev/null
+++ b/cpukit/libfs/src/jffs2/include/linux/rbtree.h
@@ -0,0 +1,46 @@
+#ifndef _LINUX_RBTREE_H
+#define _LINUX_RBTREE_H
+
+
+struct rb_node {
+ struct rb_node *rb_left; /* left element */
+ struct rb_node *rb_right; /* right element */
+ struct rb_node *rb_parent; /* parent element */
+ int rb_color; /* node color */
+};
+
+struct rb_root {
+ struct rb_node *rb_node; /* root of the tree */
+};
+#define NULL ((void *)0)
+#define RB_ROOT ((struct rb_root){NULL})
+#define rb_entry(p, container, field) \
+ ((container *) ((char *)p - ((char *)&(((container *)0)->field))))
+
+#define RB_BLACK 0
+#define RB_RED 1
+
+
+extern void rb_insert_color(struct rb_node *, struct rb_root *);
+extern void rb_erase(struct rb_node *, struct rb_root *);
+
+/* Find logical next and previous nodes in a tree */
+extern struct rb_node *rb_next(struct rb_node *);
+extern struct rb_node *rb_prev(struct rb_node *);
+extern struct rb_node *rb_first(struct rb_root *);
+
+/* Fast replacement of a single node without remove/rebalance/add/rebalance */
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+ struct rb_root *root);
+
+static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
+ struct rb_node ** rb_link)
+{
+ node->rb_parent = parent;
+ node->rb_color = RB_RED;
+ node->rb_left = node->rb_right = NULL;
+
+ *rb_link = node;
+}
+
+#endif /* _LINUX_RBTREE_H */