Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use homogeneous dicts which are more efficient.
[simgrid.git] / src / surf / workstation.c
index 86f6619..a949716 100644 (file)
@@ -365,18 +365,20 @@ static storage_t find_storage_on_mount_list(void *workstation,const char* mount)
   return st;
 }
 
-static xbt_dynar_t ws_get_storage_list(void *workstation)
+static xbt_dict_t ws_get_storage_list(void *workstation)
 {
   s_mount_t mnt;
   unsigned int i;
-  xbt_dynar_t storage_list = xbt_dynar_new(sizeof(char*), NULL);
+  xbt_dict_t storage_list = xbt_dict_new_homogeneous(NULL);
+  char *storage_name = NULL;
 
   workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation);
   xbt_dynar_t storages = ws->storage;
 
   xbt_dynar_foreach(storages,i,mnt)
   {
-    xbt_dynar_push(storage_list, &mnt.name);
+       storage_name = ((storage_t)mnt.storage)->generic_resource.name;
+    xbt_dict_set(storage_list,mnt.name,storage_name,NULL);
   }
   return storage_list;
 }
@@ -398,7 +400,7 @@ static surf_action_t ws_action_close(void *workstation, surf_file_t fd)
   return model->extension.storage.close(st, fd);
 }
 
-static surf_action_t ws_action_read(void *workstation, size_t size,
+static surf_action_t ws_action_read(void *workstation, sg_storage_size_t size,
                                     surf_file_t fd)
 {
   storage_t st = find_storage_on_mount_list(workstation, fd->mount);
@@ -407,7 +409,7 @@ static surf_action_t ws_action_read(void *workstation, size_t size,
   return model->extension.storage.read(st, size, fd);
 }
 
-static surf_action_t ws_action_write(void *workstation, size_t size, 
+static surf_action_t ws_action_write(void *workstation, sg_storage_size_t size,
                                      surf_file_t fd)
 {
   storage_t st = find_storage_on_mount_list(workstation, fd->mount);
@@ -454,7 +456,7 @@ static surf_action_t ws_action_ls(void *workstation, const char* mount,
   return model->extension.storage.ls(st, path);
 }
 
-static size_t ws_file_get_size(void *workstation, surf_file_t fd)
+static sg_storage_size_t ws_file_get_size(void *workstation, surf_file_t fd)
 {
   return fd->size;
 }
@@ -472,13 +474,13 @@ static xbt_dynar_t ws_file_get_info(void *workstation, surf_file_t fd)
   return info;
 }
 
-static size_t ws_storage_get_free_size(void *workstation,const char* name)
+static sg_storage_size_t ws_storage_get_free_size(void *workstation,const char* name)
 {
   storage_t st = find_storage_on_mount_list(workstation, name);
   return st->size - st->used_size;
 }
 
-static size_t ws_storage_get_used_size(void *workstation,const char* name)
+static sg_storage_size_t ws_storage_get_used_size(void *workstation,const char* name)
 {
   storage_t st = find_storage_on_mount_list(workstation, name);
   return st->used_size;