aboutsummaryrefslogtreecommitdiff
path: root/hw/ide.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-22 02:14:49 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-22 02:14:49 +0000
commitbd491d6a4ecc57144ffa55c0daf97b43bc1648ce (patch)
tree4cfc22e77e167d6db9ac49e3a8c82b83e03612c2 /hw/ide.c
parent71e3ceb800ec212acd78f613245bbb82278348d0 (diff)
downloadqemu-bd491d6a4ecc57144ffa55c0daf97b43bc1648ce.zip
qemu-bd491d6a4ecc57144ffa55c0daf97b43bc1648ce.tar.gz
qemu-bd491d6a4ecc57144ffa55c0daf97b43bc1648ce.tar.bz2
Fix CDROM change, by Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2262 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ide.c')
-rw-r--r--hw/ide.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/ide.c b/hw/ide.c
index 6741cac..68ad718 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -1481,6 +1481,17 @@ static void ide_atapi_cmd(IDEState *s)
}
}
+/* 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)
{
s->lba48 = lba48;
@@ -2111,6 +2122,7 @@ static void ide_init2(IDEState *ide_state,
}
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++;