[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-98c032967a299ee4bf14ef19eded02b65df32e6f@git.kernel.org>
Date: Thu, 4 Aug 2016 02:11:06 -0700
From: tip-bot for Jiri Olsa <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, dsahern@...il.com, hpa@...or.com,
tglx@...utronix.de, a.p.zijlstra@...llo.nl, jolsa@...nel.org,
acme@...hat.com, jolsa@...hat.com, mingo@...nel.org,
namhyung@...nel.org
Subject: [tip:perf/urgent] tools lib: Add bitmap_alloc function
Commit-ID: 98c032967a299ee4bf14ef19eded02b65df32e6f
Gitweb: http://git.kernel.org/tip/98c032967a299ee4bf14ef19eded02b65df32e6f
Author: Jiri Olsa <jolsa@...hat.com>
AuthorDate: Tue, 2 Aug 2016 13:33:02 +0200
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 2 Aug 2016 16:33:26 -0300
tools lib: Add bitmap_alloc function
Adding bitmap_alloc function to dynamically allocate bitmap.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/r/20160802113302.GA7479@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/include/linux/bitmap.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h
index 28f5493..60c44b6 100644
--- a/tools/include/linux/bitmap.h
+++ b/tools/include/linux/bitmap.h
@@ -3,6 +3,7 @@
#include <string.h>
#include <linux/bitops.h>
+#include <stdlib.h>
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]
@@ -65,4 +66,13 @@ static inline int test_and_set_bit(int nr, unsigned long *addr)
return (old & mask) != 0;
}
+/**
+ * bitmap_alloc - Allocate bitmap
+ * @nr: Bit to set
+ */
+static inline unsigned long *bitmap_alloc(int nbits)
+{
+ return calloc(1, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
+}
+
#endif /* _PERF_BITOPS_H */
Powered by blists - more mailing lists