Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
save one pointer per MSG host
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 27 Apr 2012 20:25:31 +0000 (22:25 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 27 Apr 2012 20:25:31 +0000 (22:25 +0200)
include/msg/datatypes.h
src/msg/msg_environment.c
src/msg/msg_host.c
src/msg/msg_private.h

index 08a6b26..37d4073 100644 (file)
@@ -19,7 +19,6 @@ typedef struct simdata_host *simdata_host_t;
 typedef struct m_host {
   char *name;                   /**< @brief host name if any */
   simdata_host_t simdata;       /**< @brief simulator data */
-  void *data;                   /**< @brief user data */
 } s_m_host_t;
 
 /** @brief Host datatype  
index c263080..5814f78 100644 (file)
@@ -43,7 +43,7 @@ void MSG_create_environment(const char *file)
   /* Initialize MSG hosts */
   xbt_lib_foreach(host_lib, cursor, name, data) {
     if(data[SIMIX_HOST_LEVEL])
-      __MSG_host_create((smx_host_t)data[SIMIX_HOST_LEVEL], NULL);
+      __MSG_host_create((smx_host_t)data[SIMIX_HOST_LEVEL]);
   }
 }
 
index ce32fdf..02a3375 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 /********************************* Host **************************************/
-m_host_t __MSG_host_create(smx_host_t workstation, void *data)
+m_host_t __MSG_host_create(smx_host_t workstation)
 {
   const char *name;
   simdata_host_t simdata = xbt_new0(s_simdata_host_t, 1);
@@ -33,7 +33,6 @@ m_host_t __MSG_host_create(smx_host_t workstation, void *data)
   /* Host structure */
   host->name = xbt_strdup(name);
   host->simdata = simdata;
-  host->data = data;
 
   simdata->smx_host = workstation;
 
@@ -87,11 +86,7 @@ m_host_t MSG_get_host_by_name(const char *name)
  */
 MSG_error_t MSG_host_set_data(m_host_t host, void *data)
 {
-  xbt_assert((host != NULL), "Invalid parameters");
-  xbt_assert((host->data == NULL), "Data already set");
-
-  /* Assign data */
-  host->data = data;
+  SIMIX_host_set_data(host->simdata->smx_host,data);
 
   return MSG_OK;
 }
@@ -106,10 +101,7 @@ MSG_error_t MSG_host_set_data(m_host_t host, void *data)
 void *MSG_host_get_data(m_host_t host)
 {
 
-  xbt_assert((host != NULL), "Invalid parameters");
-
-  /* Return data */
-  return (host->data);
+  return SIMIX_host_get_data(host->simdata->smx_host);
 }
 
 /** \ingroup m_host_management
index b177298..9c8fa72 100644 (file)
@@ -125,7 +125,7 @@ XBT_PUBLIC_DATA(MSG_Global_t) msg_global;
 #  define MSG_RETURN(val) return(val)
 #endif
 
-m_host_t __MSG_host_create(smx_host_t workstation, void *data);
+m_host_t __MSG_host_create(smx_host_t workstation);
 void __MSG_host_destroy(m_host_t host);
 
 void __MSG_display_process_status(void);