qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] qemu -cdrom /dev/cdrom opens the cdrom for RW and fails w/


From: Artur Skawina
Subject: [Qemu-devel] qemu -cdrom /dev/cdrom opens the cdrom for RW and fails w/ RO devices (linux)
Date: Wed, 09 Aug 2006 14:41:13 +0200
User-agent: Thunderbird 3.0a1 (X11/20060808)

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


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;
     }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]