exposing adding devices directly instead o just through drive_init

(we can't use drive_init to create a memory block device since it only
 takes string arguments :/)
This commit is contained in:
espes 2013-04-18 13:05:10 +10:00
parent 3528f98548
commit 11462f95e6
2 changed files with 7 additions and 1 deletions

View File

@ -204,6 +204,11 @@ DriveInfo *drive_get_by_blockdev(BlockDriverState *bs)
return NULL;
}
void drive_append(DriveInfo *dinfo)
{
QTAILQ_INSERT_TAIL(&drives, dinfo, next);
}
static void bdrv_format_print(void *opaque, const char *name)
{
error_printf(" %s", name);
@ -624,7 +629,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
if (serial != NULL) {
dinfo->serial = g_strdup(serial);
}
QTAILQ_INSERT_TAIL(&drives, dinfo, next);
drive_append(dinfo);
bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error);

View File

@ -53,6 +53,7 @@ DriveInfo *drive_get_next(BlockInterfaceType type);
void drive_get_ref(DriveInfo *dinfo);
void drive_put_ref(DriveInfo *dinfo);
DriveInfo *drive_get_by_blockdev(BlockDriverState *bs);
void drive_append(DriveInfo *dinfo);
QemuOpts *drive_def(const char *optstr);
QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file,