From patchwork Tue Dec 17 15:25:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 302304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2AE102C0096 for ; Wed, 18 Dec 2013 04:25:53 +1100 (EST) Received: from localhost ([::1]:33881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vswfs-0005WA-8d for incoming@patchwork.ozlabs.org; Tue, 17 Dec 2013 10:35:08 -0500 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 Received: from trasno.mitica (ovpn-113-86.phx2.redhat.com [10.3.113.86]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rBHFQEww029768; Tue, 17 Dec 2013 10:26:34 -0500 From: Juan Quintela To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 16/38] bitmap: Add bitmap_zero_extend operation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela Reviewed-by: Eric Blake Reviewed-by: Orit Wasserman --- 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 */