From e6926f65ad24544872d376d0f0e79c5268c14a49 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Mon, 11 May 2015 17:24:26 +0900 Subject: [PATCH] emulator: used "drive_image_file" instead of "tizen_target_img_path" Change-Id: I6db0655f1c6b5c84a4360801d920809a7931cfb4 Signed-off-by: SeokYeon Hwang (cherry picked from commit e85a2024d6bbb29c06e986c2e6300a03f929e03a) --- tizen/src/ecs/ecs_msg_device.c | 9 ++++----- tizen/src/emulator.c | 1 - tizen/src/emulator_legacy.c | 6 +++--- tizen/src/ui/menu/detailedinfodialog.cpp | 2 -- tizen/src/util/osutil-darwin.c | 4 +--- tizen/src/util/osutil-linux.c | 6 ++---- tizen/src/util/osutil-win32.c | 5 ++--- 7 files changed, 12 insertions(+), 21 deletions(-) diff --git a/tizen/src/ecs/ecs_msg_device.c b/tizen/src/ecs/ecs_msg_device.c index a14d5f2..b4ad777 100644 --- a/tizen/src/ecs/ecs_msg_device.c +++ b/tizen/src/ecs/ecs_msg_device.c @@ -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; @@ -413,7 +413,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); diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 1be2c4f..4edf95f 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -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]; #ifdef CONFIG_YAGL extern bool yagl_enabled(void); diff --git a/tizen/src/emulator_legacy.c b/tizen/src/emulator_legacy.c index 0bbb00c..b8ad090 100644 --- a/tizen/src/emulator_legacy.c +++ b/tizen/src/emulator_legacy.c @@ -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" @@ -73,7 +74,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; @@ -146,7 +146,7 @@ static void set_image_and_log_path(char *qemu_argv) set_emul_vm_data_path(tizen_target_path); 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); @@ -302,7 +302,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"); diff --git a/tizen/src/ui/menu/detailedinfodialog.cpp b/tizen/src/ui/menu/detailedinfodialog.cpp index 243ab93..0af0219 100644 --- a/tizen/src/ui/menu/detailedinfodialog.cpp +++ b/tizen/src/ui/menu/detailedinfodialog.cpp @@ -33,8 +33,6 @@ extern int _qemu_argc; extern char **_qemu_argv; -extern char tizen_target_img_path[]; //TODO: not legacy - DetailedInfoDialog::DetailedInfoDialog(QWidget *parent) : QDialog(parent, Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint) diff --git a/tizen/src/util/osutil-darwin.c b/tizen/src/util/osutil-darwin.c index 2de11c3..ee7e194 100644 --- a/tizen/src/util/osutil-darwin.c +++ b/tizen/src/util/osutil-darwin.c @@ -56,8 +56,6 @@ MULTI_DEBUG_CHANNEL(qemu, osutil); static int g_shmid; -extern char tizen_target_img_path[]; - void check_vm_lock_os(void) { /* TODO: */ @@ -81,7 +79,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) { diff --git a/tizen/src/util/osutil-linux.c b/tizen/src/util/osutil-linux.c index 3e754fc..b940fd1 100644 --- a/tizen/src/util/osutil-linux.c +++ b/tizen/src/util/osutil-linux.c @@ -60,8 +60,6 @@ MULTI_DEBUG_CHANNEL(emulator, osutil); static int g_shmid; static char *g_shared_memory; -extern char tizen_target_img_path[]; - void check_vm_lock_os(void) { int shm_id; @@ -84,7 +82,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; @@ -124,7 +122,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); diff --git a/tizen/src/util/osutil-win32.c b/tizen/src/util/osutil-win32.c index 46d406c..40ce4d9 100644 --- a/tizen/src/util/osutil-win32.c +++ b/tizen/src/util/osutil-win32.c @@ -55,7 +55,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; @@ -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."); @@ -106,7 +105,7 @@ void make_vm_lock_os(void) check_vm_lock_os(); 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 */ -- 2.7.4