From 11462f95e635c682f23156dd985a1b3805a6c4ad Mon Sep 17 00:00:00 2001 From: espes Date: Thu, 18 Apr 2013 13:05:10 +1000 Subject: [PATCH] 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 :/) --- blockdev.c | 7 ++++++- include/sysemu/blockdev.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 9a076bf8ad..e5c37ed615 100644 --- a/blockdev.c +++ b/blockdev.c @@ -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); diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index cac1a414d0..2241418ef5 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -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,