static void get_set_storage_data(const char *storage_name){ XBT_INFO("*** GET/SET DATA for storage element: %s ***",storage_name); msg_storage_t storage = MSG_storage_get_by_name(storage_name); char *data = MSG_storage_get_data(storage); XBT_INFO("Get data: '%s'", data); MSG_storage_set_data(storage, xbt_strdup("Some data")); data = MSG_storage_get_data(storage); XBT_INFO("\tSet and get data: '%s'", data); xbt_free(data); }
XBT_INFO("*** Move '/tmp/data.txt' into '/tmp/simgrid.readme'"); MSG_file_move(file, "/home/tmp/simgrid.readme"); /* - Attach some user data to the file */ MSG_file_set_data(file, xbt_strdup("777")); /* - Then retrieve this data */ char *data = MSG_file_get_data(file); XBT_INFO("User data attached to the file: %s", data); MSG_file_close(file); free(file_name); /* - Attach some user data to disk1 */ XBT_INFO("*** Get/set data for storage element: %s ***",storage_name); data = MSG_storage_get_data(storage); XBT_INFO("Get storage data: '%s'", data); MSG_storage_set_data(storage, xbt_strdup("Some user data")); data = MSG_storage_get_data(storage); XBT_INFO("Set and get data: '%s'", data); xbt_free(data); xbt_free(storage_name); /* - Finally dump disks contents */ XBT_INFO("*** Dump content of %s ***",MSG_host_get_name(MSG_host_self())); xbt_dict_t contents = NULL; contents = MSG_host_get_storage_content(MSG_host_self()); // contents is a dict of dicts xbt_dict_cursor_t curs, curs2 = NULL; char* mountname;