emulator: used "drive_image_file" instead of "tizen_target_img_path"
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 11 May 2015 08:24:26 +0000 (17:24 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Thu, 20 Aug 2015 07:18:18 +0000 (16:18 +0900)
Change-Id: I6db0655f1c6b5c84a4360801d920809a7931cfb4
(cherry picked from commit e85a2024d6bbb29c06e986c2e6300a03f929e03a)
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
tizen/src/ecs/ecs_msg_device.c
tizen/src/emulator.c
tizen/src/emulator_legacy.c
tizen/src/util/osutil-darwin.c
tizen/src/util/osutil-linux.c
tizen/src/util/osutil-win32.c

index a1b7ad37e58b03d0c0dd8fec19e3cc434fb9e48b..6647700327032f71f91a2d1950acef6d3f529b14 100644 (file)
@@ -85,11 +85,11 @@ static void msgproc_device_ans(ECS_Client* ccli, const char* category, bool succ
         g_free(ans.category);
 }
 
-extern char tizen_target_img_path[];
 void send_target_image_information(ECS_Client* ccli) {
     ECS__Master master = ECS__MASTER__INIT;
     ECS__DeviceAns ans = ECS__DEVICE_ANS__INIT;
-    int length = strlen(tizen_target_img_path); // ??
+    const char *drive_image_file = get_drive_image_file();
+    int length = strlen(drive_image_file); // ??
 
     ans.category = (char*) g_malloc(10 + 1);
     strncpy(ans.category, "info", 10);
@@ -105,9 +105,9 @@ void send_target_image_information(ECS_Client* ccli) {
 
         ans.data.data = g_malloc(length);
         ans.data.len = length;
-        memcpy(ans.data.data, tizen_target_img_path, length);
+        memcpy(ans.data.data, drive_image_file, length);
 
-        LOG_TRACE("data = %s, length = %hu\n", tizen_target_img_path, length);
+        LOG_TRACE("data = %s, length = %hu\n", drive_image_file, length);
     }
 
     master.type = ECS__MASTER__TYPE__DEVICE_ANS;
@@ -408,7 +408,6 @@ bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg)
         msgproc_device_req_tgesture(ccli, msg);
     } else if (!strcmp(cmd, "info")) {
         // check to emulator target image path
-        LOG_TRACE("receive info message %s\n", tizen_target_img_path);
         send_target_image_information(ccli);
     } else if (!strcmp(cmd, "hds")) {
         msgproc_device_req_hds(ccli, msg, cmd);
index 2aa8a964a61c28ab38b4ce96f11ce3abaf0d4e4c..4a618ed40bdeef5871c7a45fa8c95488616f58db 100644 (file)
@@ -64,7 +64,6 @@ DECLARE_DEBUG_CHANNEL(main);
 char maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
 
 char tizen_target_path[PATH_MAX];
-char tizen_target_img_path[PATH_MAX];
 
 int enable_yagl = 0;
 int enable_spice = 0;
index 165204309a28da13b3818e064c185694cb1c8a79..17c2a4e589463a9391300b9244b5ee17160f0db2 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "build_info.h"
 #include "emulator.h"
+#include "emulator_options.h"
 #include "emul_state.h"
 #include "hw/virtio/maru_virtio_touchscreen.h"
 #include "util/check_gl.h"
@@ -72,7 +73,6 @@ MULTI_DEBUG_CHANNEL(qemu, main);
 extern gchar maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
 
 extern char tizen_target_path[PATH_MAX];
-extern char tizen_target_img_path[PATH_MAX];
 
 extern int enable_yagl;
 extern int enable_spice;
@@ -148,7 +148,7 @@ static void set_image_and_log_path(char *qemu_argv)
     }
 
     set_emul_vm_name(g_path_get_basename(tizen_target_path));
-    strcpy(tizen_target_img_path, path);
+    set_variable("drive_image_file", path, true);
     free(path);
 
     strcpy(log_path, tizen_target_path);
@@ -306,7 +306,7 @@ int legacy_emulator_main(int argc, char * argv[], char **envp)
     print_system_info();
 
     INFO("Prepare running...\n");
-    INFO("tizen_target_img_path: %s\n", tizen_target_img_path);
+    INFO("drive_image_flle: %s\n", get_drive_image_file());
     int i;
 
     fprintf(stdout, "qemu args: =========================================\n");
index 9c86f1efb5d5d9885764da41f5fe104374b301df..dd71eaf46a2f4778de637cb883881648928e9b3b 100644 (file)
@@ -57,8 +57,6 @@ MULTI_DEBUG_CHANNEL(qemu, osutil);
 static int g_shmid;
 static CFDictionaryRef proxySettings;
 
-extern char tizen_target_img_path[];
-
 static char *cfstring_to_cstring(CFStringRef str) {
     if (str == NULL) {
         return NULL;
@@ -104,7 +102,7 @@ void make_vm_lock_os(void)
         perror("osutil-darwin: ");
         return;
     }
-    g_sprintf(shared_memory, "%s", tizen_target_img_path);
+    g_sprintf(shared_memory, "%s", get_drive_image_file());
     INFO("shared memory key: %d, value: %s\n", base_port, (char *)shared_memory);
 
     if (shmdt(shared_memory) == -1) {
index a84379c791cd986301eb8b148d9f244fb72aff9d..474c037f7b89cfd12ce2ec5a7053927a677b67ed 100644 (file)
@@ -62,8 +62,6 @@ static int g_shmid;
 static char *g_shared_memory;
 static int gproxytool = GSETTINGS;
 
-extern char tizen_target_img_path[];
-
 /* Getting proxy commands */
 static const char* gproxycmds[][2] = {
     { "gconftool-2 -g /system/proxy/mode" , "gsettings get org.gnome.system.proxy mode" },
@@ -100,7 +98,7 @@ void check_vm_lock_os(void)
                 INFO("count of process that use shared memory : %d\n",
                     shm_info.shm_nattch);
                 if ((shm_info.shm_nattch > 0) &&
-                    g_strcmp0(tizen_target_img_path, (char *)shm_addr) == 0) {
+                    g_strcmp0(get_drive_image_file(), (char *)shm_addr) == 0) {
                     if (check_port_bind_listen(port + 1) > 0) {
                         shmdt(shm_addr);
                         continue;
@@ -138,7 +136,7 @@ void make_vm_lock_os(void)
         return;
     }
 
-    g_sprintf(g_shared_memory, "%s", tizen_target_img_path);
+    g_sprintf(g_shared_memory, "%s", get_drive_image_file());
     INFO("shared memory key: %d value: %s\n",
         base_port, (char *)g_shared_memory);
 
index b71f0ef5d53ad041b261e21b1fc897d65d4972e9..0a55dc03bafe2d13d271538c52ff6dd83ba1bf10 100644 (file)
@@ -54,7 +54,6 @@ MULTI_DEBUG_CHANNEL (emulator, osutil);
 static HANDLE g_hMapFile;
 static char *g_pBuf;
 
-extern char tizen_target_img_path[];
 static char g_sdcard[256] = {0,};
 static sdcard_info info;
 static const char *pactempfile = ".autoproxy";
@@ -79,7 +78,7 @@ void check_vm_lock_os(void)
                 CloseHandle(hMapFile);
             }
 
-            if (strcmp(pBuf, tizen_target_img_path) == 0) {
+            if (strcmp(pBuf, get_drive_image_file()) == 0) {
                 maru_register_exit_msg(MARU_EXIT_UNKNOWN,
                     "Can not execute this VM.\n"
                     "The same name is running now.");
@@ -104,7 +103,7 @@ void make_vm_lock_os(void)
     int base_port;
 
     base_port = get_emul_vm_base_port();
-    shared_memory = g_strdup_printf("%s", tizen_target_img_path);
+    shared_memory = g_strdup_printf("%s", get_drive_image_file());
     port_in_use =  g_strdup_printf("%d", base_port);
     g_hMapFile = CreateFileMapping(
                  INVALID_HANDLE_VALUE, /* use paging file */