diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-21 12:26:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-21 12:26:15 -0400 |
commit | f4b0373b26567cafd421d91101852ed7a34e9e94 (patch) | |
tree | 35607b1c1d28429bb275ca3472cd0065fbde2f14 /include/linux/bitmap.h | |
parent | 83d349f35e1ae72268c5104dbf9ab2ae635425d4 (diff) |
Make bitmask 'and' operators return a result code
When 'and'ing two bitmasks (where 'andnot' is a variation on it), some
cases want to know whether the result is the empty set or not. In
particular, the TLB IPI sending code wants to do cpumask operations and
determine if there are any CPU's left in the final set.
So this just makes the bitmask (and cpumask) functions return a boolean
for whether the result has any bits set.
Cc: stable@kernel.org (2.6.30, needed by TLB shootdown fix)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/bitmap.h')
-rw-r--r-- | include/linux/bitmap.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 2878811c6134..756d78b8c1c5 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -94,13 +94,13 @@ extern void __bitmap_shift_right(unsigned long *dst, | |||
94 | const unsigned long *src, int shift, int bits); | 94 | const unsigned long *src, int shift, int bits); |
95 | extern void __bitmap_shift_left(unsigned long *dst, | 95 | extern void __bitmap_shift_left(unsigned long *dst, |
96 | const unsigned long *src, int shift, int bits); | 96 | const unsigned long *src, int shift, int bits); |
97 | extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, | 97 | extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
98 | const unsigned long *bitmap2, int bits); | 98 | const unsigned long *bitmap2, int bits); |
99 | extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, | 99 | extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, |
100 | const unsigned long *bitmap2, int bits); | 100 | const unsigned long *bitmap2, int bits); |
101 | extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, | 101 | extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, |
102 | const unsigned long *bitmap2, int bits); | 102 | const unsigned long *bitmap2, int bits); |
103 | extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, | 103 | extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
104 | const unsigned long *bitmap2, int bits); | 104 | const unsigned long *bitmap2, int bits); |
105 | extern int __bitmap_intersects(const unsigned long *bitmap1, | 105 | extern int __bitmap_intersects(const unsigned long *bitmap1, |
106 | const unsigned long *bitmap2, int bits); | 106 | const unsigned long *bitmap2, int bits); |
@@ -171,13 +171,12 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, | 174 | static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, |
175 | const unsigned long *src2, int nbits) | 175 | const unsigned long *src2, int nbits) |
176 | { | 176 | { |
177 | if (small_const_nbits(nbits)) | 177 | if (small_const_nbits(nbits)) |
178 | *dst = *src1 & *src2; | 178 | return (*dst = *src1 & *src2) != 0; |
179 | else | 179 | return __bitmap_and(dst, src1, src2, nbits); |
180 | __bitmap_and(dst, src1, src2, nbits); | ||
181 | } | 180 | } |
182 | 181 | ||
183 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, | 182 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, |
@@ -198,13 +197,12 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, | |||
198 | __bitmap_xor(dst, src1, src2, nbits); | 197 | __bitmap_xor(dst, src1, src2, nbits); |
199 | } | 198 | } |
200 | 199 | ||
201 | static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, | 200 | static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, |
202 | const unsigned long *src2, int nbits) | 201 | const unsigned long *src2, int nbits) |
203 | { | 202 | { |
204 | if (small_const_nbits(nbits)) | 203 | if (small_const_nbits(nbits)) |
205 | *dst = *src1 & ~(*src2); | 204 | return (*dst = *src1 & ~(*src2)) != 0; |
206 | else | 205 | return __bitmap_andnot(dst, src1, src2, nbits); |
207 | __bitmap_andnot(dst, src1, src2, nbits); | ||
208 | } | 206 | } |
209 | 207 | ||
210 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, | 208 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, |