Clears the bitmap.
---
common/bitmap/bitmap.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/common/bitmap/bitmap.h b/common/bitmap/bitmap.h
index 80fd5e4..0da650a 100644
--- a/common/bitmap/bitmap.h
+++ b/common/bitmap/bitmap.h
@@ -42,6 +42,7 @@
#define NBDKIT_BITMAP_H
#include <stdint.h>
+#include <string.h>
#include <assert.h>
#include <nbdkit-plugin.h>
@@ -100,6 +101,13 @@ bitmap_free (struct bitmap *bm)
*/
extern int bitmap_resize (struct bitmap *bm, uint64_t new_size);
+/* Clear the bitmap (set everything to zero). */
+static inline void
+bitmap_clear (struct bitmap *bm)
+{
+ memset (bm->bitmap, 0, bm->size);
+}
+
/* This macro calculates the byte offset in the bitmap and which
* bit/mask we are addressing within that byte.
*
--
2.19.2