Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change key name to prevent reuse + indent (this example raised an issue
[simgrid.git] / teshsuite / msg / storage / storage_basic.c
index 38e07ee..b56ea02 100644 (file)
@@ -17,6 +17,7 @@ sg_size_t read_local_file(const char *src);
 void dump_storage_by_name(char *name);
 void display_storage_content(msg_storage_t storage);
 void get_set_storage_data(const char *storage_name);
+void dump_platform_storages(void);
 int client(int argc, char *argv[]);
 int server(int argc, char *argv[]);
 
@@ -36,13 +37,14 @@ void storage_info(msg_host_t host)
   {
     XBT_INFO("\tStorage name: %s, mount name: %s", storage_name, mount_name);
 
-    sg_size_t free_size = MSG_storage_get_free_size(mount_name);
-    sg_size_t used_size = MSG_storage_get_used_size(mount_name);
+    storage = MSG_storage_get_by_name(storage_name);
+
+    sg_size_t free_size = MSG_storage_get_free_size(storage);
+    sg_size_t used_size = MSG_storage_get_used_size(storage);
 
     XBT_INFO("\t\tFree size: %llu bytes", free_size);
     XBT_INFO("\t\tUsed size: %llu bytes", used_size);
 
-    storage = MSG_storage_get_by_name(storage_name);
     display_storage_properties(storage);
     dump_storage_by_name(storage_name);
   }
@@ -138,6 +140,17 @@ void get_set_storage_data(const char *storage_name){
   xbt_free(data);
 }
 
+void dump_platform_storages(void){
+  unsigned int cursor;
+  xbt_dynar_t storages = MSG_storages_as_dynar();
+  msg_storage_t storage;
+  xbt_dynar_foreach(storages, cursor, storage){
+    XBT_INFO("Storage %s is attached to %s", MSG_storage_get_name(storage), MSG_storage_get_host(storage));
+    MSG_storage_set_property_value(storage, "other usage", xbt_strdup("gpfs"), xbt_free);
+  }
+  xbt_dynar_free(&storages);
+}
+
 int client(int argc, char *argv[])
 {
   hsm_put("server","/sd1/doc/simgrid/examples/cxx/autoDestination/FinalizeTask.cxx","/sd2/scratch/toto.cxx");
@@ -176,13 +189,14 @@ int server(int argc, char *argv[])
       char *dest = MSG_task_get_data(to_execute);
       sg_size_t size_to_write = (sg_size_t)MSG_task_get_data_size(to_execute);
       write_local_file(dest, size_to_write);
-       }
+    }
 
     MSG_task_destroy(to_execute);
     to_execute = NULL;
   }
 
   storage_info(MSG_host_self());
+  dump_platform_storages();
   return 1;
 }