From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37159 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OW5uI-0004lv-QH for qemu-devel@nongnu.org; Tue, 06 Jul 2010 07:01:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OW5uH-0007td-Hq for qemu-devel@nongnu.org; Tue, 06 Jul 2010 07:01:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42643) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OW5uH-0007tK-9e for qemu-devel@nongnu.org; Tue, 06 Jul 2010 07:01:41 -0400 Message-ID: <4C330D0C.9050900@redhat.com> Date: Tue, 06 Jul 2010 13:01:32 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-img check: Distinguish different kinds of errors References: <1278090900-12832-1-git-send-email-kwolf@redhat.com> <1278090900-12832-2-git-send-email-kwolf@redhat.com> <87vd8shoib.wl%morita.kazutaka@lab.ntt.co.jp> In-Reply-To: <87vd8shoib.wl%morita.kazutaka@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: MORITA Kazutaka Cc: qemu-devel@nongnu.org Am 06.07.2010 12:51, schrieb MORITA Kazutaka: > At Fri, 2 Jul 2010 19:14:59 +0200, > Kevin Wolf wrote: >> >> People think that their images are corrupted when in fact there are just some >> leaked clusters. Differentiating several error cases should make the messages >> more comprehensible. >> >> Signed-off-by: Kevin Wolf >> --- >> block.c | 10 ++++++-- >> block.h | 10 ++++++++- >> qemu-img.c | 62 +++++++++++++++++++++++++++++++++++++++++++++-------------- >> 3 files changed, 63 insertions(+), 19 deletions(-) >> @@ -453,28 +462,51 @@ static int img_check(int argc, char **argv) >> if (!bs) { >> return 1; >> } >> - ret = bdrv_check(bs); >> - switch(ret) { >> - case 0: >> - printf("No errors were found on the image.\n"); >> - break; >> - case -ENOTSUP: >> + ret = bdrv_check(bs, &result); >> + >> + if (ret == -ENOTSUP) { >> error("This image format does not support checks"); >> - break; >> - default: >> - if (ret < 0) { >> - error("An error occurred during the check"); >> - } else { >> - printf("%d errors were found on the image.\n", ret); >> + return 1; > > Is it okay to call bdrv_delete(bs) before return? It is necessary for > the sheepdog driver to pass qemu-iotests. > > Kazutaka Yes, you're right. Thanks for catching this, I'll send a new version. Kevin