diff options
author | Peter Xu <peterx@redhat.com> | 2017-08-30 16:32:00 +0800 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-09-22 14:11:25 +0200 |
commit | d7788151a0807d5d2d410e3f8944d8c8a651f8d2 (patch) | |
tree | 3e6ed934ea387d91404551d32c087f504f022d99 /include/qemu/bitmap.h | |
parent | fc7deeea26af3d08f45bad85b8bd3fc3d790a090 (diff) | |
download | qemu-d7788151a0807d5d2d410e3f8944d8c8a651f8d2.zip qemu-d7788151a0807d5d2d410e3f8944d8c8a651f8d2.tar.gz qemu-d7788151a0807d5d2d410e3f8944d8c8a651f8d2.tar.bz2 |
bitmap: provide to_le/from_le helpers
Provide helpers to convert bitmaps to little endian format. It can be
used when we want to send one bitmap via network to some other hosts.
One thing to mention is that, these helpers only solve the problem of
endianess, but it does not solve the problem of different word size on
machines (the bitmaps managing same count of bits may contains different
size when malloced). So we need to take care of the size alignment issue
on the callers for now.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'include/qemu/bitmap.h')
-rw-r--r-- | include/qemu/bitmap.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 2718706..509eedd 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -39,6 +39,8 @@ * bitmap_clear(dst, pos, nbits) Clear specified bit area * bitmap_test_and_clear_atomic(dst, pos, nbits) Test and clear area * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area + * bitmap_to_le(dst, src, nbits) Convert bitmap to little endian + * bitmap_from_le(dst, src, nbits) Convert bitmap from little endian */ /* @@ -247,4 +249,9 @@ static inline unsigned long *bitmap_zero_extend(unsigned long *old, return new; } +void bitmap_to_le(unsigned long *dst, const unsigned long *src, + long nbits); +void bitmap_from_le(unsigned long *dst, const unsigned long *src, + long nbits); + #endif /* BITMAP_H */ |