From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNiLx-0000UV-R3 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 08:38:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNiLw-0003ed-P0 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 08:38:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNiLw-0003eT-In for qemu-devel@nongnu.org; Tue, 17 Feb 2015 08:38:16 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1HDcEnc025431 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 08:38:15 -0500 Date: Tue, 17 Feb 2015 14:38:12 +0100 From: Kevin Wolf Message-ID: <20150217133812.GG4213@noname.str.redhat.com> References: <1423600146-7642-1-git-send-email-mreitz@redhat.com> <1423600146-7642-10-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423600146-7642-10-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 09/24] qcow2: More helpers for refcount modification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Am 10.02.2015 um 21:28 hat Max Reitz geschrieben: > Add helper functions for getting and setting refcounts in a refcount > array for any possible refcount order, and choose the correct one during > refcount initialization. > > Signed-off-by: Max Reitz > Reviewed-by: Eric Blake > Reviewed-by: Stefan Hajnoczi > --- > block/qcow2-refcount.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 119 insertions(+), 2 deletions(-) > > diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c > index b9034ae..c9f9f4f 100644 > --- a/block/qcow2-refcount.c > +++ b/block/qcow2-refcount.c > @@ -32,10 +32,49 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs, > int64_t offset, int64_t length, uint64_t addend, > bool decrease, enum qcow2_discard_type type); > > +static uint64_t get_refcount_ro0(const void *refcount_array, uint64_t index); > +static uint64_t get_refcount_ro1(const void *refcount_array, uint64_t index); > +static uint64_t get_refcount_ro2(const void *refcount_array, uint64_t index); > +static uint64_t get_refcount_ro3(const void *refcount_array, uint64_t index); > static uint64_t get_refcount_ro4(const void *refcount_array, uint64_t index); > +static uint64_t get_refcount_ro5(const void *refcount_array, uint64_t index); > +static uint64_t get_refcount_ro6(const void *refcount_array, uint64_t index); > > +static void set_refcount_ro0(void *refcount_array, uint64_t index, > + uint64_t value); > +static void set_refcount_ro1(void *refcount_array, uint64_t index, > + uint64_t value); > +static void set_refcount_ro2(void *refcount_array, uint64_t index, > + uint64_t value); > +static void set_refcount_ro3(void *refcount_array, uint64_t index, > + uint64_t value); > static void set_refcount_ro4(void *refcount_array, uint64_t index, > uint64_t value); > +static void set_refcount_ro5(void *refcount_array, uint64_t index, > + uint64_t value); > +static void set_refcount_ro6(void *refcount_array, uint64_t index, > + uint64_t value); Hm, lots of forward declarations. Can't we put the implementation here? Kevin