Received: from eggs.gnu.org ([2001:4830:134:3::10]:56893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7SR5-0003MD-K4 for qemu-devel@nongnu.org; Tue, 23 Jun 2015 13:56:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7SR0-0001qT-KH for qemu-devel@nongnu.org; Tue, 23 Jun 2015 13:56:39 -0400 Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]:33109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7SR0-0001qP-Dp for qemu-devel@nongnu.org; Tue, 23 Jun 2015 13:56:34 -0400 Received: by qkhu186 with SMTP id u186so8956567qkh.0 for ; Tue, 23 Jun 2015 10:56:33 -0700 (PDT) From: Programmingkid Content-Type: multipart/alternative; boundary=Apple-Mail-1--639026246 Date: Tue, 23 Jun 2015 13:56:30 -0400 Message-Id: <3B3C7431-1003-4AAA-90AF-0E1A154DFBE2@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Subject: [Qemu-devel] [PATCH] block.c: fix real cdrom detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel qemu-devel Cc: Peter Maydell , John Snow --Apple-Mail-1--639026246 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Fix real cdrom detection so that a real cdrom can actually be used. signed-off-by: John Arbuckle This patch has been tested on Mac OS X host and guest.=20 Command used: qemu-system-ppc -cdrom /dev/cdrom Note: I was able to view the files using OpenBIOS, but not on=20 Mac OS X. The size of the disc is reported correctly but some error happens that prevents it from mounting in Mac OS X. This is probably another bug with QEMU. --- block.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index dd4f58d..75ccfad 100644 --- a/block.c +++ b/block.c @@ -583,7 +583,8 @@ static int find_image_format(BlockDriverState *bs, = const char *filename, int ret =3D 0; =20 /* Return the raw BlockDriver * to scsi-generic devices or empty = drives */ - if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) =3D=3D 0) = { + if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) =3D=3D 0=20= + || strcmp("/dev/cdrom", filename) =3D=3D 0) { *pdrv =3D &bdrv_raw; return ret; } --=20 1.7.5.4 --Apple-Mail-1--639026246 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Fix = real cdrom detection so that a real cdrom can actually be = used.

signed-off-by: John Arbuckle <programmingkidx@gmail.com>= ;
This patch has been tested on Mac OS X host and = guest. 
Command used: qemu-system-ppc -cdrom = /dev/cdrom

Note: I was able to view the files = using OpenBIOS, but not on 
Mac OS X. The size of the disc is = reported correctly but some
error happens that prevents it from = mounting in Mac OS X. This
is probably another bug with = QEMU.

---
 block.c |    3 = ++-
 1 files changed, 2 insertions(+), 1 = deletions(-)

diff --git a/block.c = b/block.c
index dd4f58d..75ccfad 100644
--- = a/block.c
+++ b/block.c
@@ -583,7 +583,8 @@ static int = find_image_format(BlockDriverState *bs, const char *filename,
 

     /* Return the raw = BlockDriver * to scsi-generic devices or empty drives */
+    if (bs->sg || = !bdrv_is_inserted(bs) || bdrv_getlength(bs) =3D=3D 0 
+ =               || strcmp("/dev/cdrom", = filename) =3D=3D 0) {
         *pdrv =3D = &bdrv_raw;
         return = ret;
     }
-- 

= --Apple-Mail-1--639026246--