emulator: modify the way to set/get vm name
authorSooyoung Ha <yoosah.ha@samsung.com>
Tue, 23 Jun 2015 15:04:45 +0000 (00:04 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Tue, 23 Jun 2015 15:04:45 +0000 (00:04 +0900)
Cherry-picked from 13782b9d574b8f4014dcbd93bcde61175420291b

Change-Id: Id14f835a521354ac4b53ec24b2909dceb0da8e9c
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
tizen/src/ecs/ecs_msg_device.c
tizen/src/emul_state.c
tizen/src/emul_state.h
tizen/src/emulator_legacy.c

index 25aad6a..d2186a1 100644 (file)
@@ -47,7 +47,7 @@
 
 MULTI_DEBUG_CHANNEL(qemu, ecs);
 
-static void msgproc_device_ans(ECS_Client* ccli, const char* category, bool succeed, char* data)
+static void msgproc_device_ans(ECS_Client* ccli, const char* category, bool succeed, const char* data)
 {
     if (ccli == NULL) {
         return;
@@ -394,7 +394,7 @@ bool msgproc_device_req(ECS_Client* ccli, ECS__DeviceReq* msg)
     } else if (!strcmp(cmd, "input")) {
         msgproc_device_req_input(ccli, msg, cmd);
     } else if (!strcmp(cmd, "vmname")) {
-        char* vmname = get_emul_vm_name();
+        const char* vmname = get_emul_vm_name();
         msgproc_device_ans(ccli, cmd, true, vmname);
     } else if (!strcmp(cmd, "nfc")) {
         msgproc_device_req_nfc(ccli, msg);
index f545208..6565740 100644 (file)
@@ -378,13 +378,12 @@ const char* get_drive_image_file(void)
 }
 
 /* vm name */
-void set_emul_vm_name(char *vm_name)
+const char* get_emul_vm_name(void)
 {
-    _emul_info.vm_name = vm_name;
-}
+    if (!_emul_info.vm_name) {
+        _emul_info.vm_name = get_variable("vm_name");
+    }
 
-char* get_emul_vm_name(void)
-{
     return _emul_info.vm_name;
 }
 
index 233444d..7be7b5c 100644 (file)
@@ -102,7 +102,7 @@ typedef  struct EmulatorConfigInfo {
     char http_proxy_port[MAX_PORT_LEN];
     int spice_port;
     int websocket_port;
-    char *vm_name;
+    const char *vm_name;
     /* add here */
     int serial_port;
 } EmulatorConfigInfo;
@@ -145,7 +145,6 @@ void set_emulator_condition(int state);
 void set_emul_rotation(short rotation_type);
 void set_emul_caps_lock_state(int state);
 void set_emul_num_lock_state(int state);
-void set_emul_vm_name(char *vm_name);
 void set_emul_http_proxy_addr(char *addr);
 void set_emul_http_proxy_port(char *port);
 void set_emul_hds_attached(bool attached);
@@ -174,7 +173,7 @@ int get_host_lock_key_state(int key);
 int get_host_lock_key_state_darwin(int key);
 int get_emul_caps_lock_state(void);
 int get_emul_num_lock_state(void);
-char* get_emul_vm_name(void);
+const char* get_emul_vm_name(void);
 char* get_emul_http_proxy_addr(void);
 char* get_emul_http_proxy_port(void);
 bool get_emul_hds_attached(void);
index 9485958..c775b53 100644 (file)
@@ -147,7 +147,7 @@ static void set_image_and_log_path(char *qemu_argv)
         strcpy(tizen_target_path, g_path_get_dirname(path));
     }
 
-    set_emul_vm_name(g_path_get_basename(tizen_target_path));
+    set_variable("vm_name", g_path_get_basename(tizen_target_path), true);
     set_variable("drive_image_file", path, true);
     free(path);