From ff40b201543aff558f2bf681da3093bce82c6eba Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 14 Jan 2014 15:07:28 +0100
Subject: [PATCH 17/40] bitmap: Add bitmap_zero_extend operation
RH-Author: Juan Quintela <quintela@redhat.com>
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 <pbonzini@redhat.com>
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
(cherry picked from commit 164590a60fd685399da259ac41b338d9a0b9d6c0)
Signed-off-by: Juan Quintela <quintela@trasno.org>
---
include/qemu/bitmap.h | 9 +++++++++
1 file changed, 9 insertions(+)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
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