From: ChulHo Song Date: Wed, 30 Sep 2015 04:28:56 +0000 (+0900) Subject: sdcard: allocate "DriveInfo" to delete the "BlockBackend" automatically X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~40^2~110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eee1dfa354097a4ff1f92e57fefa64701fe723a2;p=sdk%2Femulator%2Fqemu.git sdcard: allocate "DriveInfo" to delete the "BlockBackend" automatically When the sdcard is detached, "virtio_blk_device_unrealize" marks auto deletion flag to the "DriveInfo". But "qmp_marshal_input_blockdev_add" does not create the "DriveInfo". To destroy BlockBackend object automatically we need to create dummy "DriveInfo". Change-Id: I8501c5b14daab487e72b4b6b6a0744475c6553a3 Signed-off-by: ChulHo Song --- diff --git a/tizen/src/util/device_hotplug.c b/tizen/src/util/device_hotplug.c index f6d8994d6c..d32235d7ff 100644 --- a/tizen/src/util/device_hotplug.c +++ b/tizen/src/util/device_hotplug.c @@ -30,6 +30,7 @@ #include "qemu/config-file.h" #include "hw/qdev.h" #include "qemu/event_notifier.h" +#include "sysemu/block-backend.h" #include "emulator.h" #include "emul_state.h" @@ -105,6 +106,7 @@ static bool do_sdcard_attach(const char * const file) gchar *sdcard_img = g_path_get_basename(file); gchar *sdcard_device_id = g_strdup_printf("device_id_%s", sdcard_img); gchar *sdcard_drive_id = g_strdup_printf("drive_id_%s", sdcard_img); + DriveInfo* dinfo = NULL; g_free(sdcard_img); @@ -117,6 +119,10 @@ static bool do_sdcard_attach(const char * const file) qmp_marshal_input_blockdev_add(default_mon, qdict, NULL); + dinfo = g_malloc0(sizeof(*dinfo)); + dinfo->type = IF_VIRTIO; + blk_set_legacy_dinfo(blk_by_name(sdcard_device_id), dinfo); + QDECREF(qdict); qdict = qdict_new();