From: Martin Quinson Date: Tue, 14 Jul 2015 23:58:09 +0000 (+0200) Subject: sanitize a bit the prototype of SIMIX_host_create() X-Git-Tag: v3_12~502 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d92bb5e90dbe8bd7eead32aba6941a4341fcf204?hp=8d545185124c10e9c58d954d12103d6620e201d2 sanitize a bit the prototype of SIMIX_host_create() --- diff --git a/src/bindings/lua/lua_platf.c b/src/bindings/lua/lua_platf.c index 8f43f67998..2cd35f4f89 100644 --- a/src/bindings/lua/lua_platf.c +++ b/src/bindings/lua/lua_platf.c @@ -63,7 +63,7 @@ int console_close(lua_State *L) { xbt_lib_foreach(host_lib, cursor, name, data) { if(data[SURF_HOST_LEVEL]){ XBT_DEBUG("\tSee surf host %s",name); - SIMIX_host_create(name, NULL); + SIMIX_host_create(name); // THIS IS BRAINDEAD. There is no sg_host_t in that level, but a smx_host_priv. So commenting out for now. // Lua is broken anyway. Christian will fix it // __MSG_host_create((sg_host_t)data[SIMIX_HOST_LEVEL]); diff --git a/src/simix/smx_environment.c b/src/simix/smx_environment.c index 78e3307a45..a591570401 100644 --- a/src/simix/smx_environment.c +++ b/src/simix/smx_environment.c @@ -53,7 +53,7 @@ void SIMIX_post_create_environment(void) { /* Create host at SIMIX level */ xbt_lib_foreach(host_lib, cursor, name, host) { if(host[SURF_HOST_LEVEL]) - SIMIX_host_create(name, NULL); + SIMIX_host_create(name); } /* Create storage at SIMIX level */ diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 8c7fc7f15a..17bc3c93dd 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -19,9 +19,8 @@ static void SIMIX_execution_finish(smx_synchro_t synchro); /** * \brief Internal function to create a SIMIX host. * \param name name of the host to create - * \param data some user data (may be NULL) */ -sg_host_t SIMIX_host_create(const char *name, void *killme) // FIXME: braindead prototype. Take sg_host as first arg +void SIMIX_host_create(const char *name) // FIXME: braindead prototype. Take sg_host as parameter { sg_host_t host = xbt_lib_get_elm_or_null(host_lib, name); smx_host_priv_t smx_host = xbt_new0(s_smx_host_priv_t, 1); @@ -33,8 +32,6 @@ sg_host_t SIMIX_host_create(const char *name, void *killme) // FIXME: braindead /* Update global variables */ sg_host_simix_set(host, smx_host); - - return host; } /** @@ -152,10 +149,6 @@ void SIMIX_host_destroy(void *h) } sg_host_t SIMIX_host_get_by_name(const char *name){ - xbt_assert(((simix_global != NULL) - && (host_lib != NULL)), - "Environment not set yet"); - return xbt_lib_get_elm_or_null(host_lib, name); } diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index da0af03ce8..17d0ec1994 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -20,7 +20,7 @@ typedef struct s_smx_host_priv { } s_smx_host_priv_t; void _SIMIX_host_free_process_arg(void *); -sg_host_t SIMIX_host_create(const char *name, void *data); +void SIMIX_host_create(const char *name); void SIMIX_host_destroy(void *host); void SIMIX_host_add_auto_restart_process(sg_host_t host, diff --git a/src/simix/smx_vm.c b/src/simix/smx_vm.c index 29c48b9144..f060683b01 100644 --- a/src/simix/smx_vm.c +++ b/src/simix/smx_vm.c @@ -25,12 +25,12 @@ sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host) /* Create surf associated resource */ surf_vm_model_create(name, ind_phys_host); - sg_host_t smx_host = SIMIX_host_create(name, NULL); + SIMIX_host_create(name); /* We will be able to register the VM to its physical host, so that we can promptly * retrieve the list VMs on the physical host. */ - return smx_host; + return SIMIX_host_get_by_name(name); }