emulator: move get_log_path(), get_bin_path() to emul_state 30/24430/2
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 14 Jul 2014 09:18:58 +0000 (18:18 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 15 Jul 2014 01:15:35 +0000 (10:15 +0900)
Change-Id: Ie41921003dc6c191a44c83600bb26901c1c2d5b7
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
13 files changed:
tizen/src/ecs/ecs_msg.c
tizen/src/emul_state.c
tizen/src/emul_state.h
tizen/src/emulator.c
tizen/src/emulator.h
tizen/src/emulator_legacy.c
tizen/src/emulator_options.c
tizen/src/skin/maruskin_client.c
tizen/src/util/new_debug_ch.c
tizen/src/util/osutil-darwin.c
tizen/src/util/osutil-linux.c
tizen/src/util/osutil-win32.c
tizen/src/util/osutil.h

index 866b9eff9cb6625ae8c9dc86993b8f57cbfb0887..48f2f7f94f367c3b88530542b7dab496f2ad73a5 100644 (file)
@@ -67,7 +67,6 @@
 #include "skin/maruskin_operation.h"
 #include "skin/maruskin_server.h"
 #include "util/maru_device_hotplug.h"
-#include "emulator.h"
 #include "emul_state.h"
 
 #include "debug_ch.h"
@@ -994,7 +993,7 @@ static char* get_emulator_sdcard_path(void)
  */
 char *get_tizen_sdk_data_path(void)
 {
-    char *emul_bin_path = NULL;
+    char const *emul_bin_path = NULL;
     char *sdk_info_file_path = NULL;
     char *tizen_sdk_data_path = NULL;
 #ifndef CONFIG_WIN32
index 67286fbfc1e14084906fc5166d88500acb9cdc1c..7e10d185d9697cb5d45cb9b6fda02809e30dd793 100644 (file)
@@ -30,8 +30,9 @@
  */
 
 #include "emul_state.h"
+#include "emulator_options.h"
 #include "skin/maruskin_server.h"
-#include "debug_ch.h"
+#include "util/new_debug_ch.h"
 
 #if defined(CONFIG_LINUX)
 #include <X11/XKBlib.h>
 #include <windows.h>
 #endif
 
-MULTI_DEBUG_CHANNEL(qemu, emul_state);
-
+DECLARE_DEBUG_CHANNEL(emul_state);
 
 static EmulatorConfigInfo _emul_info = {0,};
 static EmulatorConfigState _emul_state;
 
+/* misc */
+char bin_path[PATH_MAX] = { 0, };
+#ifdef SUPPORT_LEGACY_ARGS
+// for compatibility
+char log_path[PATH_MAX] = { 0, };
+#endif
+
+
+const char *get_bin_path(void)
+{
+    return bin_path;
+}
+
+const char *get_log_path(void)
+{
+#ifdef SUPPORT_LEGACY_ARGS
+    if (log_path[0]) {
+        return log_path;
+    }
+#endif
+    char *log_path = get_variable("log_path");
+
+    // if "log_path" is not exist, make it first
+    if (!log_path) {
+        char *vms_path = get_variable("vms_path");
+        char *vm_name = get_variable("vm_name");
+        if (!vms_path || !vm_name) {
+            log_path = NULL;
+        }
+        else {
+            log_path = g_strdup_printf("%s/%s/logs", vms_path, vm_name);
+        }
+
+        set_variable("log_path", log_path, false);
+    }
+
+    return log_path;
+}
+
+
 /* start_skin_client or not ? */
 void set_emul_skin_enable(bool enable)
 {
@@ -62,7 +102,7 @@ void set_emul_resolution(int width, int height)
     _emul_info.resolution_w = width;
     _emul_info.resolution_h = height;
 
-    INFO("emulator graphic resolution : %dx%d\n",
+    LOG_INFO("emulator graphic resolution : %dx%d\n",
         _emul_info.resolution_w, _emul_info.resolution_h);
 }
 
@@ -82,7 +122,7 @@ void set_emul_sdl_bpp(int bpp)
     _emul_info.sdl_bpp = bpp;
 
     if (_emul_info.sdl_bpp != 32) {
-        INFO("sdl bpp : %d\n", _emul_info.sdl_bpp);
+        LOG_INFO("sdl bpp : %d\n", _emul_info.sdl_bpp);
     }
 }
 
@@ -97,7 +137,7 @@ void set_emul_input_mouse_enable(bool on)
     _emul_info.input_mouse_enable = on;
 
     if (_emul_info.input_mouse_enable == true) {
-        INFO("set_emul_input_mouse_enable\n");
+        LOG_INFO("set_emul_input_mouse_enable\n");
     }
 }
 
@@ -112,7 +152,7 @@ void set_emul_input_touch_enable(bool on)
     _emul_info.input_touch_enable = on;
 
     if (_emul_info.input_touch_enable == true) {
-        INFO("set_emul_input_touch_enable\n");
+        LOG_INFO("set_emul_input_touch_enable\n");
     }
 }
 
@@ -129,7 +169,7 @@ void set_emul_max_touch_point(int cnt)
     }
     _emul_info.max_touch_point = cnt;
 
-    INFO("set max touch point : %d\n", cnt);
+    LOG_INFO("set max touch point : %d\n", cnt);
 }
 
 int get_emul_max_touch_point(void)
@@ -177,10 +217,10 @@ int get_emulator_condition(void)
 void set_emulator_condition(int state)
 {
     if (state == BOOT_COMPLETED) {
-        INFO("boot completed!\n");
+        LOG_INFO("boot completed!\n");
         // TODO:
     } else if (state == RESET) {
-        INFO("reset emulator!\n");
+        LOG_INFO("reset emulator!\n");
 
         notify_emul_reset();
     }
@@ -192,12 +232,12 @@ void set_emulator_condition(int state)
 void set_emul_win_scale(double scale_factor)
 {
     if (scale_factor < 0.0 || scale_factor > 2.0) {
-        INFO("scale_factor is out of range : %f\n", scale_factor);
+        LOG_INFO("scale_factor is out of range : %f\n", scale_factor);
         scale_factor = 1.0;
     }
 
     _emul_state.scale_factor = scale_factor;
-    INFO("emulator window scale_factor : %f\n", _emul_state.scale_factor);
+    LOG_INFO("emulator window scale_factor : %f\n", _emul_state.scale_factor);
 }
 
 double get_emul_win_scale(void)
@@ -210,12 +250,12 @@ void set_emul_rotation(short rotation_type)
 {
     if (rotation_type < ROTATION_PORTRAIT ||
             rotation_type > ROTATION_REVERSE_LANDSCAPE) {
-        INFO("rotation type is out of range : %d\n", rotation_type);
+        LOG_INFO("rotation type is out of range : %d\n", rotation_type);
         rotation_type = ROTATION_PORTRAIT;
     }
 
     _emul_state.rotation_type = rotation_type;
-    INFO("emulator rotation type : %d\n", _emul_state.rotation_type);
+    LOG_INFO("emulator rotation type : %d\n", _emul_state.rotation_type);
 }
 
 short get_emul_rotation(void)
index f63fb8af2a715184c8bccde97c6b8b242462cefe..0cadfcd9addb1f46835dc7348aa67d5697bba745 100644 (file)
@@ -36,6 +36,8 @@
 
 #include "display/maru_finger.h"
 
+#define SUPPORT_LEGACY_ARGS
+
 enum {
     RESET = 0,
     BOOT_COMPLETED = 1,
@@ -104,6 +106,14 @@ typedef struct EmulatorConfigState {
     /* add here */
 } EmulatorConfigState;
 
+/* misc */
+extern gchar bin_path[];
+#ifdef SUPPORT_LEGACY_ARGS
+extern gchar log_path[];
+#endif
+
+char const *get_bin_path(void);
+char const *get_log_path(void);
 
 /* setter */
 void set_emul_skin_enable(bool enable);
index c115991df457b4a6bb92773c89c8b62acc276db5..60b1a5b5e1b98537bdb707d04340e6ee63c965c8 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <stdlib.h>
 #include <getopt.h>
+#include <libgen.h>
 
 #include "qemu/config-file.h"
 #include "qemu/sockets.h"
 #include <SDL.h>
 #endif
 
-#ifdef CONFIG_WIN32
-#include <libgen.h>
-#endif
-
 #ifdef CONFIG_DARWIN
-#include <libgen.h>
 #include "ns_event.h"
 int thread_running = 1; /* Check if we need exit main */
 #endif
 
 DECLARE_DEBUG_CHANNEL(main);
 
-#define SUPPORT_LEGACY_ARGS
-
 #define ARGS_LIMIT  128
 #define LEN_MARU_KERNEL_CMDLINE 512
 char maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
 
-char bin_path[PATH_MAX] = { 0, };
-
 char tizen_target_path[PATH_MAX];
 char tizen_target_img_path[PATH_MAX];
 
@@ -82,32 +74,6 @@ char **_skin_argv;
 int _qemu_argc;
 char **_qemu_argv;
 
-const char *get_log_path(void)
-{
-#ifdef SUPPORT_LEGACY_ARGS
-    if (log_path[0]) {
-        return log_path;
-    }
-#endif
-    char *log_path = get_variable("log_path");
-
-    // if "log_path" is not exist, make it first
-    if (!log_path) {
-        char *vms_path = get_variable("vms_path");
-        char *vm_name = get_variable("vm_name");
-        if (!vms_path || !vm_name) {
-            log_path = NULL;
-        }
-        else {
-            log_path = g_strdup_printf("%s/%s/logs", vms_path, vm_name);
-        }
-
-        set_variable("log_path", log_path, false);
-    }
-
-    return log_path;
-}
-
 void emulator_add_exit_notifier(Notifier *notify)
 {
     qemu_add_exit_notifier(notify);
@@ -137,16 +103,11 @@ static void get_host_proxy(char *http_proxy, char *https_proxy, char *ftp_proxy,
     get_host_proxy_os(http_proxy, https_proxy, ftp_proxy, socks_proxy);
 }
 
-static void set_bin_path(gchar * exec_argv)
+static void set_bin_path(char const *const exec_argv)
 {
     set_bin_path_os(exec_argv);
 }
 
-gchar * get_bin_path(void)
-{
-    return bin_path;
-}
-
 static void check_vm_lock(void)
 {
     check_vm_lock_os();
@@ -292,7 +253,7 @@ static void prepare_opengl_acceleration(gchar * const kernel_cmdline)
 }
 #endif
 
-const gchar *prepare_maru(const gchar * const kernel_cmdline)
+const char *prepare_maru(const gchar * const kernel_cmdline)
 {
     LOG_INFO("Prepare maru specified feature\n");
 
index 7198e4cf7d37f7319c6e079d88b9bda2b2ec82c5..cd918b483de04e0e4d1c1803d22a502cbcbf62fb 100644 (file)
 #include "qemu/option.h"
 #include "sysemu/sysemu.h"
 
-extern gchar bin_path[];
-extern gchar log_path[];
-
-char *get_bin_path(void);
-const gchar * prepare_maru(const gchar * const kernel_cmdline);
+const char *prepare_maru(const gchar * const kernel_cmdline);
 void start_skin(void);
 
-const gchar * get_log_path(void);
-
 void emulator_add_exit_notifier(Notifier *notify);
 
 #endif /* __EMULATOR_H__ */
index 3d75746b8926fad58b2ed59b56f4f57b970b2993..3b8194c95f667e31c03eb0498a462dd7778dc1b3 100644 (file)
@@ -69,9 +69,6 @@ MULTI_DEBUG_CHANNEL(qemu, main);
 #define MIDBUF  128
 #define LEN_MARU_KERNEL_CMDLINE 512
 
-// for compatibility
-gchar log_path[PATH_MAX] = { 0, };
-
 extern gchar maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE];
 
 extern char tizen_target_path[PATH_MAX];
index 2c43aa691f7fa225c12b5be5612a54262e4f749c..d683dbde5cba0c570868a8d3427af8dac5719c08 100644 (file)
@@ -30,7 +30,7 @@
 #include "qemu/queue.h"
 
 #include "emulator_options.h"
-#include "emulator.h"
+#include "emul_state.h"
 
 #define LINE_LIMIT 1024
 #define TOKEN_LIMIT 128
index 5a327f02a83c0e4686606f1425476c24c6ccc55d..5001a1cb52b47c4b6f0140e79f48ccf0935e6550 100644 (file)
@@ -138,13 +138,13 @@ static void *run_skin_client(void *arg)
         strcpy(JAVA_EXEFILE_PATH, "java");
     }
 
-    char* bin_dir = get_bin_path();
+    char const* bin_dir = get_bin_path();
     int bin_len = strlen(bin_dir);
     char bin_dir_win[bin_len];
     strcpy(bin_dir_win, bin_dir);
     bin_dir_win[strlen(bin_dir_win) -1] = '\0';
 #else
-    char* bin_dir = get_bin_path();
+    char const* bin_dir = get_bin_path();
 #endif
     INFO("bin directory : %s\n", bin_dir);
 
@@ -367,13 +367,13 @@ int start_simple_client(char* msg)
         strcpy(JAVA_EXEFILE_PATH, "java");
     }
 
-    char* bin_dir = get_bin_path();
+    char const* bin_dir = get_bin_path();
     int bin_dir_len = strlen(bin_dir);
     char bin_dir_win[bin_dir_len];
     strcpy(bin_dir_win, bin_dir);
     bin_dir_win[strlen(bin_dir_win) -1] = '\0';
 #else
-    char* bin_dir = get_bin_path();
+    char const* bin_dir = get_bin_path();
 #endif
     INFO("bin directory : %s\n", bin_dir);
 
index e27abdef08b985e9a8e9c60338fac9e96f17819a..4effe690a2522314d53f4cecd29a53cd3bc04169 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "qemu-common.h"
 
-#include "emulator.h"
+#include "emul_state.h"
 #include "util/new_debug_ch.h"
 #include "util/osutil.h"
 
index a4f483cda36d32284aeeb1ea1099529102c8994d..feedd7fbe44835d0dc2bb3515b18e0591a350c45 100644 (file)
@@ -126,7 +126,7 @@ void remove_vm_lock_os(void)
     }
 }
 
-void set_bin_path_os(gchar * exec_argv)
+void set_bin_path_os(char const *const exec_argv)
 {
     gchar *file_name = NULL;
 
index 866355ba23b0c8e7ec14739bdb2fe86a478bda89..4e898941cd2791e8f07645eb7ea71def362b6f08 100644 (file)
@@ -160,7 +160,7 @@ void remove_vm_lock_os(void)
 }
 
 
-void set_bin_path_os(gchar * exec_argv)
+void set_bin_path_os(char const *const exec_argv)
 {
     gchar link_path[PATH_MAX] = { 0, };
     char *file_name = NULL;
index fc2349a913710143e646a41d77c5bc8f7ceb8b84..05771cbf4912a1949539d86911ab42a02d5b21ed 100644 (file)
@@ -144,7 +144,7 @@ void remove_vm_lock_os(void)
 }
 
 
-void set_bin_path_os(gchar * exec_argv)
+void set_bin_path_os(char const *const exec_argv)
 {
     gchar link_path[PATH_MAX] = { 0, };
     gchar *file_name = NULL;
index 566f4a303426317d45b8f98b53225e3c069c2db9..926f3a0a374997a44c585661a865ee7c8334fe4c 100644 (file)
@@ -64,7 +64,7 @@ void check_vm_lock_os(void);
 void make_vm_lock_os(void);
 void remove_vm_lock_os(void);
 
-void set_bin_path_os(gchar *);
+void set_bin_path_os(char const *const);
 
 void print_system_info_os(void);