XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params);
XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params);
XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dict_t) MSG_host_get_attached_storage_list(msg_host_t host);
+XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host);
XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
/************************** Process handling *********************************/
XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
workstation);
XBT_PUBLIC(xbt_dict_t)
SD_workstation_get_mounted_storage_list(SD_workstation_t workstation);
-XBT_PUBLIC(xbt_dict_t)
+XBT_PUBLIC(xbt_dynar_t)
SD_workstation_get_attached_storage_list(SD_workstation_t workstation);
/** @} */
XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_action_t execution, smx_host_t host, unsigned long mask);
XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(smx_host_t host);
-XBT_PUBLIC(xbt_dict_t) simcall_host_get_attached_storage_list(smx_host_t host);
+XBT_PUBLIC(xbt_dynar_t) simcall_host_get_attached_storage_list(smx_host_t host);
XBT_PUBLIC(void) simcall_host_get_params(smx_host_t vm, ws_params_t param);
XBT_PUBLIC(void) simcall_host_set_params(smx_host_t vm, ws_params_t param);
* @param workstation The surf workstation
* @return Dictionary of storage
*/
-XBT_PUBLIC(xbt_dict_t) surf_workstation_get_attached_storage_list(surf_resource_t workstation);
+XBT_PUBLIC(xbt_dynar_t) surf_workstation_get_attached_storage_list(surf_resource_t workstation);
/**
* @brief Unlink a file descriptor
* \param host a host
* \return a dict containing all storages attached to the host (storage name => msg_storage_t)
*/
-xbt_dict_t MSG_host_get_attached_storage_list(msg_host_t host)
+xbt_dynar_t MSG_host_get_attached_storage_list(msg_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters");
return (simcall_host_get_attached_storage_list(host));
* \param workstation a workstation
* \return a dynar containing all mounted storages on the workstation
*/
-xbt_dict_t SD_workstation_get_attached_storage_list(SD_workstation_t workstation){
+xbt_dynar_t SD_workstation_get_attached_storage_list(SD_workstation_t workstation){
return surf_workstation_get_attached_storage_list(workstation);
}
host_execution_set_affinity True (void) (execution, void*, smx_action_t) (ws, void*, smx_host_t) (mask, unsigned long)
host_execution_wait False (int) (execution, void*, smx_action_t)
host_get_mounted_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t)
-host_get_attached_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t)
+host_get_attached_storage_list True (void*, xbt_dynar_t) (host, void*, smx_host_t)
host_get_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
host_set_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t)
vm_create True (void*) (name, const char*) (ind_pm, void*, smx_host_t)
}
return self->simcall.result.dp;
}
- inline static xbt_dict_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) {
+ inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) {
smx_process_t self = SIMIX_process_self();
self->simcall.call = SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST;
memset(&self->simcall.result, 0, sizeof(self->simcall.result));
static inline void simcall_host_get_mounted_storage_list__set__result(smx_simcall_t simcall, void* result){
simcall->result.dp = result;
}
-static inline xbt_dict_t simcall_host_get_attached_storage_list__get__result(smx_simcall_t simcall){
- return (xbt_dict_t) simcall->result.dp;
+static inline xbt_dynar_t simcall_host_get_attached_storage_list__get__result(smx_simcall_t simcall){
+ return (xbt_dynar_t) simcall->result.dp;
}
static inline void simcall_host_get_attached_storage_list__set__result(smx_simcall_t simcall, void* result){
simcall->result.dp = result;
return surf_workstation_get_mounted_storage_list(host);
}
-xbt_dict_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t simcall, smx_host_t host){
+xbt_dynar_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t simcall, smx_host_t host){
return SIMIX_host_get_attached_storage_list(host);
}
-xbt_dict_t SIMIX_host_get_attached_storage_list(smx_host_t host){
+xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host){
xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
return surf_workstation_get_attached_storage_list(host);
void SIMIX_host_execution_set_affinity(smx_action_t action, smx_host_t host, unsigned long mask);
void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action);
xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host);
-xbt_dict_t SIMIX_host_get_attached_storage_list(smx_host_t host);
+xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host);
// pre prototypes
smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*);
const char* SIMIX_pre_host_self_get_name(smx_simcall_t);
void SIMIX_post_host_execute(smx_action_t action);
xbt_dict_t SIMIX_pre_host_get_mounted_storage_list(smx_simcall_t, smx_host_t);
-xbt_dict_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t, smx_host_t);
+xbt_dynar_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t, smx_host_t);
#ifdef HAVE_TRACING
void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action,
const char *category);
* \param host A SIMIX host
* \return a dict containing all storages attached to the host
*/
-xbt_dict_t simcall_host_get_attached_storage_list(smx_host_t host)
+xbt_dynar_t simcall_host_get_attached_storage_list(smx_host_t host)
{
return simcall_BODY_host_get_attached_storage_list(host);
}
return get_casted_workstation(workstation)->getMountedStorageList();
}
-xbt_dict_t surf_workstation_get_attached_storage_list(surf_resource_t workstation){
+xbt_dynar_t surf_workstation_get_attached_storage_list(surf_resource_t workstation){
return get_casted_workstation(workstation)->getAttachedStorageList();
}
delete static_cast<WorkstationPtr>(r);
}
+static XBT_INLINE void surf_storage_free(void *r)
+{
+ delete static_cast<StoragePtr>(r);
+}
+
void sg_version(int *ver_major,int *ver_minor,int *ver_patch) {
*ver_major = SIMGRID_VERSION_MAJOR;
SURF_CPU_LEVEL = xbt_lib_add_level(host_lib,surf_cpu_free);
SURF_WKS_LEVEL = xbt_lib_add_level(host_lib,surf_workstation_free);
SURF_LINK_LEVEL = xbt_lib_add_level(link_lib,surf_link_free);
+ SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free);
xbt_init(argc, argv);
if (!model_list)
return storage_list;
}
-xbt_dict_t Workstation::getAttachedStorageList()
+xbt_dynar_t Workstation::getAttachedStorageList()
{
xbt_lib_cursor_t cursor;
char *key;
void **data;
- xbt_dict_t res = xbt_dict_new_homogeneous(NULL);
+ xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL);
xbt_lib_foreach(storage_lib, cursor, key, data) {
- if(routing_get_network_element_type(key) == SURF_STORAGE_LEVEL) {
- xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
- if ( (static_cast<StoragePtr>(surf_storage_resource_priv(surf_storage_resource_by_name((const char*)elm))))->p_attach == this->getName())
- xbt_dict_set(res,(const char*)elm,xbt_lib_get_level(elm,MSG_STORAGE_LEVEL),NULL);
- }
+ if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
+ StoragePtr storage = static_cast<StoragePtr>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
+ if(!strcmp((const char*)storage->p_attach,this->getName())){
+ xbt_dynar_push_as(result, void *,(void *)static_cast<ResourcePtr>(storage)->getName());
+ }
+ }
}
- return res;
-
+ return result;
}
-
ActionPtr Workstation::open(const char* mount, const char* path) {
StoragePtr st = findStorageOnMountList(mount);
XBT_DEBUG("OPEN on disk '%s'", st->getName());
*
* @return The xbt_dict_t of Storage
*/
- virtual xbt_dict_t getAttachedStorageList();
+ virtual xbt_dynar_t getAttachedStorageList();
/**
* @brief Open a file