From: Anthony Liguori <aliguori@cs.utexas.edu>
To: qemu-devel@nongnu.org, Fabrice Bellard <fabrice@bellard.org>
Subject: [Qemu-devel] [PATCH] Fix CDROM change
Date: Sun, 17 Dec 2006 16:55:46 -0600 [thread overview]
Message-ID: <4585CAF2.9030502@cs.utexas.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 624 bytes --]
Fabrice's 'better support of removable media" removed the
cdrom_change_cb() from ide.c mentioning that it wasn't needed anymore.
I don't see anywhere else in the IDE code that triggers an update of
nb_sectors though so I think it's still needed. Currently, if you do:
change cdrom /path/to/cdrom1.iso
eject cdrom
change cdrom /path/to/cdrom2.iso
Everything works up to the second change. The guest never sees the new
cdrom. The follow patch adds back the cdrom_change_cb() and now things
work like they used to. If there's a better way to do this, I'll be
happy to submit a new patch.
Regards,
Anthony Liguori
[-- Attachment #2: qemu-cdrom-change.diff --]
[-- Type: text/x-patch, Size: 899 bytes --]
diff -r 1e346ef889b3 hw/ide.c
--- a/hw/ide.c Sun Dec 17 10:38:27 2006 -0600
+++ b/hw/ide.c Sun Dec 17 16:49:06 2006 -0600
@@ -1479,6 +1479,17 @@ static void ide_atapi_cmd(IDEState *s)
ASC_ILLEGAL_OPCODE);
break;
}
+}
+
+/* called when the inserted state of the media has changed */
+static void cdrom_change_cb(void *opaque)
+{
+ IDEState *s = opaque;
+ int64_t nb_sectors;
+
+ /* XXX: send interrupt too */
+ bdrv_get_geometry(s->bs, &nb_sectors);
+ s->nb_sectors = nb_sectors;
}
static void ide_cmd_lba48_transform(IDEState *s, int lba48)
@@ -2111,6 +2122,7 @@ static void ide_init2(IDEState *ide_stat
}
if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
s->is_cdrom = 1;
+ bdrv_set_change_cb(s->bs, cdrom_change_cb, s);
}
}
s->drive_serial = drive_serial++;
reply other threads:[~2006-12-17 22:56 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=4585CAF2.9030502@cs.utexas.edu \
--to=aliguori@cs.utexas.edu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).