- const char* host_name = MSG_host_get_name(host);
- XBT_INFO("*** Storage info on %s ***", host_name);
-
- xbt_dict_cursor_t cursor = NULL;
- char* mount_name;
- char* storage_name;
- msg_storage_t storage;
-
- xbt_dict_t storage_list = MSG_host_get_mounted_storage_list(host);
-
- xbt_dict_foreach(storage_list,cursor,mount_name,storage_name)
- {
- XBT_INFO("\tStorage name: %s, mount name: %s", storage_name, 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);
-
- display_storage_properties(storage);
- dump_storage_by_name(storage_name);
- }
- xbt_dict_free(&storage_list);
-}
-
-void display_storage_properties(msg_storage_t storage){
- xbt_dict_cursor_t cursor = NULL;
- char *key, *data;
- xbt_dict_t props = MSG_storage_get_properties(storage);
- if (xbt_dict_length(props) > 0){
- XBT_INFO("\tProperties of mounted storage: %s", MSG_storage_get_name(storage));
- xbt_dict_foreach(props, cursor, key, data)
- XBT_INFO("\t\t'%s' -> '%s'", key, data);
- }else{
- XBT_INFO("\tNo property attached.");
- }
+ char name[2048];
+ int id = MSG_process_self_PID();
+ sprintf(name,"%s%i", FILENAME1, id);
+ msg_file_t file = MSG_file_open(name, NULL);
+ XBT_INFO("process %d is writing!", id);
+ MSG_file_write(file, 3000000);
+ XBT_INFO("process %d goes to sleep for %d seconds", id, id);
+ MSG_process_sleep(id);
+ XBT_INFO("process %d is writing again!", id);
+ MSG_file_write(file, 3000000);
+ XBT_INFO("process %d goes to sleep for %d seconds", id, 6 - id);
+ MSG_process_sleep(6-id);
+ XBT_INFO("process %d is reading!", id);
+ MSG_file_seek(file, 0, SEEK_SET);
+ MSG_file_read(file, 3000000);
+ XBT_INFO("process %d goes to sleep for %d seconds", id, id);
+ MSG_process_sleep(id);
+ XBT_INFO("process %d is reading again!", id);
+ MSG_file_seek(file, 0, SEEK_SET);
+ MSG_file_read(file, 3000000);
+
+ XBT_INFO("process %d => Size of %s: %llu", id, MSG_file_get_name(file), MSG_file_get_size(file));
+ MSG_file_close(file);
+
+ return 0;