diff options
author | Markus Armbruster <armbru@redhat.com> | 2011-09-06 18:58:59 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-09-12 15:17:22 +0200 |
commit | 7d4b4ba5c2bae99d44f265884b567ae63947bb4a (patch) | |
tree | 656e821d5db201a05fd20e4fd69069e0e79a850f /block.c | |
parent | ab359cd17e77163b672c5fc129cf4bcd0a3b38ce (diff) |
block: New change_media_cb() parameter load
To let device models distinguish between eject and load.
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 | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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); @@ -688,7 +688,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; @@ -724,7 +724,7 @@ void bdrv_close(BlockDriverState *bs) bdrv_close(bs->file); } - bdrv_dev_change_media_cb(bs); + bdrv_dev_change_media_cb(bs, false); } } @@ -807,10 +807,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); } } @@ -1674,7 +1674,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, true); } return ret; } |