From: SeokYeon Hwang Date: Mon, 11 May 2015 08:04:13 +0000 (+0900) Subject: emulator: introduced "image_file_path" X-Git-Tag: Tizen_Studio_1.3_Release_p2.3~41^2~29 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3767865d9ee2272473a5f98cd96ce69b441f3b9e;p=sdk%2Femulator%2Fqemu.git emulator: introduced "image_file_path" It is an advanced alternative to "target_target_img_path". Change-Id: Iec530c63ffc13c4fc0fc2fd32a7df2f64d4e9e8b (cherry picked from commit dc990fd000f60f85bd99c75d0d5ba29587d2d56f) Signed-off-by: SeokYeon Hwang Signed-off-by: Sooyoung Ha --- diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 53d7a6b9c5..fb183fff9c 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -30,9 +30,8 @@ */ #include "emul_state.h" -#include "emulator_options.h" -#include "skin/maruskin_server.h" -#include "util/new_debug_ch.h" + +#include "emulator_common.h" #if defined(CONFIG_LINUX) #include @@ -40,6 +39,13 @@ #include #endif +#include "block/block_int.h" +#include "sysemu/block-backend.h" + +#include "emulator_options.h" +#include "skin/maruskin_server.h" +#include "util/new_debug_ch.h" + DECLARE_DEBUG_CHANNEL(emul_state); static EmulatorConfigInfo _emul_info = {0,}; @@ -346,7 +352,33 @@ int get_emul_num_lock_state(void) return _emul_state.qemu_num_lock; } -/* emualtor vm name */ +/* drive image file */ +const char* get_drive_image_file(void) +{ + char *drive_image_file = get_variable("drive_image_file"); + + if (!drive_image_file) { + return drive_image_file; + } + + // we should parse from "drive" parameter. + // so qemu_main() had to be called before. + BlockBackend *bb = blk_by_name("drive"); + if (bb) { + BlockDriverState *bs = blk_bs(bb); + set_variable("drivce_image_file", bs->filename, true); + + return bs->filename; + } + + // called before device initialized + // or very weired situation + LOG_SEVERE("Can not identify main drive image file !!!\n"); + + return ""; +} + +/* vm name */ void set_emul_vm_name(char *vm_name) { _emul_info.vm_name = vm_name; @@ -357,7 +389,7 @@ char* get_emul_vm_name(void) return _emul_info.vm_name; } -/* emualtor http proxy */ +/* http proxy */ void set_emul_http_proxy_addr(char *addr) { strncpy(_emul_info.http_proxy_addr, addr, strlen(addr)); diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 20ec3a2bf6..233444d4bb 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -179,5 +179,6 @@ char* get_emul_http_proxy_addr(void); char* get_emul_http_proxy_port(void); bool get_emul_hds_attached(void); char* get_emul_hds_path(void); +const char* get_drive_image_file(void); #endif /* __EMUL_STATE_H__ */