| [2] | 1 | #ifndef __LINUX_BITMAP_H |
|---|
| 2 | #define __LINUX_BITMAP_H |
|---|
| 3 | |
|---|
| 4 | #ifndef __ASSEMBLY__ |
|---|
| 5 | |
|---|
| 6 | #include <linux/types.h> |
|---|
| 7 | #include <linux/bitops.h> |
|---|
| 8 | |
|---|
| 9 | int bitmap_empty(const unsigned long *bitmap, int bits); |
|---|
| 10 | int bitmap_full(const unsigned long *bitmap, int bits); |
|---|
| 11 | int bitmap_equal(const unsigned long *bitmap1, |
|---|
| 12 | unsigned long *bitmap2, int bits); |
|---|
| 13 | void bitmap_complement(unsigned long *bitmap, int bits); |
|---|
| 14 | |
|---|
| 15 | static inline void bitmap_zero(unsigned long *bitmap, int bits) |
|---|
| 16 | { |
|---|
| 17 | memset(bitmap, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long)); |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | static inline void bitmap_fill(unsigned long *bitmap, int bits) |
|---|
| 21 | { |
|---|
| 22 | memset(bitmap, 0xff, BITS_TO_LONGS(bits)*sizeof(unsigned long)); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | static inline void bitmap_copy(unsigned long *dst, |
|---|
| 26 | const unsigned long *src, int bits) |
|---|
| 27 | { |
|---|
| 28 | int len = BITS_TO_LONGS(bits)*sizeof(unsigned long); |
|---|
| 29 | memcpy(dst, src, len); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | void bitmap_shift_right(unsigned long *dst, |
|---|
| 33 | const unsigned long *src, int shift, int bits); |
|---|
| 34 | void bitmap_shift_left(unsigned long *dst, |
|---|
| 35 | const unsigned long *src, int shift, int bits); |
|---|
| 36 | void bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
|---|
| 37 | const unsigned long *bitmap2, int bits); |
|---|
| 38 | void bitmap_or(unsigned long *dst, const unsigned long *bitmap1, |
|---|
| 39 | const unsigned long *bitmap2, int bits); |
|---|
| 40 | int bitmap_weight(const unsigned long *bitmap, int bits); |
|---|
| 41 | int bitmap_scnprintf(char *buf, unsigned int buflen, |
|---|
| 42 | const unsigned long *maskp, int bits); |
|---|
| 43 | int bitmap_parse(const char *ubuf, unsigned int ubuflen, |
|---|
| 44 | unsigned long *maskp, int bits); |
|---|
| 45 | |
|---|
| 46 | #endif /* __ASSEMBLY__ */ |
|---|
| 47 | |
|---|
| 48 | #endif /* __LINUX_BITMAP_H */ |
|---|