void blk_dev_change_media_cb(BlockBackend *blk, bool load)

{

    if (blk->dev_ops && blk->dev_ops->change_media_cb) {

        bool tray_was_closed = !blk_dev_is_tray_open(blk);



        blk->dev_ops->change_media_cb(blk->dev_opaque, load);

        if (tray_was_closed) {

            /* tray open */

            qapi_event_send_device_tray_moved(blk_name(blk),

                                              true, &error_abort);

        }

        if (load) {

            /* tray close */

            qapi_event_send_device_tray_moved(blk_name(blk),

                                              false, &error_abort);

        }

    }

}

void blk_dev_change_media_cb(BlockBackend *blk, bool load)

{

    if (blk->dev_ops && blk->dev_ops->change_media_cb) {

        bool tray_was_closed = !blk_dev_is_tray_open(blk);



        blk->dev_ops->change_media_cb(blk->dev_opaque, load);

        if (tray_was_closed) {

            

            qapi_event_send_device_tray_moved(blk_name(blk),

                                              true, &error_abort);

        }

        if (load) {

            

            qapi_event_send_device_tray_moved(blk_name(blk),

                                              false, &error_abort);

        }

    }

}

void FUNC_0(BlockBackend *VAR_0, bool VAR_1)

{

    if (VAR_0->dev_ops && VAR_0->dev_ops->change_media_cb) {

        bool tray_was_closed = !blk_dev_is_tray_open(VAR_0);



        VAR_0->dev_ops->change_media_cb(VAR_0->dev_opaque, VAR_1);

        if (tray_was_closed) {

            

            qapi_event_send_device_tray_moved(blk_name(VAR_0),

                                              true, &error_abort);

        }

        if (VAR_1) {

            

            qapi_event_send_device_tray_moved(blk_name(VAR_0),

                                              false, &error_abort);

        }

    }

}

void FUNC_0(BlockBackend *VAR_0, bool VAR_1)
{ if (VAR_0->dev_ops && VAR_0->dev_ops->change_media_cb) { bool tray_was_closed = !blk_dev_is_tray_open(VAR_0); VAR_0->dev_ops->change_media_cb(VAR_0->dev_opaque, VAR_1); if (tray_was_closed) { qapi_event_send_device_tray_moved(blk_name(VAR_0),
true, &error_abort); } if (VAR_1) { qapi_event_send_device_tray_moved(blk_name(VAR_0),
false, &error_abort); } } }