summaryrefslogtreecommitdiffstats
path: root/sys/sys/bitset.h
diff options
context:
space:
mode:
authorroyger <royger@FreeBSD.org>2016-05-06 16:41:23 +0000
committerroyger <royger@FreeBSD.org>2016-05-06 16:41:23 +0000
commit4bf5db0a14f80296b60c436d2e67bbba00f74d01 (patch)
tree6c5c93b09ce2ee9eb0bb3fb9491f984dcb99d7a5 /sys/sys/bitset.h
parent0bb25b8d7b1f4524d2a9b3c950eedbafbbc63d0d (diff)
downloadFreeBSD-src-4bf5db0a14f80296b60c436d2e67bbba00f74d01.zip
FreeBSD-src-4bf5db0a14f80296b60c436d2e67bbba00f74d01.tar.gz
bitset: introduce helpers to allocate a bitset at runtime
Introduce some new helpers to declare and allocate a dynamic bitset, whose size is not a constant. Sponsored by: Citrix Systems R&D Reviewed by: kib jhb Differential revision: https://reviews.freebsd.org/D6226
Diffstat (limited to 'sys/sys/bitset.h')
-rw-r--r--sys/sys/bitset.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h
index f1c7bf8..723c39b 100644
--- a/sys/sys/bitset.h
+++ b/sys/sys/bitset.h
@@ -199,4 +199,10 @@
#define BITSET_FSET(n) \
[ 0 ... ((n) - 1) ] = (-1L)
+/*
+ * Dynamically allocate a bitset.
+ */
+#define BITSET_ALLOC(_s, mt, mf) \
+ malloc(__bitset_words(_s) * sizeof(long), mt, (mf))
+
#endif /* !_SYS_BITSET_H_ */
OpenPOWER on IntegriCloud