Am 03.08.2011 15:08, schrieb Markus Armbruster: > To let device models distinguish between eject and load. > > Signed-off-by: Markus Armbruster <arm...@redhat.com> > --- > block.c | 12 ++++++------ > block.h | 3 ++- > hw/fdc.c | 2 +- > hw/ide/core.c | 2 +- > hw/scsi-disk.c | 2 +- > hw/sd.c | 2 +- > 6 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/block.c b/block.c > index b0e54ef..1bd67dd 100644 > --- a/block.c > +++ b/block.c > @@ -44,7 +44,7 @@ > #include <windows.h> > #endif > > -static void bdrv_dev_change_media_cb(BlockDriverState *bs); > +static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load); > static BlockDriverAIOCB *bdrv_aio_readv_em(BlockDriverState *bs, > int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, > BlockDriverCompletionFunc *cb, void *opaque); > @@ -661,7 +661,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, > int flags, > } > > if (!bdrv_key_required(bs)) { > - bdrv_dev_change_media_cb(bs); > + bdrv_dev_change_media_cb(bs, true); > } > > return 0; > @@ -697,7 +697,7 @@ void bdrv_close(BlockDriverState *bs) > bdrv_close(bs->file); > } > > - bdrv_dev_change_media_cb(bs); > + bdrv_dev_change_media_cb(bs, false); > } > } > > @@ -780,10 +780,10 @@ void bdrv_set_dev_ops(BlockDriverState *bs, const > BlockDevOps *ops, > } > } > > -static void bdrv_dev_change_media_cb(BlockDriverState *bs) > +static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load) > { > if (bs->dev_ops && bs->dev_ops->change_media_cb) { > - bs->dev_ops->change_media_cb(bs->dev_opaque); > + bs->dev_ops->change_media_cb(bs->dev_opaque, load); > } > } > > @@ -1634,7 +1634,7 @@ 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 */ > - bdrv_dev_change_media_cb(bs); > + bdrv_dev_change_media_cb(bs, 1);
s/1/true/ Kevin