From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD6jJ-0001p3-TN for qemu-devel@nongnu.org; Tue, 11 Feb 2014 01:22:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WD6j6-0005Cc-Jv for qemu-devel@nongnu.org; Tue, 11 Feb 2014 01:22:01 -0500 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:46890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WD6j5-0005CH-Vz for qemu-devel@nongnu.org; Tue, 11 Feb 2014 01:21:48 -0500 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Feb 2014 11:51:46 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id C62D21258059 for ; Tue, 11 Feb 2014 11:53:38 +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 s1B6LehD46071968 for ; Tue, 11 Feb 2014 11:51:40 +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 s1B6LiqC025637 for ; Tue, 11 Feb 2014 11:51:44 +0530 From: Wenchao Xia Date: Tue, 11 Feb 2014 14:23:04 -0500 Message-Id: <1392146588-12120-5-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1392146588-12120-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1392146588-12120-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V11 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 Reviewed-by: Max Reitz --- 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 f8390ed..a66ac9b 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