From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W016J-0001jQ-2T for qemu-devel@nongnu.org; Sun, 05 Jan 2014 22:43:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0169-0001F6-RY for qemu-devel@nongnu.org; Sun, 05 Jan 2014 22:43:38 -0500 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:52922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0169-0001Dy-7K for qemu-devel@nongnu.org; Sun, 05 Jan 2014 22:43:29 -0500 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Jan 2014 09:13:27 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id C5B10E0053 for ; Mon, 6 Jan 2014 09:16:10 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s063hLpp52166722 for ; Mon, 6 Jan 2014 09:13:21 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s063hPiu022753 for ; Mon, 6 Jan 2014 09:13:26 +0530 From: Wenchao Xia Date: Mon, 6 Jan 2014 03:43:07 +0800 Message-Id: <1388950991-30105-5-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1388950991-30105-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1388950991-30105-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V9 4/8] qcow2: return int for qcow2_free_clusters() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.crosthwaite@xilinx.com, jcody@redhat.com, mreitz@redhat.com, stefanha@redhat.com, Wenchao Xia The return value can help caller check whether error happens, and it does not need to have *errp since the return value already tips what happend. Signed-off-by: Wenchao Xia --- block/qcow2-refcount.c | 8 +++++--- block/qcow2.h | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index c974abe..4eb413a 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -761,9 +761,9 @@ int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size) return offset; } -void qcow2_free_clusters(BlockDriverState *bs, - int64_t offset, int64_t size, - enum qcow2_discard_type type) +int qcow2_free_clusters(BlockDriverState *bs, + int64_t offset, int64_t size, + enum qcow2_discard_type type) { int ret; @@ -773,6 +773,8 @@ void qcow2_free_clusters(BlockDriverState *bs, fprintf(stderr, "qcow2_free_clusters failed: %s\n", strerror(-ret)); /* TODO Remember the clusters to free them later and avoid leaking */ } + + return ret; } /* diff --git a/block/qcow2.h b/block/qcow2.h index c56a5b6..161549a 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -435,9 +435,9 @@ int64_t qcow2_alloc_clusters(BlockDriverState *bs, int64_t size); int qcow2_alloc_clusters_at(BlockDriverState *bs, uint64_t offset, int nb_clusters); int64_t qcow2_alloc_bytes(BlockDriverState *bs, int size); -void qcow2_free_clusters(BlockDriverState *bs, - int64_t offset, int64_t size, - enum qcow2_discard_type type); +int qcow2_free_clusters(BlockDriverState *bs, + int64_t offset, int64_t size, + enum qcow2_discard_type type); void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type type); -- 1.7.1