DriveInfo *dinfo = blk_legacy_dinfo(blk);
if (dinfo && dinfo->auto_del) {
- drive_del(dinfo);
+ blk_unref(blk);
}
}
error_printf(" %s", name);
}
-void drive_del(DriveInfo *dinfo)
-{
- blk_unref(dinfo->bdrv->blk);
-}
-
typedef struct {
QEMUBH *bh;
BlockDriverState *bs;
bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT);
} else {
- drive_del(dinfo);
+ blk_unref(blk);
}
aio_context_release(aio_context);
#include "hw/hw.h"
#include "hw/boards.h"
+#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "qemu/config-file.h"
#include "sysemu/sysemu.h"
err:
if (dinfo) {
- drive_del(dinfo);
+ blk_unref(blk_by_legacy_dinfo(dinfo));
}
}
#include <hw/i386/pc.h>
#include <hw/pci/pci.h>
#include <hw/isa/isa.h>
+#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "sysemu/sysemu.h"
#include "sysemu/dma.h"
for (; i < 3; i++) {
di = drive_get_by_index(IF_IDE, i);
if (di != NULL && !di->media_cd) {
+ BlockBackend *blk = blk_by_legacy_dinfo(di);
DeviceState *ds = bdrv_get_attached_dev(di->bdrv);
if (ds) {
bdrv_detach_dev(di->bdrv, ds);
}
pci_ide->bus[di->bus].ifs[di->unit].bs = NULL;
- drive_del(di);
+ blk_unref(blk);
}
}
qdev_reset_all(DEVICE(dev));
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
const char *optstr);
DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
-void drive_del(DriveInfo *dinfo);
/* device-hotplug */