XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
XBT_PUBLIC(int) MSG_get_host_number(void);
XBT_PUBLIC(xbt_dynar_t) MSG_host_get_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) MSG_host_get_storage_content(msg_host_t host);
/************************** Process handling *********************************/
XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
xbt_main_func_t code,
return storage->key;
}
-
-
/*
* Platform creation functions. Instead of passing 123 arguments to the creation functions
* (one for each possible XML attribute), we pass structures containing them all. It removes the
XBT_PUBLIC(void*) SIMIX_host_get_data(smx_host_t host);
XBT_PUBLIC(void) SIMIX_host_set_data(smx_host_t host, void *data);
XBT_PUBLIC(xbt_dynar_t) SIMIX_host_get_storage_list(smx_host_t host);
-XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_host_t host);
-
/********************************* Process ************************************/
XBT_PUBLIC(int) SIMIX_process_count(void);
XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
XBT_PUBLIC(void*) SIMIX_storage_get_data(smx_storage_t storage);
XBT_PUBLIC(void) SIMIX_storage_set_data(smx_storage_t storage, void *data);
XBT_PUBLIC(xbt_dict_t) SIMIX_storage_get_content(smx_storage_t storage);
-
+XBT_PUBLIC(const char*) SIMIX_storage_get_name(smx_host_t host);
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
/************************** AS router simcalls ***************************/
surf_action_t(*stat) (void *storage, surf_file_t fd);
surf_action_t(*ls) (void *storage, const char *path);
xbt_dict_t(*get_properties) (const void *storage);
- xbt_dict_t(*get_content) (void *storage);
+ xbt_dict_t(*get_content) (const void *storage);
} s_surf_model_extension_storage_t;
/** \ingroup SURF_models
/** \ingroup m_host_management
* \brief Return the list of mounted storages on an host.
* \param host a host
- * \return a dynar containing all mounted storages on the host
+ * \return a dynar containing all storages mounted on the host
*/
xbt_dynar_t MSG_host_get_storage_list(msg_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters");
return (simcall_host_get_storage_list(host));
}
+
+/** \ingroup msg_host_management
+ * \brief Return the content of mounted storages on an host.
+ * \param host a host
+ * \return a dynar containing content (as a dict) of all storages mounted on the host
+ */
+xbt_dynar_t MSG_host_get_storage_content(msg_host_t host)
+{
+ xbt_assert((host != NULL), "Invalid parameters");
+ xbt_dynar_t contents = xbt_dynar_new(sizeof(void *),NULL);
+ msg_storage_t storage;
+ char* storage_name;
+ unsigned int i;
+ xbt_dynar_t storage_list = simcall_host_get_storage_list(host);
+ xbt_dynar_foreach(storage_list, i, storage_name){
+ storage = xbt_lib_get_elm_or_null(storage_lib,storage_name);
+// xbt_dict_t content = SIMIX_storage_get_content(storage);
+// xbt_dynar_push(contents, &content);
+ }
+ return contents;
+}
msg_storage_t __MSG_storage_create(smx_storage_t storage)
{
const char *name = SIMIX_storage_get_name(storage);
- xbt_lib_set(storage_lib,name,MSG_HOST_LEVEL,storage);
+ xbt_lib_set(storage_lib,name,MSG_STORAGE_LEVEL,storage);
return xbt_lib_get_elm_or_null(storage_lib, name);
}
* This functions checks whether a storage is a valid pointer or not and return its name.
*/
const char *MSG_storage_get_name(msg_storage_t storage) {
+ xbt_assert((storage != NULL), "Invalid parameters");
return SIMIX_storage_get_name(storage);
}
*/
msg_storage_t MSG_storage_get_by_name(const char *name)
{
- return (msg_storage_t) xbt_lib_get_elm_or_null(storage_lib,name);
+ return (msg_storage_t) xbt_lib_get_or_null(storage_lib,name, MSG_STORAGE_LEVEL);
}
/** \ingroup msg_storage_management
* \brief Returns the content (file list) of a #msg_storage_t.
* \param storage a storage
*/
-xbt_dict_t MSG_storage_get_content(msg_storage_t storage){
-
+xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
+{
return SIMIX_storage_get_content(storage);
}
* \param storage the SURF storage to encapsulate
* \param data some user data (may be NULL)
*/
-smx_host_t SIMIX_storage_create(const char *name, void *storage, void *data)
+smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data)
{
smx_storage_priv_t smx_storage = xbt_new0(s_smx_storage_priv_t, 1);
return surf_storage_model->extension.storage.get_properties(storage);
}
+const char* SIMIX_pre_storage_get_name(smx_simcall_t simcall, smx_storage_t storage){
+ return SIMIX_storage_get_name(storage);
+}
+
const char* SIMIX_storage_get_name(smx_storage_t storage){
xbt_assert((storage != NULL), "Invalid parameters");
-
return sg_storage_name(storage);
}
xbt_dict_t SIMIX_pre_storage_get_content(smx_simcall_t simcall, smx_storage_t storage);
xbt_dict_t SIMIX_storage_get_content(smx_storage_t storage);
+const char* SIMIX_pre_storage_get_name(smx_simcall_t simcall, smx_storage_t storage);
+
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
void SIMIX_io_finish(smx_action_t action);
return surf_resource_properties(surf_storage_resource_priv(storage));
}
-static xbt_dict_t storage_get_content(void *storage)
+static xbt_dict_t storage_get_content(const void *storage)
{
/* For the moment this action has no cost, but in the future we could take in account access latency of the disk */
/* surf_action_t action = storage_action_execute(storage,0, LS); */
xbt_dict_t content_dict = xbt_dict_new();
-
xbt_dict_cursor_t cursor = NULL;
char *file;
size_t size;
- xbt_dict_foreach(((storage_t)storage)->content,cursor,file,size)
+ xbt_dict_foreach(((storage_t)storage)->content, cursor, file, size){
xbt_dict_set(content_dict,file,&size,NULL);
-
+ }
return content_dict;
}
lmm_constraint_t constraint; /* Constraint for maximum bandwidth from connection */
lmm_constraint_t constraint_write; /* Constraint for maximum write bandwidth*/
lmm_constraint_t constraint_read; /* Constraint for maximum write bandwidth*/
- xbt_dict_t content; /* char * -> s_surf_file_t */
+ xbt_dict_t content;
char* content_type;
size_t size;
size_t used_size;