1 #ifndef __LINUX_BITMAP_H
2 #define __LINUX_BITMAP_H
6 #include <linux/config.h>
7 #include <linux/compiler.h>
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/bitops.h>
11 #include <linux/string.h>
13 int bitmap_empty(const unsigned long *bitmap, int bits);
14 int bitmap_full(const unsigned long *bitmap, int bits);
15 int bitmap_equal(const unsigned long *bitmap1,
16 unsigned long *bitmap2, int bits);
17 void bitmap_complement(unsigned long *bitmap, int bits);
19 static inline void bitmap_zero(unsigned long *bitmap, int bits)
21 memset(bitmap, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long));
24 static inline void bitmap_fill(unsigned long *bitmap, int bits)
26 memset(bitmap, 0xff, BITS_TO_LONGS(bits)*sizeof(unsigned long));
29 static inline void bitmap_copy(unsigned long *dst,
30 const unsigned long *src, int bits)
32 memcpy(dst, src, BITS_TO_LONGS(bits)*sizeof(unsigned long));
35 void bitmap_shift_right(unsigned long *dst,
36 const unsigned long *src, int shift, int bits);
37 void bitmap_shift_left(unsigned long *dst,
38 const unsigned long *src, int shift, int bits);
39 void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
40 const unsigned long *bitmap2, int bits);
41 void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
42 const unsigned long *bitmap2, int bits);
43 int bitmap_weight(const unsigned long *bitmap, int bits);
44 int bitmap_scnprintf(char *buf, unsigned int buflen,
45 const unsigned long *maskp, int bits);
46 int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
47 unsigned long *maskp, int bits);
49 #endif /* __ASSEMBLY__ */
51 #endif /* __LINUX_BITMAP_H */