block: Leave enforcing tray lock to device models

The device model knows best when to accept the guest's eject command.
No need to detour through the block layer.

bdrv_eject() can't fail anymore.  Make it void.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster 2011-09-06 18:58:45 +02:00 committed by Kevin Wolf
parent 81b1008d50
commit fdec4404dd
4 changed files with 14 additions and 27 deletions

View file

@ -3051,18 +3051,13 @@ int bdrv_media_changed(BlockDriverState *bs)
/**
* If eject_flag is TRUE, eject the media. Otherwise, close the tray
*/
int bdrv_eject(BlockDriverState *bs, int eject_flag)
void bdrv_eject(BlockDriverState *bs, int eject_flag)
{
BlockDriver *drv = bs->drv;
if (eject_flag && bs->locked) {
return -EBUSY;
}
if (drv && drv->bdrv_eject) {
drv->bdrv_eject(bs, eject_flag);
}
return 0;
}
int bdrv_is_locked(BlockDriverState *bs)