From b9c709336bee8000370eba477c1ea0335115a39d Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Tue, 18 Aug 2015 18:01:58 +0900 Subject: [PATCH] emul_state: introduced get_swap_image_file() Introduced get_swap_image_file() that provide swap image file name. Change-Id: I5fa9bb4140fbcbd19361fdd57492dfb2c20d1d87 Signed-off-by: SeokYeon Hwang --- tizen/src/emul_state.c | 29 ++++++++++++++++++++++++++++- tizen/src/emul_state.h | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index 3ea18a7a33..42217b3924 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -468,7 +468,6 @@ const char *get_log_redirect_file(void) return log_redirect_file; } - // drive image file static const char *drive_image_file = NULL; @@ -495,6 +494,31 @@ const char *get_drive_image_file(void) return ""; } +// swap image file +static const char *swap_image_file = NULL; + +const char *get_swap_image_file(void) +{ + if (swap_image_file) { + return swap_image_file; + } + + // we should parse from "swap" parameter. + // so qemu_main() had to be called before. + BlockBackend *bb = blk_by_name("swap"); + if (bb) { + BlockDriverState *bs = blk_bs(bb); + swap_image_file = g_strdup(bs->filename); + + return swap_image_file; + } + + // called before device initialized + // or very weired situation + LOG_WARNING("Can not identify swap image file !!!\n"); + + return ""; +} // http proxy static const char *http_proxy_addr = NULL; @@ -840,6 +864,9 @@ static void emul_state_notify_exit(Notifier *notifier, void *data) g_free((void *)drive_image_file); drive_image_file = NULL; + g_free((void *)swap_image_file); + swap_image_file = NULL; + g_free((void *)http_proxy_addr); http_proxy_addr = NULL; diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 8aef4c889a..fe1a73fff2 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -181,6 +181,7 @@ char const *get_bin_path(void); char const *get_log_redirect_file(void); char const *get_kernel_log_redirect_file(void); const char *get_drive_image_file(void); +const char *get_swap_image_file(void); const char *get_http_proxy_addr(void); const char *get_vm_name(void); const char *get_profile_name(void); -- 2.34.1