summaryrefslogtreecommitdiff
path: root/lib/bitmap.h
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:37:29 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:37:29 +0100
commit03ed8f17dc5c8399ed81bef22e34c62301a3cad1 (patch)
tree5037335a908dfca273e297a3b7604d78ee147f7b /lib/bitmap.h
parentdf96a5e1a067cbcf9c73f4c76700ff48019fde7b (diff)
parente55696a4f88b63c622bb3a0360f9114d01253e53 (diff)
Merge commit 'e55696a4' into wireguard-next-tmp7-1
Diffstat (limited to 'lib/bitmap.h')
-rw-r--r--lib/bitmap.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bitmap.h b/lib/bitmap.h
index 0093cd18..4d2dc2a8 100644
--- a/lib/bitmap.h
+++ b/lib/bitmap.h
@@ -60,4 +60,25 @@ void hmap_clear(struct hmap *b, uint n);
u32 hmap_first_zero(struct hmap *b);
void hmap_check(struct hmap *b);
+
+struct lmap
+{
+ slab *slab;
+ uint size;
+ u32 **data;
+ u32 *root;
+};
+
+static inline uint lmap_max(struct lmap *b)
+{ return b->size << 10; }
+
+void lmap_init(struct lmap *b, pool *p);
+void lmap_free(struct lmap *b);
+int lmap_test(struct lmap *b, uint n);
+void lmap_set(struct lmap *b, uint n);
+void lmap_clear(struct lmap *b, uint n);
+uint lmap_first_zero(struct lmap *b);
+uint lmap_first_zero_in_range(struct lmap *b, uint lo, uint hi);
+void lmap_check(struct lmap *b);
+
#endif