From ff40b201543aff558f2bf681da3093bce82c6eba Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Tue, 14 Jan 2014 15:07:28 +0100 Subject: [PATCH 17/40] bitmap: Add bitmap_zero_extend operation RH-Author: Juan Quintela Message-id: <1389712071-23303-18-git-send-email-quintela@redhat.com> Patchwork-id: 56671 O-Subject: [RHEL7 qemu-kvm PATCH 17/40] bitmap: Add bitmap_zero_extend operation Bugzilla: 997559 RH-Acked-by: Paolo Bonzini RH-Acked-by: Orit Wasserman RH-Acked-by: Dr. David Alan Gilbert (git) Signed-off-by: Juan Quintela Reviewed-by: Eric Blake Reviewed-by: Orit Wasserman (cherry picked from commit 164590a60fd685399da259ac41b338d9a0b9d6c0) Signed-off-by: Juan Quintela --- include/qemu/bitmap.h | 9 +++++++++ 1 file changed, 9 insertions(+) Signed-off-by: Miroslav Rezanina --- include/qemu/bitmap.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index afdd257..1babd5d 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -220,4 +220,13 @@ unsigned long bitmap_find_next_zero_area(unsigned long *map, unsigned long nr, unsigned long align_mask); +static inline unsigned long *bitmap_zero_extend(unsigned long *old, + long old_nbits, long new_nbits) +{ + long new_len = BITS_TO_LONGS(new_nbits) * sizeof(unsigned long); + unsigned long *new = g_realloc(old, new_len); + bitmap_clear(new, old_nbits, new_nbits - old_nbits); + return new; +} + #endif /* BITMAP_H */ -- 1.7.1