Rev 5056 | Rev 6082 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5056 | Rev 5270 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | * bitmap_full(src, nbits) Are all bits set in *src? |
43 | * bitmap_full(src, nbits) Are all bits set in *src? |
44 | * bitmap_weight(src, nbits) Hamming Weight: number set bits |
44 | * bitmap_weight(src, nbits) Hamming Weight: number set bits |
45 | * bitmap_set(dst, pos, nbits) Set specified bit area |
45 | * bitmap_set(dst, pos, nbits) Set specified bit area |
46 | * bitmap_clear(dst, pos, nbits) Clear specified bit area |
46 | * bitmap_clear(dst, pos, nbits) Clear specified bit area |
47 | * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area |
47 | * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area |
- | 48 | * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above |
|
48 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
49 | * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n |
49 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n |
50 | * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n |
50 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) |
51 | * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) |
51 | * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) |
52 | * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) |
52 | * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap |
53 | * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap |
Line 58... | Line 59... | ||
58 | * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf |
59 | * bitmap_parselist(buf, dst, nbits) Parse bitmap dst from kernel buf |
59 | * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf |
60 | * bitmap_parselist_user(buf, dst, nbits) Parse bitmap dst from user buf |
60 | * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region |
61 | * bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region |
61 | * bitmap_release_region(bitmap, pos, order) Free specified bit region |
62 | * bitmap_release_region(bitmap, pos, order) Free specified bit region |
62 | * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region |
63 | * bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region |
- | 64 | * bitmap_print_to_pagebuf(list, buf, mask, nbits) Print bitmap src as list/hex |
|
63 | */ |
65 | */ |
Line 64... | Line 66... | ||
64 | 66 | ||
65 | /* |
67 | /* |
66 | * Also the following operations in asm/bitops.h apply to bitmaps. |
68 | * Also the following operations in asm/bitops.h apply to bitmaps. |
Line 112... | Line 114... | ||
112 | const unsigned long *bitmap2, unsigned int nbits); |
114 | const unsigned long *bitmap2, unsigned int nbits); |
113 | extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits); |
115 | extern int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits); |
Line 114... | Line 116... | ||
114 | 116 | ||
115 | extern void bitmap_set(unsigned long *map, unsigned int start, int len); |
117 | extern void bitmap_set(unsigned long *map, unsigned int start, int len); |
- | 118 | extern void bitmap_clear(unsigned long *map, unsigned int start, int len); |
|
116 | extern void bitmap_clear(unsigned long *map, unsigned int start, int len); |
119 | |
- | 120 | extern unsigned long bitmap_find_next_zero_area_off(unsigned long *map, |
|
- | 121 | unsigned long size, |
|
- | 122 | unsigned long start, |
|
- | 123 | unsigned int nr, |
|
- | 124 | unsigned long align_mask, |
|
- | 125 | unsigned long align_offset); |
|
- | 126 | ||
- | 127 | /** |
|
- | 128 | * bitmap_find_next_zero_area - find a contiguous aligned zero area |
|
- | 129 | * @map: The address to base the search on |
|
- | 130 | * @size: The bitmap size in bits |
|
- | 131 | * @start: The bitnumber to start searching at |
|
- | 132 | * @nr: The number of zeroed bits we're looking for |
|
- | 133 | * @align_mask: Alignment mask for zero area |
|
- | 134 | * |
|
- | 135 | * The @align_mask should be one less than a power of 2; the effect is that |
|
- | 136 | * the bit offset of all zero areas this function finds is multiples of that |
|
- | 137 | * power of 2. A @align_mask of 0 means no alignment is required. |
|
- | 138 | */ |
|
- | 139 | static inline unsigned long |
|
117 | extern unsigned long bitmap_find_next_zero_area(unsigned long *map, |
140 | bitmap_find_next_zero_area(unsigned long *map, |
118 | unsigned long size, |
141 | unsigned long size, |
119 | unsigned long start, |
142 | unsigned long start, |
120 | unsigned int nr, |
143 | unsigned int nr, |
- | 144 | unsigned long align_mask) |
|
- | 145 | { |
|
- | 146 | return bitmap_find_next_zero_area_off(map, size, start, nr, |
|
- | 147 | align_mask, 0); |
|
Line 121... | Line 148... | ||
121 | unsigned long align_mask); |
148 | } |
122 | 149 | ||
123 | extern int bitmap_scnprintf(char *buf, unsigned int len, |
150 | extern int bitmap_scnprintf(char *buf, unsigned int len, |
124 | const unsigned long *src, int nbits); |
151 | const unsigned long *src, int nbits); |
Line 143... | Line 170... | ||
143 | extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); |
170 | extern int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order); |
144 | extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); |
171 | extern void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order); |
145 | extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); |
172 | extern int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order); |
146 | extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); |
173 | extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); |
147 | extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); |
174 | extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits); |
- | 175 | extern int bitmap_print_to_pagebuf(bool list, char *buf, |
|
- | 176 | const unsigned long *maskp, int nmaskbits); |
|
Line 148... | Line 177... | ||
148 | 177 | ||
149 | #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) |
178 | #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) |
150 | #define BITMAP_LAST_WORD_MASK(nbits) \ |
179 | #define BITMAP_LAST_WORD_MASK(nbits) \ |
151 | ( \ |
180 | ( \ |