emulator: introduced "image_file_path"
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 11 May 2015 08:04:13 +0000 (17:04 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Thu, 20 Aug 2015 07:17:40 +0000 (16:17 +0900)
It is an advanced alternative to "target_target_img_path".

Change-Id: Iec530c63ffc13c4fc0fc2fd32a7df2f64d4e9e8b
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
tizen/src/emul_state.c
tizen/src/emul_state.h

index 6128e9f60d9904c2a62905ced9faaa40c28204a3..2a676d121a6a1f14041910f7dea2599bf8117110 100644 (file)
@@ -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 <X11/XKBlib.h>
 #include <windows.h>
 #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));
index 8f8f545c210a7933a2c099523b4aaf23b3b851c4..43183a135e33fda0522454d16a86d6dc8bc5130c 100644 (file)
@@ -193,5 +193,6 @@ char* get_emul_hds_guest_path(void);
 char* get_emul_profile(void);
 bool get_emuld_connection(void);
 bool get_sdb_connection(void);
+const char* get_drive_image_file(void);
 
 #endif /* __EMUL_STATE_H__ */