get rid of private bitmap functions in block/sheepdog.c, use generic ones
commit8cffde7329734c17ee2eeec84944abbf4a0f23f3
authorMichael Tokarev <mjt@tls.msk.ru>
Thu, 10 Mar 2011 14:03:41 +0000 (10 17:03 +0300)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 1 Apr 2011 20:23:06 +0000 (1 22:23 +0200)
tree4a9b6725f77e9d77ab4516f53ac49cada921e167
parent508240c0daecdd62ab46727f37145f2dbb029ff7
get rid of private bitmap functions in block/sheepdog.c, use generic ones

qemu now has generic bitmap functions,
so don't redefine them in sheepdog.c,
use common header instead.  A small cleanup.

Here's only one function which is actually
used in sheepdog and gets replaced with
a generic one (simplified):

- static inline int test_bit(int nr, const volatile unsigned long *addr)
+ static inline int test_bit(int nr, const unsigned long *addr)
 {
-  return ((1UL << (nr % BITS_PER_LONG))
            & ((unsigned long*)addr)[nr / BITS_PER_LONG])) != 0;
+  return 1UL & (addr[nr / BITS_PER_LONG] >> (nr & (BITS_PER_LONG-1)));
 }

The body is equivalent, but the argument is not: there's
"volatile" in there.  Why it is used for - I'm not sure.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
block/sheepdog.c