From d9d29f9c45022aeb18af277c995291c0547bbc0d Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 28 Aug 2016 17:58:43 +0200 Subject: [PATCH] kill a useless function --- src/include/surf/surf.h | 7 ------- src/simix/smx_vm.cpp | 10 ++++------ src/surf/surf_c_bindings.cpp | 5 ----- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 6b20c10292..eb14203fb7 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -254,13 +254,6 @@ XBT_PUBLIC(sg_size_t) surf_host_get_free_size(sg_host_t resource, const char* na */ XBT_PUBLIC(sg_size_t) surf_host_get_used_size(sg_host_t resource, const char* name); -/** - * @brief Destroy a VM - * - * @param resource The surf vm - */ -XBT_PUBLIC(void) surf_vm_destroy(sg_host_t resource); - /** @brief Suspend a VM */ XBT_PUBLIC(void) surf_vm_suspend(sg_host_t resource); diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 3e50acab7f..b560598d53 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -338,14 +338,12 @@ void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm) void SIMIX_vm_destroy(sg_host_t vm) { /* this code basically performs a similar thing like SIMIX_host_destroy() */ - - const char *hostname = sg_host_get_name(vm); - - XBT_DEBUG("destroy %s", hostname); + XBT_DEBUG("destroy %s", sg_host_get_name(vm)); /* this will call the registered callback function, i.e., SIMIX_host_destroy(). */ sg_host_simix_destroy(vm); - /* jump to vm_ws_destroy(). The surf level resource will be freed. */ - surf_vm_destroy(vm); + /* Don't free these things twice: they are the ones of my physical host */ + vm->pimpl_cpu = nullptr; + vm->pimpl_netcard = nullptr; } diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 74ade32d2f..aba848023d 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -229,11 +229,6 @@ int surf_host_file_move(sg_host_t host, surf_file_t fd, const char* fullpath){ return get_casted_host(host)->fileMove(fd, fullpath); } -void surf_vm_destroy(sg_host_t vm){ // FIXME:DEADCODE - vm->pimpl_cpu = nullptr; - vm->pimpl_netcard = nullptr; -} - void surf_vm_suspend(sg_host_t vm){ get_casted_vm(vm)->suspend(); } -- 2.20.1