block: tell drivers about an image resize

Extend the change_cb callback with a reason argument, and use it
to tell drivers about size changes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Christoph Hellwig 2011-01-24 13:32:41 +01:00 committed by Kevin Wolf
parent 6d4a2b3a47
commit db97ee6a97
5 changed files with 25 additions and 8 deletions

View file

@ -1584,11 +1584,15 @@ 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)
static void cdrom_change_cb(void *opaque, int reason)
{
IDEState *s = opaque;
uint64_t nb_sectors;
if (!(reason & CHANGE_MEDIA)) {
return;
}
bdrv_get_geometry(s->bs, &nb_sectors);
s->nb_sectors = nb_sectors;