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 int len = BITS_TO_LONGS(bits)*sizeof(unsigned long);
33 memcpy(dst, src, len);
36 void bitmap_shift_right(unsigned long *dst,
37 const unsigned long *src, int shift, int bits);
38 void bitmap_shift_left(unsigned long *dst,
39 const unsigned long *src, int shift, int bits);
40 void bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
41 const unsigned long *bitmap2, int bits);
42 void bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
43 const unsigned long *bitmap2, int bits);
44 int bitmap_weight(const unsigned long *bitmap, int bits);
45 int bitmap_scnprintf(char *buf, unsigned int buflen,
46 const unsigned long *maskp, int bits);
47 int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
48 unsigned long *maskp, int bits);
50 #endif /* __ASSEMBLY__ */
52 #endif /* __LINUX_BITMAP_H */