summaryrefslogtreecommitdiff
path: root/include/linux/skip_lists.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/skip_lists.h')
-rw-r--r--include/linux/skip_lists.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/skip_lists.h b/include/linux/skip_lists.h
new file mode 100644
index 000000000..c19a6ea62
--- /dev/null
+++ b/include/linux/skip_lists.h
@@ -0,0 +1,27 @@
+#ifndef _LINUX_SKIP_LISTS_H
+#define _LINUX_SKIP_LISTS_H
+typedef u64 keyType;
+typedef void *valueType;
+
+typedef struct nodeStructure skiplist_node;
+
+struct nodeStructure {
+ int level; /* Levels in this structure */
+ keyType key;
+ valueType value;
+ skiplist_node *next[16];
+ skiplist_node *prev[16];
+};
+
+typedef struct listStructure {
+ int entries;
+ int level; /* Maximum level of the list
+ (1 more than the number of levels in the list) */
+ skiplist_node *header; /* pointer to header */
+} skiplist;
+
+skiplist_node *skiplist_init(void);
+skiplist *new_skiplist(skiplist_node *slnode);
+skiplist_node *skiplist_insert(skiplist_node *slnode, skiplist *l, keyType key, valueType value, unsigned int randseed);
+void skiplist_delnode(skiplist_node *slnode, skiplist *l, skiplist_node *node);
+#endif /* _LINUX_SKIP_LISTS_H */