error_printf(" %s", name);
}
-static void drive_uninit(DriveInfo *dinfo)
+static void drive_del(DriveInfo *dinfo)
{
if (dinfo->opts) {
qemu_opts_del(dinfo->opts);
{
assert(dinfo->refcount);
if (--dinfo->refcount == 0) {
- drive_uninit(dinfo);
+ drive_del(dinfo);
}
}
},
};
-DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
+DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfaceType block_default_type)
{
const char *value;
DriveInfo *dinfo = NULL;
bdrv_set_on_error(bs, BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT);
} else {
- drive_uninit(drive_get_by_blockdev(bs));
+ drive_del(drive_get_by_blockdev(bs));
}
return 0;
goto fail;
}
- /* TODO Sort it out in raw-posix and drive_init: Reject aio=native with
+ /* TODO Sort it out in raw-posix and drive_new(): Reject aio=native with
* cache.direct=false instead of silently switching to aio=threads, except
- * if called from drive_init.
+ * when called from drive_new().
*
* For now, simply forbidding the combination for all drivers will do. */
if (options->has_aio && options->aio == BLOCKDEV_AIO_OPTIONS_NATIVE) {
}
if (bdrv_key_required(dinfo->bdrv)) {
- drive_uninit(dinfo);
+ drive_del(dinfo);
error_setg(errp, "blockdev-add doesn't support encrypted devices");
goto fail;
}
return NULL;
mc = MACHINE_GET_CLASS(current_machine);
- dinfo = drive_init(opts, mc->block_default_type);
+ dinfo = drive_new(opts, mc->block_default_type);
if (!dinfo) {
qemu_opts_del(opts);
return NULL;
qemu_opt_set(opts, "if", "none");
/* create host drive */
- dinfo = drive_init(opts, 0);
+ dinfo = drive_new(opts, 0);
if (!dinfo) {
qemu_opts_del(opts);
return NULL;
int bus;
int unit;
int auto_del; /* see blockdev_mark_auto_del() */
- bool enable_auto_del; /* Only for legacy drive_init() */
+ bool enable_auto_del; /* Only for legacy drive_new() */
int media_cd;
int cyls, heads, secs, trans;
QemuOpts *opts;
QemuOpts *drive_def(const char *optstr);
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,
const char *optstr);
-DriveInfo *drive_init(QemuOpts *arg, BlockInterfaceType block_default_type);
+DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type);
/* device-hotplug */
{
BlockInterfaceType *block_default_type = opaque;
- return drive_init(opts, *block_default_type) == NULL;
+ return drive_new(opts, *block_default_type) == NULL;
}
static int drive_enable_snapshot(QemuOpts *opts, void *opaque)
if (snapshot) {
drive_enable_snapshot(opts, NULL);
}
- if (!drive_init(opts, type)) {
+ if (!drive_new(opts, type)) {
exit(1);
}
}