yeahuh / rpms / qemu-kvm

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