From a78f82d7289e85cbdc87edbc203880a9b35f7ea1 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Sun, 19 Jul 2015 14:33:17 +0900 Subject: [PATCH] emulator: removed legacy start up codes It is removed since it is marked to deprecation at older version. Change-Id: Iece3d38f7c58975003dbe0d53048a033589a1035 Signed-off-by: SeokYeon Hwang --- tizen/src/Makefile.objs | 2 +- tizen/src/emul_state.c | 25 +-- tizen/src/emul_state.h | 8 - tizen/src/emulator.c | 7 - tizen/src/emulator_legacy.c | 324 ---------------------------------- tizen/src/util/new_debug_ch.c | 10 -- 6 files changed, 3 insertions(+), 373 deletions(-) delete mode 100644 tizen/src/emulator_legacy.c diff --git a/tizen/src/Makefile.objs b/tizen/src/Makefile.objs index 1ff95c8b9e..2154200749 100644 --- a/tizen/src/Makefile.objs +++ b/tizen/src/Makefile.objs @@ -3,7 +3,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tizen/src # emulator base -obj-y += emulator.o emulator_legacy.o emulator_options.o emul_state.o +obj-y += emulator.o emulator_options.o emul_state.o # utils obj-y += util/ diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 11bc77b2cb..4f30539f13 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -61,11 +61,6 @@ static EmulatorConfigInfo _emul_info = {0,}; static EmulatorConfigState _emul_state; /* misc */ -#ifdef SUPPORT_LEGACY_ARGS -// for compatibility -char log_path[PATH_MAX] = { 0, }; -#endif - const char *get_bin_path(void) { const char *bin_path = get_variable(KEYWORD_BIN_PATH); @@ -78,11 +73,6 @@ const char *get_bin_path(void) const char *get_log_path(void) { -#ifdef SUPPORT_LEGACY_ARGS - if (log_path[0]) { - return log_path; - } -#endif const char *log_path = get_variable("log_path"); // if "log_path" is not exist, make it first. @@ -212,13 +202,11 @@ char* get_emul_guest_ip(void) return _emul_info.guest_ip; } +// FIXME: should be cleaned up void set_emul_host_ip(char *kernel_cmdline) { -#ifdef SUPPORT_LEGACY_ARGS char *buf = strstr(kernel_cmdline, HOST_IP_PREFIX); -#else - char *buf = get_variable("host_ip"); -#endif + if (buf) { char buf_host_ip[MAXLEN] = {0,}; int len = strlen(HOST_IP_PREFIX); @@ -607,15 +595,6 @@ const char *get_vm_name(void) // vm_data_path static const char *vm_data_path = NULL; -#ifdef SUPPORT_LEGACY_ARGS -void set_vm_data_path(const char *path) -{ - vm_data_path = path; - - LOG_INFO("VM data path: %s\n", vm_data_path); -} -#endif - const char* get_vm_data_path(void) { if (vm_data_path) { diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 4dcf2815fa..d021f2f698 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -36,7 +36,6 @@ #include "display/maru_finger.h" -#define SUPPORT_LEGACY_ARGS #define MAX_ADDR_LEN 256 #define MAX_PORT_LEN 256 @@ -125,10 +124,6 @@ typedef struct EmulatorConfigState { } EmulatorConfigState; /* misc */ -#ifdef SUPPORT_LEGACY_ARGS -extern char log_path[]; -#endif - char const *get_bin_path(void); char const *get_log_path(void); @@ -201,9 +196,6 @@ extern const char* launch_conf_file; const char* get_drive_image_file(void); const char* get_http_proxy_addr(void); const char* get_vm_name(void); -#ifdef SUPPORT_LEGACY_ARGS -void set_vm_data_path(const char *path); -#endif const char* get_vm_data_path(void); #endif /* __EMUL_STATE_H__ */ diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 97902f1e5f..b7cd538d9d 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -228,13 +228,6 @@ int legacy_emulator_main(int argc, char **argv, char **envp); static int emulator_main(int argc, char *argv[], char **envp) { -#ifdef SUPPORT_LEGACY_ARGS - // for compatibilities... - if (argc > 2 && !g_strcmp0("--skin-args", argv[1])) { - return legacy_emulator_main(argc, argv, envp); - } -#endif - int c = 0; _qemu_argv = g_malloc(sizeof(char*) * ARGS_LIMIT); diff --git a/tizen/src/emulator_legacy.c b/tizen/src/emulator_legacy.c deleted file mode 100644 index cc1cbf329a..0000000000 --- a/tizen/src/emulator_legacy.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Emulator - * - * Copyright (C) 2011 - 2014 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * SeokYeon Hwang - * MunKyu Im - * GiWoong Kim - * YeongKyoon Lee - * HyunJun Son - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -#include - -#include "qemu/config-file.h" -#include "qemu/sockets.h" - -#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" -#include "util/maru_err_table.h" -#include "display/maru_display.h" -#include "util/osutil.h" -#include "util/sdb.h" -#include "skin/maruskin_server.h" -#include "debug_ch.h" -#include "ecs/ecs.h" - -#ifdef CONFIG_SDL -#include -#endif - -MULTI_DEBUG_CHANNEL(qemu, main); - -#define QEMU_ARGS_PREFIX "--qemu-args" -#define SKIN_ARGS_PREFIX "--skin-args" -#define IMAGE_PATH_PREFIX "file=" -//#define IMAGE_PATH_SUFFIX ",if=virtio" -#define IMAGE_PATH_SUFFIX ",if=virtio,index=1" -#define SDB_PORT_PREFIX "sdb_port=" -#define LOGS_SUFFIX "/logs/" -#define LOGFILE "emulator.log" -#define DISPLAY_WIDTH_PREFIX "width=" -#define DISPLAY_HEIGHT_PREFIX "height=" -#define SKIN_PATH_PREFIX "skin.path=" -#define INPUT_TOUCH_PARAMETER "virtio-touchscreen-pci" - -#define MIDBUF 128 -#define LEN_MARU_KERNEL_CMDLINE 512 - -extern gchar maru_kernel_cmdline[LEN_MARU_KERNEL_CMDLINE]; - -extern char tizen_target_path[PATH_MAX]; - -extern int enable_yagl; -extern int enable_spice; - -extern int _skin_argc; -extern char **_skin_argv; -extern int _qemu_argc; -extern char **_qemu_argv; - -static void print_system_info(void) -{ -#define DIV 1024 - - INFO("* Board name : %s\n", build_version); - INFO("* Package %s\n", pkginfo_version); - INFO("* Package %s\n", pkginfo_maintainer); - INFO("* Git Head : %s\n", pkginfo_githead); - INFO("* %s\n", latest_gittag); - INFO("* User name : %s\n", g_get_real_name()); - INFO("* Host name : %s\n", g_get_host_name()); - - /* time stamp */ - INFO("* Build date : %s\n", build_date); - - qemu_timeval tval = { 0, }; - if (qemu_gettimeofday(&tval) == 0) { - char timeinfo[64] = {0, }; - - time_t ti = tval.tv_sec; - struct tm *tm_time = localtime(&ti); - strftime(timeinfo, sizeof(timeinfo), "%Y-%m-%d %H:%M:%S", tm_time); - INFO("* Current time : %s\n", timeinfo); - } - -#ifdef CONFIG_SDL - /* Gets the version of the dynamically linked SDL library */ - INFO("* Host sdl version : (%d, %d, %d)\n", - SDL_Linked_Version()->major, - SDL_Linked_Version()->minor, - SDL_Linked_Version()->patch); -#endif - - print_system_info_os(); -} - -int qemu_main(int argc, char **argv, char **envp); - -static void set_image_and_log_path(char *qemu_argv) -{ - int i, j = 0; - int name_len = 0; - int prefix_len = 0; - int suffix_len = 0; - int max = 0; - char *path = malloc(PATH_MAX); - name_len = strlen(qemu_argv); - prefix_len = strlen(IMAGE_PATH_PREFIX); - suffix_len = strlen(IMAGE_PATH_SUFFIX); - max = name_len - suffix_len; - for (i = prefix_len , j = 0; i < max; i++) { - path[j++] = qemu_argv[i]; - } - path[j] = '\0'; - if (!g_path_is_absolute(path)) { - strcpy(tizen_target_path, g_get_current_dir()); - } else { - strcpy(tizen_target_path, g_path_get_dirname(path)); - } - - set_vm_data_path(tizen_target_path); - set_variable("vm_name", g_path_get_basename(tizen_target_path), true); - set_variable("drive_image_file", path, true); - free(path); - - strcpy(log_path, tizen_target_path); - strcat(log_path, LOGS_SUFFIX); -#ifdef CONFIG_WIN32 - if (access(g_win32_locale_filename_from_utf8(log_path), R_OK) != 0) { - g_mkdir(g_win32_locale_filename_from_utf8(log_path), 0755); - } -#else - if (access(log_path, R_OK) != 0) { - if (g_mkdir(log_path, 0755) < 0) { - fprintf(stderr, "failed to create log directory %s\n", log_path); - } - } -#endif - strcat(log_path, LOGFILE); -} - -static void emulator_notify_exit(Notifier *notifier, void *data) -{ - remove_vm_lock_os(); - - INFO("Exit emulator...\n"); -} - -static Notifier emulator_exit = { .notify = emulator_notify_exit }; - -static void redir_output(void) -{ - FILE *fp; - - fp = freopen(log_path, "a+", stdout); - if (fp == NULL) { - fprintf(stderr, "log file open error\n"); - } - - fp = freopen(log_path, "a+", stderr); - if (fp == NULL) { - fprintf(stderr, "log file open error\n"); - } - setvbuf(stdout, NULL, _IOLBF, BUFSIZ); - setvbuf(stderr, NULL, _IOLBF, BUFSIZ); -} - -// deprecated -static void extract_qemu_info(int qemu_argc, char **qemu_argv) -{ - int i = 0; - - for (i = 0; i < qemu_argc; ++i) { - if (strstr(qemu_argv[i], IMAGE_PATH_PREFIX) != NULL && - strstr(qemu_argv[i], IMAGE_PATH_SUFFIX) != NULL) { - set_image_and_log_path(qemu_argv[i]); - } else if (strstr(qemu_argv[i], INPUT_TOUCH_PARAMETER) != NULL) { - /* touchscreen */ - set_emul_input_touch_enable(true); - - char *option = strstr(qemu_argv[i] + strlen(INPUT_TOUCH_PARAMETER), TOUCHSCREEN_OPTION_NAME); - if (option != NULL) { - option += strlen(TOUCHSCREEN_OPTION_NAME) + 1; - } - } - } - - if (is_emul_input_touch_enable() != true) { - set_emul_input_mouse_enable(true); - } -} - -// deprecated -static void extract_skin_info(int skin_argc, char **skin_argv) -{ - int i = 0; - int w = 0, h = 0; - - for (i = 0; i < skin_argc; ++i) { - if (strstr(skin_argv[i], DISPLAY_WIDTH_PREFIX) != NULL) { - char *width_arg = skin_argv[i] + strlen(DISPLAY_WIDTH_PREFIX); - w = atoi(width_arg); - - INFO("display width option : %d\n", w); - } else if (strstr(skin_argv[i], DISPLAY_HEIGHT_PREFIX) != NULL) { - char *height_arg = skin_argv[i] + strlen(DISPLAY_HEIGHT_PREFIX); - h = atoi(height_arg); - - INFO("display height option : %d\n", h); - } else if (strstr(skin_argv[i], SKIN_PATH_PREFIX) != NULL) { - char *path = skin_argv[i] + strlen(SKIN_PATH_PREFIX); - - set_variable("skin_path", path, true); - } - - if (w != 0 && h != 0) { - set_emul_resolution(w, h); - } - } -} - -// deprecated -static void legacy_parse_options(int argc, char *argv[], int *skin_argc, - char ***skin_argv, int *qemu_argc, char ***qemu_argv) -{ - int i = 0; - int skin_args_index = 0; - - if (argc <= 1) { - fprintf(stderr, "Arguments are not enough to launch Emulator. " - "Please try to use Emulator Manager.\n"); - exit(1); - } - - /* classification */ - for (i = 1; i < argc; ++i) { - if (strstr(argv[i], SKIN_ARGS_PREFIX)) { - *skin_argv = &(argv[i + 1]); - break; - } - } - - for (skin_args_index = i; skin_args_index < argc; ++skin_args_index) { - if (strstr(argv[skin_args_index], QEMU_ARGS_PREFIX)) { - *skin_argc = skin_args_index - i - 1; - - *qemu_argc = argc - skin_args_index - i + 1; - *qemu_argv = &(argv[skin_args_index]); - - argv[skin_args_index] = argv[0]; - } - } -} - -// deprecated -int legacy_emulator_main(int argc, char **argv, char **envp); - -int legacy_emulator_main(int argc, char * argv[], char **envp) -{ - legacy_parse_options(argc, argv, &_skin_argc, - &_skin_argv, &_qemu_argc, &_qemu_argv); - set_bin_path_os(_qemu_argv[0]); - extract_qemu_info(_qemu_argc, _qemu_argv); - - INFO("Emulator start !!!\n"); - atexit(maru_atexit); - emulator_add_exit_notifier(&emulator_exit); - - extract_skin_info(_skin_argc, _skin_argv); - - /* Redirect stdout and stderr after debug_ch is initialized. */ - redir_output(); - - print_system_info(); - - INFO("Prepare running...\n"); - INFO("drive_image_flle: %s\n", get_drive_image_file()); - int i; - - fprintf(stdout, "qemu args: =========================================\n"); - for (i = 0; i < _qemu_argc; ++i) { - fprintf(stdout, "%s ", _qemu_argv[i]); - } - fprintf(stdout, "\nqemu args: =========================================\n"); - - fprintf(stdout, "skin args: =========================================\n"); - for (i = 0; i < _skin_argc; ++i) { - fprintf(stdout, "%s ", _skin_argv[i]); - } - fprintf(stdout, "\nskin args: =========================================\n"); - - INFO("socket initialize\n"); - socket_init(); - - INFO("qemu main start!\n"); - qemu_main(_qemu_argc, _qemu_argv, envp); - - return 0; -} diff --git a/tizen/src/util/new_debug_ch.c b/tizen/src/util/new_debug_ch.c index 22d25a994c..49f222ba7e 100644 --- a/tizen/src/util/new_debug_ch.c +++ b/tizen/src/util/new_debug_ch.c @@ -269,16 +269,6 @@ static void debug_init(void) if (tmp != NULL) { free(tmp); } - - // If "log_path" is not set, we use "stdout". - if (log_path[0] != '\0') { - fd = qemu_open(log_path, O_RDWR | O_CREAT | O_TRUNC | O_APPEND, 0666); - if (fd < 0) { - fprintf(stderr, "Can't open logfile: %s\n", log_path); - exit(1); - return; - } - } } int dbg_log(enum _debug_class cls, struct _debug_channel *channel, -- 2.34.1