On 7 January 2016 at 21:03, Max Reitz <[email protected]> wrote: > Right now, the change_media_cb (sd_cardchange()) completely ignores its > @load parameter. This means that issuing a blockdev-open-tray command > will actually not have any effect. > > Fix this by keeping track of the medium insertion status in the SDState > and updating it in sd_init() and sd_cardchange(). > > Cc: qemu-stable <[email protected]> > Signed-off-by: Max Reitz <[email protected]> > --- > hw/sd/sd.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index 1a9935c..0751ba2 100644 > --- a/hw/sd/sd.c > +++ b/hw/sd/sd.c > @@ -114,6 +114,7 @@ struct SDState { > uint8_t *buf; > > bool enable; > + bool medium_inserted;
When would this be different from blk_is_inserted(sd->blk) ? I don't see why we need a separate flag here rather than querying the block layer. If we do need a flag, why doesn't it need to be migrated? thanks -- PMM
