+#define BIT(bit) (1u << bit)
+
+/* Unsigned long-based bitmap interface in the linux kernel */
+#define BITMAP_WORDBITS (sizeof(unsigned long) * 8)
+#define BITS_TO_LONGS(bits) (roundup(bits, BITMAP_WORDBITS) / \
+ sizeof(unsigned long))
+static inline bool
+test_bit(unsigned int bit, unsigned long *addr)
+{
+ return addr[bit / BITMAP_WORDBITS] & (1ul << (bit % BITMAP_WORDBITS));
+}
+
+static inline bool
+set_bit(unsigned int bit, unsigned long *addr)
+{
+ return addr[bit / BITMAP_WORDBITS] |= (1ul << (bit % BITMAP_WORDBITS));
+}
+