From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTrxC-0005HE-Vy for qemu-devel@nongnu.org; Wed, 09 Oct 2013 07:29:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTrx7-0001Gh-0W for qemu-devel@nongnu.org; Wed, 09 Oct 2013 07:29:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTrx6-0001Fy-OZ for qemu-devel@nongnu.org; Wed, 09 Oct 2013 07:29:16 -0400 From: Juan Quintela Date: Wed, 9 Oct 2013 13:28:40 +0200 Message-Id: <1381318130-10620-19-git-send-email-quintela@redhat.com> In-Reply-To: <1381318130-10620-1-git-send-email-quintela@redhat.com> References: <1381318130-10620-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 18/28] bitmap: Add bitmap_zero_extend operation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: chegu_vinod@hp.com Signed-off-by: Juan Quintela --- include/qemu/bitmap.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h index 308bbb7..53f5f1f 100644 --- a/include/qemu/bitmap.h +++ b/include/qemu/bitmap.h @@ -219,4 +219,13 @@ unsigned long bitmap_find_next_zero_area(unsigned long *map, unsigned int nr, unsigned long align_mask); +static inline unsigned long *bitmap_zero_extend(unsigned long *old, + int old_nbits, int new_nbits) +{ + int 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