From patchwork Fri Mar 12 12:52:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 47671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1D987B7D00 for ; Sat, 13 Mar 2010 00:01:11 +1100 (EST) Received: from localhost ([127.0.0.1]:38912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nq4Nq-0001HB-AX for incoming@patchwork.ozlabs.org; Fri, 12 Mar 2010 07:54:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nq4Me-0001G9-HF for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:16 -0500 Received: from [199.232.76.173] (port=41505 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nq4Me-0001Ft-8R for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:16 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nq4Md-0003lt-6H for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22937) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nq4Mc-0003li-QD for qemu-devel@nongnu.org; Fri, 12 Mar 2010 07:53:15 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2CCrCBX023553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 12 Mar 2010 07:53:12 -0500 Received: from localhost.localdomain (vpn1-5-211.ams2.redhat.com [10.36.5.211]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2CCrAPp031683 for ; Fri, 12 Mar 2010 07:53:11 -0500 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Fri, 12 Mar 2010 13:52:31 +0100 Message-Id: <1268398351-8113-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH] raw-posix: Better error return values for hdev_create X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that we output an error message according to the returned error code in qemu-img, let's return the real error codes. "Input/output error" for everything isn't helpful. Signed-off-by: Kevin Wolf Reviewed-by: Christoph Hellwig --- block/raw-posix.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 716c15c..f07d730 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1009,12 +1009,12 @@ static int hdev_create(const char *filename, QEMUOptionParameter *options) fd = open(filename, O_WRONLY | O_BINARY); if (fd < 0) - return -EIO; + return -errno; if (fstat(fd, &stat_buf) < 0) - ret = -EIO; + ret = -errno; else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode)) - ret = -EIO; + ret = -ENODEV; else if (lseek(fd, 0, SEEK_END) < total_size * 512) ret = -ENOSPC;