From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47550 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJV4A-00084Z-Iw for qemu-devel@nongnu.org; Tue, 01 Jun 2010 13:16:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJV3y-0005Qn-VD for qemu-devel@nongnu.org; Tue, 01 Jun 2010 13:15:42 -0400 Received: from smtp126.sbc.mail.sp1.yahoo.com ([69.147.65.185]:25306) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OJV3y-0005QO-Kf for qemu-devel@nongnu.org; Tue, 01 Jun 2010 13:15:38 -0400 Subject: Re: [Qemu-devel] [PATCH] block: Assume raw for drives without media From: "Nicholas A. Bellinger" In-Reply-To: <1275411000-27324-1-git-send-email-kwolf@redhat.com> References: <1275411000-27324-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain Date: Tue, 01 Jun 2010 10:15:33 -0700 Message-Id: <1275412533.16953.0.camel@haakon2.linux-iscsi.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Tue, 2010-06-01 at 18:50 +0200, Kevin Wolf wrote: > 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 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"); > } Makes sense to me. Acked-by: Nicholas A. Bellinger