From patchwork Tue Jun 1 16:50:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 54266 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 25B32B7D1F for ; Wed, 2 Jun 2010 02:56:47 +1000 (EST) Received: from localhost ([127.0.0.1]:54502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJUlg-0004kL-BA for incoming@patchwork.ozlabs.org; Tue, 01 Jun 2010 12:56:44 -0400 Received: from [140.186.70.92] (port=46718 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJUkM-0004Ao-GG for qemu-devel@nongnu.org; Tue, 01 Jun 2010 12:55:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJUkK-0000cp-Rw for qemu-devel@nongnu.org; Tue, 01 Jun 2010 12:55:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42619) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJUkK-0000cj-LA for qemu-devel@nongnu.org; Tue, 01 Jun 2010 12:55:20 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o51GtHqd004523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 1 Jun 2010 12:55:19 -0400 Received: from localhost.localdomain (dhcp-5-217.str.redhat.com [10.32.5.217]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o51GoFQP002068; Tue, 1 Jun 2010 12:50:15 -0400 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Tue, 1 Jun 2010 18:50:00 +0200 Message-Id: <1275411000-27324-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH] block: Assume raw for drives without media 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 qemu -cdrom /dev/cdrom with an empty CD-ROM drive doesn't work any more because we try to guess the format and when this fails (because there is no medium) we exit with an error message. This patch should restore the old behaviour by assuming raw format for such drives. Signed-off-by: Kevin Wolf Acked-by: Nicholas A. Bellinger --- block.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index d789d02..7dded4e 100644 --- a/block.c +++ b/block.c @@ -331,8 +331,8 @@ static BlockDriver *find_image_format(const char *filename) if (ret < 0) return NULL; - /* Return the raw BlockDriver * to scsi-generic devices */ - if (bs->sg) { + /* Return the raw BlockDriver * to scsi-generic devices or empty drives */ + if (bs->sg || !bdrv_is_inserted(bs)) { bdrv_delete(bs); return bdrv_find_format("raw"); }