Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add "attach" attribute to storage tag in platform description
[simgrid.git] / src / surf / workstation_interface.cpp
index 1b41b0c..9d93ab5 100644 (file)
@@ -170,7 +170,7 @@ StoragePtr Workstation::findStorageOnMountList(const char* mount)
   return st;
 }
 
   return st;
 }
 
-xbt_dict_t Workstation::getStorageList()
+xbt_dict_t Workstation::getMountedStorageList()
 {
   s_mount_t mnt;
   unsigned int i;
 {
   s_mount_t mnt;
   unsigned int i;
@@ -184,6 +184,24 @@ xbt_dict_t Workstation::getStorageList()
   return storage_list;
 }
 
   return storage_list;
 }
 
+xbt_dict_t Workstation::getAttachedStorageList()
+{
+  xbt_lib_cursor_t cursor;
+  char *key;
+  void **data;
+  xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
+  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);
+    }
+  }
+  return res;
+
+}
+
+
 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());