aboutsummaryrefslogtreecommitdiff
path: root/include/apos/nodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/apos/nodes.h')
-rw-r--r--include/apos/nodes.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/apos/nodes.h b/include/apos/nodes.h
new file mode 100644
index 0000000..80888e1
--- /dev/null
+++ b/include/apos/nodes.h
@@ -0,0 +1,30 @@
+#ifndef APOS_NODES_H
+#define APOS_NODES_H
+
+#include <apos/types.h>
+
+enum node_status { FREE = 0, USED = 1};
+struct node_region {
+ size_t used_nodes;
+
+ struct node_region *av_next;
+ struct node_region *av_prev;
+
+ struct node_region *next;
+ struct node_region *prev;
+};
+
+struct node_root {
+ size_t node_size;
+
+ struct node_region *head;
+ struct node_region *av_head;
+};
+
+void init_nodes(struct node_root *r, size_t node_size);
+void destroy_nodes(struct node_root *r);
+
+void *get_node(struct node_root *r);
+void free_node(struct node_root *r, void *p);
+
+#endif /* APOS_NODES_H */