mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
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:
parent
81b1008d50
commit
fdec4404dd
4 changed files with 14 additions and 27 deletions
7
block.c
7
block.c
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue