From: Martin Quinson Date: Fri, 27 Apr 2012 20:25:31 +0000 (+0200) Subject: save one pointer per MSG host X-Git-Tag: v3_7~39 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/15732d4548158986da572035d2e53a97c618e56b?hp=dd88e15504912f111b8dcb568c2a8adbc111ed66 save one pointer per MSG host --- diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index 08a6b2626d..37d407320d 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -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 diff --git a/src/msg/msg_environment.c b/src/msg/msg_environment.c index c263080a62..5814f78189 100644 --- a/src/msg/msg_environment.c +++ b/src/msg/msg_environment.c @@ -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]); } } diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index ce32fdf887..02a3375faf 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -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 diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index b177298e02..9c8fa72c39 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -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);