aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/include/linux/bitmap.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h
index 28f5493da491..60c44b615902 100644
--- a/tools/include/linux/bitmap.h
+++ b/tools/include/linux/bitmap.h
@@ -3,6 +3,7 @@
3 3
4#include <string.h> 4#include <string.h>
5#include <linux/bitops.h> 5#include <linux/bitops.h>
6#include <stdlib.h>
6 7
7#define DECLARE_BITMAP(name,bits) \ 8#define DECLARE_BITMAP(name,bits) \
8 unsigned long name[BITS_TO_LONGS(bits)] 9 unsigned long name[BITS_TO_LONGS(bits)]
@@ -65,4 +66,13 @@ static inline int test_and_set_bit(int nr, unsigned long *addr)
65 return (old & mask) != 0; 66 return (old & mask) != 0;
66} 67}
67 68
69/**
70 * bitmap_alloc - Allocate bitmap
71 * @nr: Bit to set
72 */
73static inline unsigned long *bitmap_alloc(int nbits)
74{
75 return calloc(1, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
76}
77
68#endif /* _PERF_BITOPS_H */ 78#endif /* _PERF_BITOPS_H */