Received: from [140.186.70.92] (port=52825 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OKapm-0005ZF-K4 for qemu-devel@nongnu.org; Fri, 04 Jun 2010 13:37:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OKapd-0002lI-Jr for qemu-devel@nongnu.org; Fri, 04 Jun 2010 13:37:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55836) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OKapd-0002l0-AS for qemu-devel@nongnu.org; Fri, 04 Jun 2010 13:37:21 -0400 From: Kevin Wolf Date: Fri, 4 Jun 2010 18:33:09 +0200 Message-Id: <1275669195-28312-22-git-send-email-kwolf@redhat.com> In-Reply-To: <1275669195-28312-1-git-send-email-kwolf@redhat.com> References: <1275669195-28312-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 21/27] block: Assume raw for drives without media List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@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 --- block.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 9c43332..ecd9867 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"); } -- 1.6.6.1