From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GAnNA-0000np-73 for qemu-devel@nongnu.org; Wed, 09 Aug 2006 08:41:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GAnN8-0000nE-Kn for qemu-devel@nongnu.org; Wed, 09 Aug 2006 08:41:19 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAnN8-0000n3-BV for qemu-devel@nongnu.org; Wed, 09 Aug 2006 08:41:18 -0400 Received: from [83.24.9.5] (helo=dkf5.neoplus.adsl.tpnet.pl) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GAnRo-0000E2-BM for qemu-devel@nongnu.org; Wed, 09 Aug 2006 08:46:08 -0400 Message-ID: <44D9D7E9.80101@o2.pl> Date: Wed, 09 Aug 2006 14:41:13 +0200 From: Artur Skawina MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000602030902050908070308" Subject: [Qemu-devel] qemu -cdrom /dev/cdrom opens the cdrom for RW and fails w/ RO devices (linux) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Fabrice Bellard This is a multi-part message in MIME format. --------------000602030902050908070308 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit recently (probably since the AIO code went in) qemu opens the cdrom device like this: > open("/dev/cdrom", O_RDWR|O_LARGEFILE) = -1 EROFS (Read-only file system) which obviously fails and qemu quits w/ an error message about being unable to access the cdrom. Patch below makes a RO -cdrom device work (but doesn't necessarily address the real bug - should qemu really be opening cdrom devices for rw?) artur --------------000602030902050908070308 Content-Type: text/plain; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" diff -urNp qemu.org/block.c qemu/block.c --- qemu.org/block.c 2006-08-07 21:36:12.000000000 +0000 +++ qemu/block.c 2006-08-08 13:05:01.000000000 +0000 @@ -332,7 +332,7 @@ int bdrv_open2(BlockDriverState *bs, con else open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); ret = drv->bdrv_open(bs, filename, open_flags); - if (ret == -EACCES && !(flags & BDRV_O_FILE)) { + if ((ret == -EACCES || ret == -EROFS) && !(flags & BDRV_O_FILE)) { ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY); bs->read_only = 1; } --------------000602030902050908070308--