From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNibr-0007jD-2h for qemu-devel@nongnu.org; Tue, 17 Feb 2015 08:54:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNibo-0002BI-CJ for qemu-devel@nongnu.org; Tue, 17 Feb 2015 08:54:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNibo-0002Ak-5P for qemu-devel@nongnu.org; Tue, 17 Feb 2015 08:54:40 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1HDsdXg001216 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 08:54:39 -0500 Message-ID: <54E3481E.50709@redhat.com> Date: Tue, 17 Feb 2015 08:54:38 -0500 From: Max Reitz MIME-Version: 1.0 References: <1423600146-7642-1-git-send-email-mreitz@redhat.com> <1423600146-7642-10-git-send-email-mreitz@redhat.com> <20150217133812.GG4213@noname.str.redhat.com> In-Reply-To: <20150217133812.GG4213@noname.str.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Kevin Wolf Cc: qemu-devel@nongnu.org, Stefan Hajnoczi On 2015-02-17 at 08:38, Kevin Wolf wrote: > 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? Of course we can. I just personally found it cleaner this way (qcow2_refcount_init() being the first function implementation in qcow2-refcount.c). I'm fine either way. Max