mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-22 07:28:36 -07:00
block: Add qdev ID to DEVICE_TRAY_MOVED
The event currently only contains the BlockBackend name. However, with anonymous BlockBackends, this is always the empty string. Add the qdev ID (or if none was given, the QOM path) so that the user can still see which device caused the event. Event generation has to be moved from bdrv_eject() to the BlockBackend because the BDS doesn't know the attached device, but that's easy because blk_eject() is the only user of it. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
bbc8ea98bc
commit
2d76e724cf
5 changed files with 46 additions and 11 deletions
7
block.c
7
block.c
|
|
@ -3360,17 +3360,10 @@ int bdrv_media_changed(BlockDriverState *bs)
|
|||
void bdrv_eject(BlockDriverState *bs, bool eject_flag)
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
const char *device_name;
|
||||
|
||||
if (drv && drv->bdrv_eject) {
|
||||
drv->bdrv_eject(bs, eject_flag);
|
||||
}
|
||||
|
||||
device_name = bdrv_get_device_name(bs);
|
||||
if (device_name[0] != '\0') {
|
||||
qapi_event_send_device_tray_moved(device_name,
|
||||
eject_flag, &error_abort);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue