All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artur Skawina <art_k@o2.pl>
To: qemu-devel@nongnu.org, Fabrice Bellard <fabrice@bellard.org>
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	[thread overview]
Message-ID: <44D9D7E9.80101@o2.pl> (raw)

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

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



[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 559 bytes --]

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	other threads:[~2006-08-09 12:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44D9D7E9.80101@o2.pl \
    --to=art_k@o2.pl \
    --cc=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.