Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize a bit the prototype of SIMIX_host_create()
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 14 Jul 2015 23:58:09 +0000 (01:58 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 18 Jul 2015 18:07:02 +0000 (20:07 +0200)
src/bindings/lua/lua_platf.c
src/simix/smx_environment.c
src/simix/smx_host.c
src/simix/smx_host_private.h
src/simix/smx_vm.c

index 8f43f67..2cd35f4 100644 (file)
@@ -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);
   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]);
       // 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]);
index 78e3307..a591570 100644 (file)
@@ -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])
   /* 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 */
   }
 
   /* Create storage at SIMIX level */
index 8c7fc7f..17bc3c9 100644 (file)
@@ -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
 /**
  * \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);
 {
   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);
 
   /* 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){
 }
 
 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);
 }
 
   return xbt_lib_get_elm_or_null(host_lib, name);
 }
 
index da0af03..17d0ec1 100644 (file)
@@ -20,7 +20,7 @@ typedef struct s_smx_host_priv {
 } s_smx_host_priv_t;
 
 void _SIMIX_host_free_process_arg(void *);
 } 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,
 void SIMIX_host_destroy(void *host);
 
 void SIMIX_host_add_auto_restart_process(sg_host_t host,
index 29c48b9..f060683 100644 (file)
@@ -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);
 
   /* 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. */
 
 
   /* 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);
 }
 
 
 }