diff options
-rw-r--r-- | kern/bitmap.c | 2 | ||||
-rw-r--r-- | kern/bitmap.h | 12 | ||||
-rw-r--r-- | kern/bitmap_i.h | 10 |
3 files changed, 11 insertions, 13 deletions
diff --git a/kern/bitmap.c b/kern/bitmap.c index 0e13ef55..97e497d6 100644 --- a/kern/bitmap.c +++ b/kern/bitmap.c @@ -78,7 +78,7 @@ bitmap_find_next_bit(const unsigned long *bm, int nr_bits, int bit, end = bm + BITMAP_LONGS(nr_bits); if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); nr_bits -= ((bm - start) * LONG_BIT); } diff --git a/kern/bitmap.h b/kern/bitmap.h index c206944a..9a3d7a0b 100644 --- a/kern/bitmap.h +++ b/kern/bitmap.h @@ -65,7 +65,7 @@ static inline void bitmap_set(unsigned long *bm, int bit) { if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); } *bm |= bitmap_mask(bit); @@ -75,7 +75,7 @@ static inline void bitmap_set_atomic(unsigned long *bm, int bit) { if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); } atomic_or(bm, bitmap_mask(bit), ATOMIC_RELEASE); @@ -85,7 +85,7 @@ static inline void bitmap_clear(unsigned long *bm, int bit) { if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); } *bm &= ~bitmap_mask(bit); @@ -95,7 +95,7 @@ static inline void bitmap_clear_atomic(unsigned long *bm, int bit) { if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); } atomic_and(bm, ~bitmap_mask(bit), ATOMIC_RELEASE); @@ -105,7 +105,7 @@ static inline int bitmap_test(const unsigned long *bm, int bit) { if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); } return ((*bm & bitmap_mask(bit)) != 0); @@ -115,7 +115,7 @@ static inline int bitmap_test_atomic(const unsigned long *bm, int bit) { if (bit >= LONG_BIT) { - bitmap_lookup(bm, bit); + bitmap_lookup(&bm, &bit); } return ((atomic_load(bm, ATOMIC_ACQUIRE) & bitmap_mask(bit)) != 0); diff --git a/kern/bitmap_i.h b/kern/bitmap_i.h index 11c23ebb..dc91a0ab 100644 --- a/kern/bitmap_i.h +++ b/kern/bitmap_i.h @@ -29,16 +29,14 @@ * to a bit inside the word pointed by the former. * * Implemented as a macro for const-correctness. - * - * TODO Fix interface. */ -#define bitmap_lookup(bm, bit) \ +#define bitmap_lookup(bmp, bitp) \ MACRO_BEGIN \ int i; \ \ - i = BITMAP_LONGS((bit) + 1) - 1; \ - (bm) += i; \ - (bit) -= i * LONG_BIT; \ + i = BITMAP_LONGS(*(bitp) + 1) - 1; \ + *(bmp) += i; \ + *(bitp) -= i * LONG_BIT; \ MACRO_END static inline unsigned long |