diff options
author | Markus Armbruster <armbru@redhat.com> | 2011-08-03 15:08:08 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-09-06 11:24:06 +0200 |
commit | 8e49ca46249481588c881918d5bd023e16209095 (patch) | |
tree | 9ef20fa1c3d64ab755ef4cd2fcb78e39c549ec2f /block.c | |
parent | be32f75f4dfb4e7dead9fb9cfb8a7195b1e25ebf (diff) | |
download | qemu-8e49ca46249481588c881918d5bd023e16209095.zip qemu-8e49ca46249481588c881918d5bd023e16209095.tar.gz qemu-8e49ca46249481588c881918d5bd023e16209095.tar.bz2 |
block: Leave tracking media change to device models
hw/fdc.c is the only one that cares.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 20 |
1 files changed, 6 insertions, 14 deletions
@@ -689,7 +689,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, } if (!bdrv_key_required(bs)) { - bs->media_changed = 1; bdrv_dev_change_media_cb(bs); } @@ -726,7 +725,6 @@ void bdrv_close(BlockDriverState *bs) bdrv_close(bs->file); } - bs->media_changed = 1; bdrv_dev_change_media_cb(bs); } } @@ -1665,7 +1663,6 @@ int bdrv_set_key(BlockDriverState *bs, const char *key) } else if (!bs->valid_key) { bs->valid_key = 1; /* call the change callback now, we skipped it on open */ - bs->media_changed = 1; bdrv_dev_change_media_cb(bs); } return ret; @@ -3040,22 +3037,17 @@ int bdrv_is_inserted(BlockDriverState *bs) } /** - * Return TRUE if the media changed since the last call to this - * function. It is currently only used for floppy disks + * Return whether the media changed since the last call to this + * function, or -ENOTSUP if we don't know. Most drivers don't know. */ int bdrv_media_changed(BlockDriverState *bs) { BlockDriver *drv = bs->drv; - int ret; - if (!drv || !drv->bdrv_media_changed) - ret = -ENOTSUP; - else - ret = drv->bdrv_media_changed(bs); - if (ret == -ENOTSUP) - ret = bs->media_changed; - bs->media_changed = 0; - return ret; + if (drv && drv->bdrv_media_changed) { + return drv->bdrv_media_changed(bs); + } + return -ENOTSUP; } /** |