Revision 8cffde73

b/block/sheepdog.c
13 13
#include "qemu-error.h"
14 14
#include "qemu_socket.h"
15 15
#include "block_int.h"
16
#include "bitops.h"
16 17

  
17 18
#define SD_PROTO_VER 0x01
18 19

  
......
1829 1830
    return 0;
1830 1831
}
1831 1832

  
1832
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
1833
#define BITS_PER_BYTE        8
1834
#define BITS_TO_LONGS(nr)    DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
1835
#define DECLARE_BITMAP(name,bits)               \
1836
    unsigned long name[BITS_TO_LONGS(bits)]
1837

  
1838
#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long))
1839

  
1840
static inline int test_bit(unsigned int nr, const unsigned long *addr)
1841
{
1842
    return ((1UL << (nr % BITS_PER_LONG)) &
1843
            (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
1844
}
1845

  
1846 1833
static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
1847 1834
{
1848 1835
    BDRVSheepdogState *s = bs->opaque;

Also available in: Unified diff