1 #ifndef __LIB_KERNEL_BITMAP_H
2 #define __LIB_KERNEL_BITMAP_H
7 /* Bitmap abstract data type. */
9 struct bitmap *bitmap_create (size_t bit_cnt);
10 void bitmap_destroy (struct bitmap *);
12 size_t bitmap_size (const struct bitmap *);
14 void bitmap_set (struct bitmap *, size_t idx, bool);
15 void bitmap_set_all (struct bitmap *, bool);
17 void bitmap_mark (struct bitmap *, size_t idx);
18 void bitmap_reset (struct bitmap *, size_t idx);
19 void bitmap_flip (struct bitmap *, size_t idx);
21 bool bitmap_test (const struct bitmap *, size_t idx);
23 #define BITMAP_ERROR ((size_t) -1)
24 size_t bitmap_scan (const struct bitmap *, bool);
25 size_t bitmap_find_and_set (struct bitmap *);
26 size_t bitmap_find_and_clear (struct bitmap *);
28 size_t bitmap_set_cnt (const struct bitmap *);
29 bool bitmap_clear_cnt (const struct bitmap *);
31 bool bitmap_any (const struct bitmap *);
32 bool bitmap_none (const struct bitmap *);
33 bool bitmap_all (const struct bitmap *);
37 size_t bitmap_file_size (const struct bitmap *);
38 void bitmap_read (struct bitmap *, struct file *);
39 void bitmap_write (const struct bitmap *, struct file *);
42 void bitmap_dump (const struct bitmap *);
44 #endif /* lib/kernel/bitmap.h */