From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjBI-0004Vk-OG for qemu-devel@nongnu.org; Wed, 17 Aug 2011 12:41:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtjBH-0006jq-QF for qemu-devel@nongnu.org; Wed, 17 Aug 2011 12:41:28 -0400 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:41375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtjBH-0006jc-JE for qemu-devel@nongnu.org; Wed, 17 Aug 2011 12:41:27 -0400 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p7HGfKSQ019187 for ; Wed, 17 Aug 2011 16:41:20 GMT Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7HGfDsm2474124 for ; Wed, 17 Aug 2011 17:41:20 +0100 Received: from d06av04.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7HGfDhw000986 for ; Wed, 17 Aug 2011 10:41:13 -0600 From: Stefan Hajnoczi Date: Wed, 17 Aug 2011 17:41:09 +0100 Message-Id: <1313599269-32257-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] qemu-img: print error codes when convert fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- qemu-img.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index b205e98..d9e6fc8 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -890,7 +890,8 @@ static int img_convert(int argc, char **argv) ret = bdrv_read(bs[bs_i], bs_num, buf2, nlow); if (ret < 0) { - error_report("error while reading"); + error_report("error while reading sector %" PRId64 ": %s", + bs_num, strerror(-ret)); goto out; } @@ -908,8 +909,8 @@ static int img_convert(int argc, char **argv) ret = bdrv_write_compressed(out_bs, sector_num, buf, cluster_sectors); if (ret != 0) { - error_report("error while compressing sector %" PRId64, - sector_num); + error_report("error while compressing sector %" PRId64 + ": %s", sector_num, strerror(-ret)); goto out; } } @@ -972,7 +973,8 @@ static int img_convert(int argc, char **argv) ret = bdrv_read(bs[bs_i], sector_num - bs_offset, buf, n); if (ret < 0) { - error_report("error while reading"); + error_report("error while reading sector %" PRId64 ": %s", + sector_num - bs_offset, strerror(-ret)); goto out; } /* NOTE: at the same time we convert, we do not write zero @@ -991,7 +993,8 @@ static int img_convert(int argc, char **argv) is_allocated_sectors(buf1, n, &n1)) { ret = bdrv_write(out_bs, sector_num, buf1, n1); if (ret < 0) { - error_report("error while writing"); + error_report("error while writing sector %" PRId64 + ": %s", sector_num, strerror(-ret)); goto out; } } -- 1.7.5.4