/* We automatically delete the drive when a device using it gets unplugged. Questionable feature, but we can't just drop it. Device models call blockdev_mark_auto_del() to schedule the automatic deletion, and generic qdev code calls blockdev_auto_del() when deletion is actually safe.  */
void blockdev_mark_auto_del(BlockDriverState *bs)
/* We automatically delete the drive when a device using it gets unplugged. Questionable feature, but we can't just drop it. Device models call blockdev_mark_auto_del() to schedule the automatic deletion, and generic qdev code calls blockdev_auto_del() when deletion is actually safe.  */
void blockdev_mark_auto_del(BlockDriverState *bs)
{
    DriveInfo *dinfo = drive_get_by_blockdev(bs);
    if (dinfo && !dinfo->enable_auto_del) {
        return;
    }
    if (bs->job) {
        block_job_cancel(bs->job);
    }
    if (dinfo) {
        dinfo->auto_del = 1;
    }
}