From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy3Ay-0007v0-Jr for qemu-devel@nongnu.org; Mon, 29 Aug 2011 10:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qy3Ar-0000XQ-VC for qemu-devel@nongnu.org; Mon, 29 Aug 2011 10:50:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy3Ar-0000XH-Ix for qemu-devel@nongnu.org; Mon, 29 Aug 2011 10:50:53 -0400 From: Kevin Wolf Date: Mon, 29 Aug 2011 16:53:16 +0200 Message-Id: <1314629618-8308-9-git-send-email-kwolf@redhat.com> In-Reply-To: <1314629618-8308-1-git-send-email-kwolf@redhat.com> References: <1314629618-8308-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 08/30] qemu-img: print error codes when convert fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- qemu-img.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 2fee782..0561d77 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -870,7 +870,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; } @@ -888,8 +889,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; } } @@ -952,7 +953,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 @@ -971,7 +973,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.6