Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MSG_host_get_attached_storage_list and SD_workstation_get_attached_storage_list bug fix
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Mon, 10 Mar 2014 10:46:33 +0000 (11:46 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Mon, 10 Mar 2014 10:46:33 +0000 (11:46 +0100)
16 files changed:
include/msg/msg.h
include/simdag/simdag.h
include/simgrid/simix.h
src/include/surf/surf.h
src/msg/msg_host.c
src/simdag/sd_workstation.c
src/simix/simcalls.in
src/simix/simcalls_generated_body.c
src/simix/simcalls_generated_res_getter_setter.h
src/simix/smx_host.c
src/simix/smx_host_private.h
src/simix/smx_user.c
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
src/surf/workstation_interface.cpp
src/surf/workstation_interface.hpp

index e47696d..1c19a5c 100644 (file)
@@ -155,7 +155,7 @@ XBT_PUBLIC(int) MSG_get_host_number(void);
 XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params);
 XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params);
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
 XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params);
 XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params);
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_attached_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
 /************************** Process handling *********************************/
 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
 /************************** Process handling *********************************/
 XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
index 73c349c..7bccbbb 100644 (file)
@@ -107,7 +107,7 @@ XBT_PUBLIC(SD_task_t) SD_workstation_get_current_task(SD_workstation_t
                                                       workstation);
 XBT_PUBLIC(xbt_dict_t)
     SD_workstation_get_mounted_storage_list(SD_workstation_t workstation);
                                                       workstation);
 XBT_PUBLIC(xbt_dict_t)
     SD_workstation_get_mounted_storage_list(SD_workstation_t workstation);
-XBT_PUBLIC(xbt_dict_t)
+XBT_PUBLIC(xbt_dynar_t)
     SD_workstation_get_attached_storage_list(SD_workstation_t workstation);
 /** @} */
 
     SD_workstation_get_attached_storage_list(SD_workstation_t workstation);
 /** @} */
 
index b426984..c63d21b 100644 (file)
@@ -332,7 +332,7 @@ XBT_PUBLIC(void) simcall_host_execution_set_bound(smx_action_t execution, double
 XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_action_t execution, smx_host_t host, unsigned long mask);
 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
 XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(smx_host_t host);
 XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_action_t execution, smx_host_t host, unsigned long mask);
 XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
 XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(smx_host_t host);
-XBT_PUBLIC(xbt_dict_t) simcall_host_get_attached_storage_list(smx_host_t host);
+XBT_PUBLIC(xbt_dynar_t) simcall_host_get_attached_storage_list(smx_host_t host);
 XBT_PUBLIC(void) simcall_host_get_params(smx_host_t vm, ws_params_t param);
 XBT_PUBLIC(void) simcall_host_set_params(smx_host_t vm, ws_params_t param);
 
 XBT_PUBLIC(void) simcall_host_get_params(smx_host_t vm, ws_params_t param);
 XBT_PUBLIC(void) simcall_host_set_params(smx_host_t vm, ws_params_t param);
 
index 083373d..1ec1f94 100644 (file)
@@ -653,7 +653,7 @@ XBT_PUBLIC(xbt_dict_t) surf_workstation_get_mounted_storage_list(surf_resource_t
  * @param workstation The surf workstation
  * @return Dictionary of storage
  */
  * @param workstation The surf workstation
  * @return Dictionary of storage
  */
-XBT_PUBLIC(xbt_dict_t) surf_workstation_get_attached_storage_list(surf_resource_t workstation);
+XBT_PUBLIC(xbt_dynar_t) surf_workstation_get_attached_storage_list(surf_resource_t workstation);
 
 /**
  * @brief Unlink a file descriptor
 
 /**
  * @brief Unlink a file descriptor
index 57fd96c..65fc9b6 100644 (file)
@@ -413,7 +413,7 @@ xbt_dict_t MSG_host_get_mounted_storage_list(msg_host_t host)
  * \param host a host
  * \return a dict containing all storages attached to the host (storage name => msg_storage_t)
  */
  * \param host a host
  * \return a dict containing all storages attached to the host (storage name => msg_storage_t)
  */
-xbt_dict_t MSG_host_get_attached_storage_list(msg_host_t host)
+xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters");
   return (simcall_host_get_attached_storage_list(host));
 {
   xbt_assert((host != NULL), "Invalid parameters");
   return (simcall_host_get_attached_storage_list(host));
index 87e3088..4c7aa38 100644 (file)
@@ -486,7 +486,7 @@ xbt_dict_t SD_workstation_get_mounted_storage_list(SD_workstation_t workstation)
  * \param workstation a workstation
  * \return a dynar containing all mounted storages on the workstation
  */
  * \param workstation a workstation
  * \return a dynar containing all mounted storages on the workstation
  */
-xbt_dict_t SD_workstation_get_attached_storage_list(SD_workstation_t workstation){
+xbt_dynar_t SD_workstation_get_attached_storage_list(SD_workstation_t workstation){
   return surf_workstation_get_attached_storage_list(workstation);
 }
 
   return surf_workstation_get_attached_storage_list(workstation);
 }
 
index f0e3d62..8328b47 100644 (file)
@@ -31,7 +31,7 @@ host_execution_set_bound True (void) (execution, void*, smx_action_t) (bound, do
 host_execution_set_affinity True (void) (execution, void*, smx_action_t) (ws, void*, smx_host_t) (mask, unsigned long)
 host_execution_wait False (int) (execution, void*, smx_action_t)
 host_get_mounted_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t)
 host_execution_set_affinity True (void) (execution, void*, smx_action_t) (ws, void*, smx_host_t) (mask, unsigned long)
 host_execution_wait False (int) (execution, void*, smx_action_t)
 host_get_mounted_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t)
-host_get_attached_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t)
+host_get_attached_storage_list True (void*, xbt_dynar_t) (host, void*, smx_host_t)
 host_get_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
 host_set_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
 vm_create True (void*) (name, const char*) (ind_pm, void*, smx_host_t)
 host_get_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
 host_set_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
 vm_create True (void*) (name, const char*) (ind_pm, void*, smx_host_t)
index fb935f2..8b98b8e 100644 (file)
     }    
     return self->simcall.result.dp;
   }
     }    
     return self->simcall.result.dp;
   }
-  inline static xbt_dict_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) {
+  inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) {
     smx_process_t self = SIMIX_process_self();
     self->simcall.call = SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     smx_process_t self = SIMIX_process_self();
     self->simcall.call = SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
index bff3f1f..bcee194 100644 (file)
@@ -129,8 +129,8 @@ static inline xbt_dict_t simcall_host_get_mounted_storage_list__get__result(smx_
 static inline void simcall_host_get_mounted_storage_list__set__result(smx_simcall_t simcall, void* result){
     simcall->result.dp = result;
 }
 static inline void simcall_host_get_mounted_storage_list__set__result(smx_simcall_t simcall, void* result){
     simcall->result.dp = result;
 }
-static inline xbt_dict_t simcall_host_get_attached_storage_list__get__result(smx_simcall_t simcall){
-  return (xbt_dict_t) simcall->result.dp;
+static inline xbt_dynar_t simcall_host_get_attached_storage_list__get__result(smx_simcall_t simcall){
+  return (xbt_dynar_t) simcall->result.dp;
 }
 static inline void simcall_host_get_attached_storage_list__set__result(smx_simcall_t simcall, void* result){
     simcall->result.dp = result;
 }
 static inline void simcall_host_get_attached_storage_list__set__result(smx_simcall_t simcall, void* result){
     simcall->result.dp = result;
index 4ceb168..40f3c73 100644 (file)
@@ -759,11 +759,11 @@ xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host){
   return surf_workstation_get_mounted_storage_list(host);
 }
 
   return surf_workstation_get_mounted_storage_list(host);
 }
 
-xbt_dict_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t simcall, smx_host_t host){
+xbt_dynar_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t simcall, smx_host_t host){
   return SIMIX_host_get_attached_storage_list(host);
 }
 
   return SIMIX_host_get_attached_storage_list(host);
 }
 
-xbt_dict_t SIMIX_host_get_attached_storage_list(smx_host_t host){
+xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host){
   xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
 
   return surf_workstation_get_attached_storage_list(host);
   xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
 
   return surf_workstation_get_attached_storage_list(host);
index 0c8b508..2e17bcf 100644 (file)
@@ -67,7 +67,7 @@ void SIMIX_host_execution_set_bound(smx_action_t action, double bound);
 void SIMIX_host_execution_set_affinity(smx_action_t action, smx_host_t host, unsigned long mask);
 void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
 xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host);
 void SIMIX_host_execution_set_affinity(smx_action_t action, smx_host_t host, unsigned long mask);
 void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
 xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host);
-xbt_dict_t SIMIX_host_get_attached_storage_list(smx_host_t host);
+xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host);
 // pre prototypes
 smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
 const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
 // pre prototypes
 smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
 const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
@@ -102,7 +102,7 @@ void SIMIX_host_execution_resume(smx_action_t action);
 
 void SIMIX_post_host_execute(smx_action_t action);
 xbt_dict_t SIMIX_pre_host_get_mounted_storage_list(smx_simcall_t, smx_host_t);
 
 void SIMIX_post_host_execute(smx_action_t action);
 xbt_dict_t SIMIX_pre_host_get_mounted_storage_list(smx_simcall_t, smx_host_t);
-xbt_dict_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t, smx_host_t);
+xbt_dynar_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t, smx_host_t);
 #ifdef HAVE_TRACING
 void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
                            const char *category);
 #ifdef HAVE_TRACING
 void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
                            const char *category);
index dd96fa5..8feee85 100644 (file)
@@ -1446,7 +1446,7 @@ xbt_dict_t simcall_host_get_mounted_storage_list(smx_host_t host)
  * \param host A SIMIX host
  * \return a dict containing all storages attached to the host
  */
  * \param host A SIMIX host
  * \return a dict containing all storages attached to the host
  */
-xbt_dict_t simcall_host_get_attached_storage_list(smx_host_t host)
+xbt_dynar_t simcall_host_get_attached_storage_list(smx_host_t host)
 {
   return simcall_BODY_host_get_attached_storage_list(host);
 }
 {
   return simcall_BODY_host_get_attached_storage_list(host);
 }
index 51c6f43..7f8d40f 100644 (file)
@@ -356,7 +356,7 @@ xbt_dict_t surf_workstation_get_mounted_storage_list(surf_resource_t workstation
   return get_casted_workstation(workstation)->getMountedStorageList();
 }
 
   return get_casted_workstation(workstation)->getMountedStorageList();
 }
 
-xbt_dict_t surf_workstation_get_attached_storage_list(surf_resource_t workstation){
+xbt_dynar_t surf_workstation_get_attached_storage_list(surf_resource_t workstation){
   return get_casted_workstation(workstation)->getAttachedStorageList();
 }
 
   return get_casted_workstation(workstation)->getAttachedStorageList();
 }
 
index 6dd49af..0c117ab 100644 (file)
@@ -370,6 +370,11 @@ static XBT_INLINE void surf_workstation_free(void *r)
   delete static_cast<WorkstationPtr>(r);
 }
 
   delete static_cast<WorkstationPtr>(r);
 }
 
+static XBT_INLINE void surf_storage_free(void *r)
+{
+  delete static_cast<StoragePtr>(r);
+}
+
 
 void sg_version(int *ver_major,int *ver_minor,int *ver_patch) {
   *ver_major = SIMGRID_VERSION_MAJOR;
 
 void sg_version(int *ver_major,int *ver_minor,int *ver_patch) {
   *ver_major = SIMGRID_VERSION_MAJOR;
@@ -397,6 +402,7 @@ void surf_init(int *argc, char **argv)
   SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_cpu_free);
   SURF_WKS_LEVEL = xbt_lib_add_level(host_lib,surf_workstation_free);
   SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,surf_link_free);
   SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_cpu_free);
   SURF_WKS_LEVEL = xbt_lib_add_level(host_lib,surf_workstation_free);
   SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,surf_link_free);
+  SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free);
 
   xbt_init(argc, argv);
   if (!model_list)
 
   xbt_init(argc, argv);
   if (!model_list)
index 9d93ab5..71718e3 100644 (file)
@@ -184,24 +184,23 @@ xbt_dict_t Workstation::getMountedStorageList()
   return storage_list;
 }
 
   return storage_list;
 }
 
-xbt_dict_t Workstation::getAttachedStorageList()
+xbt_dynar_t Workstation::getAttachedStorageList()
 {
   xbt_lib_cursor_t cursor;
   char *key;
   void **data;
 {
   xbt_lib_cursor_t cursor;
   char *key;
   void **data;
-  xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
+  xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL);
   xbt_lib_foreach(storage_lib, cursor, key, data) {
   xbt_lib_foreach(storage_lib, cursor, key, data) {
-    if(routing_get_network_element_type(key) == SURF_STORAGE_LEVEL) {
-      xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
-      if ( (static_cast<StoragePtr>(surf_storage_resource_priv(surf_storage_resource_by_name((const char*)elm))))->p_attach == this->getName())
-         xbt_dict_set(res,(const char*)elm,xbt_lib_get_level(elm,MSG_STORAGE_LEVEL),NULL);
-    }
+         if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
+           StoragePtr storage = static_cast<StoragePtr>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
+           if(!strcmp((const char*)storage->p_attach,this->getName())){
+             xbt_dynar_push_as(result, void *,(void *)static_cast<ResourcePtr>(storage)->getName());
+           }
+         }
   }
   }
-  return res;
-
+  return result;
 }
 
 }
 
-
 ActionPtr Workstation::open(const char* mount, const char* path) {
   StoragePtr st = findStorageOnMountList(mount);
   XBT_DEBUG("OPEN on disk '%s'", st->getName());
 ActionPtr Workstation::open(const char* mount, const char* path) {
   StoragePtr st = findStorageOnMountList(mount);
   XBT_DEBUG("OPEN on disk '%s'", st->getName());
index 9368025..8adf174 100644 (file)
@@ -253,7 +253,7 @@ public:
    *
    * @return The xbt_dict_t of Storage
    */
    *
    * @return The xbt_dict_t of Storage
    */
-  virtual xbt_dict_t getAttachedStorageList();
+  virtual xbt_dynar_t getAttachedStorageList();
 
   /**
    * @brief Open a file
 
   /**
    * @brief Open a file