From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VswXi-00025u-OC for qemu-devel@nongnu.org; Tue, 17 Dec 2013 10:26:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VswXc-0000nR-Bu for qemu-devel@nongnu.org; Tue, 17 Dec 2013 10:26:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VswXc-0000mz-4K for qemu-devel@nongnu.org; Tue, 17 Dec 2013 10:26:36 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBHFQZD7021870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Dec 2013 10:26:35 -0500 From: Juan Quintela Date: Tue, 17 Dec 2013 16:25:52 +0100 Message-Id: <1387293974-24718-17-git-send-email-quintela@redhat.com> In-Reply-To: <1387293974-24718-1-git-send-email-quintela@redhat.com> References: <1387293974-24718-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 16/38] bitmap: Add bitmap_zero_extend operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Juan Quintela Reviewed-by: Eric Blake --- include/qemu/bitmap.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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.8.3.1