@@ -2,6 +2,17 @@
#define __BP_LINUX_BITMAP_H
#include_next <linux/bitmap.h>
+#if LINUX_VERSION_IS_LESS(4,19,0)
+#define bitmap_alloc LINUX_BACKPORT(bitmap_alloc)
+unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags);
+
+#define bitmap_zalloc LINUX_BACKPORT(bitmap_zalloc)
+unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags);
+
+#define bitmap_free LINUX_BACKPORT(bitmap_free)
+void bitmap_free(const unsigned long *bitmap);
+#endif
+
#if LINUX_VERSION_IS_LESS(5,13,0)
/* Managed variants of the above. */
#define devm_bitmap_alloc LINUX_BACKPORT(devm_bitmap_alloc)
@@ -8,6 +8,7 @@ compat-y += main.o
# Kernel backport compatibility code
compat-$(CPTCFG_KERNEL_4_18) += backport-4.18.o
+compat-$(CPTCFG_KERNEL_4_19) += backport-4.19.o
compat-$(CPTCFG_KERNEL_5_2) += backport-5.2.o backport-genetlink.o
compat-$(CPTCFG_KERNEL_5_3) += backport-5.3.o
compat-$(CPTCFG_KERNEL_5_5) += backport-5.5.o
new file mode 100644
@@ -0,0 +1,21 @@
+#include <linux/bitmap.h>
+#include <linux/slab.h>
+
+unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags)
+{
+ return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long),
+ flags);
+}
+EXPORT_SYMBOL_GPL(bitmap_alloc);
+
+unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags)
+{
+ return bitmap_alloc(nbits, flags | __GFP_ZERO);
+}
+EXPORT_SYMBOL_GPL(bitmap_zalloc);
+
+void bitmap_free(const unsigned long *bitmap)
+{
+ kfree(bitmap);
+}
+EXPORT_SYMBOL_GPL(bitmap_free);
These functions were added in kernel 4.19 and are used by mac80211 and some drivers now. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- backport/backport-include/linux/bitmap.h | 11 +++++++++++ backport/compat/Makefile | 1 + backport/compat/backport-4.19.c | 21 +++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 backport/compat/backport-4.19.c