diff options
author | Olaf Hering <olaf@aepfle.de> | 2011-11-20 17:02:40 +0100 |
---|---|---|
committer | Olaf Hering <olaf@aepfle.de> | 2011-11-20 17:02:40 +0100 |
commit | f91b416707b5b2cfae44c05c7e8672e3c2e44543 (patch) | |
tree | 87a8e74a34b8d2424bd8f11e26330c219fb1dd80 /tools/libxc/xc_bitops.h | |
parent | 64f1914eda442f36eee69954bb976e10774dbb81 (diff) | |
download | xen-f91b416707b5b2cfae44c05c7e8672e3c2e44543.tar.gz xen-f91b416707b5b2cfae44c05c7e8672e3c2e44543.tar.bz2 xen-f91b416707b5b2cfae44c05c7e8672e3c2e44543.zip |
libxc: add bitmap_clear function
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_bitops.h')
-rw-r--r-- | tools/libxc/xc_bitops.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/libxc/xc_bitops.h b/tools/libxc/xc_bitops.h index 8ee2aab95f..274d8c8b0e 100644 --- a/tools/libxc/xc_bitops.h +++ b/tools/libxc/xc_bitops.h @@ -4,6 +4,7 @@ /* bitmap operations for single threaded access */ #include <stdlib.h> +#include <string.h> #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define ORDER_LONG (sizeof(unsigned long) == 4 ? 5 : 6) @@ -25,6 +26,11 @@ static inline unsigned long *bitmap_alloc(int nr_bits) return calloc(1, bitmap_size(nr_bits)); } +static inline void bitmap_clear(unsigned long *addr, int nr_bits) +{ + memset(addr, 0, bitmap_size(nr_bits)); +} + static inline int test_bit(int nr, volatile unsigned long *addr) { return (BITMAP_ENTRY(nr, addr) >> BITMAP_SHIFT(nr)) & 1; |