aboutsummaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2011-08-03 15:07:42 +0200
committerKevin Wolf <kwolf@redhat.com>2011-09-06 11:23:51 +0200
commit145feb176ffe6de1db6d05af064c841d7c16633c (patch)
treef69598e83c5a2b36fcecd043e7a234dcbeb77a2e /hw
parent0e49de5232f47c9e58adb82c28d4f42be933d891 (diff)
block: Split change_cb() into change_media_cb(), resize_cb()
Multiplexing callbacks complicates matters needlessly. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ide/core.c8
-rw-r--r--hw/sd.c8
-rw-r--r--hw/virtio-blk.c8
3 files changed, 7 insertions, 17 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 26a9c5ba1..47a706e4c 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -783,15 +783,11 @@ static void ide_cfata_metadata_write(IDEState *s)
}
/* called when the inserted state of the media has changed */
-static void cdrom_change_cb(void *opaque, int reason)
+static void ide_cd_change_cb(void *opaque)
{
IDEState *s = opaque;
uint64_t nb_sectors;
- if (!(reason & CHANGE_MEDIA)) {
- return;
- }
-
bdrv_get_geometry(s->bs, &nb_sectors);
s->nb_sectors = nb_sectors;
@@ -1743,7 +1739,7 @@ void ide_bus_reset(IDEBus *bus)
}
static const BlockDevOps ide_cd_block_ops = {
- .change_cb = cdrom_change_cb,
+ .change_media_cb = ide_cd_change_cb,
};
int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
diff --git a/hw/sd.c b/hw/sd.c
index 1f00910ef..45e95f9e0 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -420,14 +420,10 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
sd->pwd_len = 0;
}
-static void sd_cardchange(void *opaque, int reason)
+static void sd_cardchange(void *opaque)
{
SDState *sd = opaque;
- if (!(reason & CHANGE_MEDIA)) {
- return;
- }
-
qemu_set_irq(sd->inserted_cb, bdrv_is_inserted(sd->bdrv));
if (bdrv_is_inserted(sd->bdrv)) {
sd_reset(sd, sd->bdrv);
@@ -436,7 +432,7 @@ static void sd_cardchange(void *opaque, int reason)
}
static const BlockDevOps sd_block_ops = {
- .change_cb = sd_cardchange,
+ .change_media_cb = sd_cardchange,
};
/* We do not model the chip select pin, so allow the board to select
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index c10afa996..4df23f422 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -543,17 +543,15 @@ static int virtio_blk_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-static void virtio_blk_change_cb(void *opaque, int reason)
+static void virtio_blk_resize(void *opaque)
{
VirtIOBlock *s = opaque;
- if (reason & CHANGE_SIZE) {
- virtio_notify_config(&s->vdev);
- }
+ virtio_notify_config(&s->vdev);
}
static const BlockDevOps virtio_block_ops = {
- .change_cb = virtio_blk_change_cb,
+ .resize_cb = virtio_blk_resize,
};
VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf,