XBT_PUBLIC(msg_storage_t) MSG_storage_get_by_name(const char *name);
XBT_PUBLIC(xbt_dict_t) MSG_storage_get_properties(msg_storage_t storage);
XBT_PUBLIC(xbt_dynar_t) MSG_storages_as_dynar(void);
-
/************************** AS Router handling ************************************/
XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name);
XBT_PUBLIC(xbt_dict_t) MSG_as_router_get_properties(const char* asr);
/***************************** Storage **********************************/
XBT_PUBLIC(size_t) simcall_storage_get_free_size (const char* name);
XBT_PUBLIC(size_t) simcall_storage_get_used_size (const char* name);
+XBT_PUBLIC(xbt_dict_t) simcall_storage_get_properties(smx_storage_t storage);
/************************** AS router **********************************/
XBT_PUBLIC(xbt_dict_t) SIMIX_asr_get_properties(const char *name);
surf_action_t(*write) (void *storage, size_t size, surf_file_t fd);
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 *resource);
} s_surf_model_extension_storage_t;
/** \ingroup SURF_models
*/
XBT_PUBLIC_DATA(s_surf_model_description_t) surf_storage_model_description[];
+XBT_PUBLIC_DATA(surf_model_t) surf_storage_model;
+
/** \ingroup SURF_models
* \brief The workstation model
*
file->info = xbt_new0(s_file_info_t,1);
file->simdata->smx_file = simcall_file_open(mount, fullname);
SIMIX_file_set_data(file->simdata->smx_file, data);
-
return file;
}
/********************************* Storage **************************************/
+/** @addtogroup msg_storage_management
+ * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Storages" --> \endhtmlonly
+ * (#msg_storage_t) and the functions for managing it.
+ *
+ */
+
/** \ingroup msg_storage_management
- * \brief Return the free space size of a storage element
+ * \brief Returns the free space size of a storage element
* \param the storage name (#char*)
* \return the free space size of the storage element (as a size_t)
*/
}
/** \ingroup msg_storage_management
- * \brief Return the used space size of a storage element
+ * \brief Returns the used space size of a storage element
* \param the storage name (#char*)
* \return the used space size of the storage element (as a size_t)
*/
xbt_dict_t MSG_storage_get_properties(msg_storage_t storage)
{
xbt_assert((storage != NULL), "Invalid parameters (storage is NULL)");
-
- xbt_die( "Not implemented yet");
- return xbt_dict_new();
- //return (simcall_host_get_properties(storage));
+ return (simcall_storage_get_properties(storage->simdata->smx_storage));
}
/** \ingroup msg_storage_management
*/
msg_storage_t MSG_storage_get_by_name(const char *name)
{
- return (msg_storage_t) xbt_lib_get_elm_or_null(host_lib,name);
+ return (msg_storage_t) xbt_lib_get_elm_or_null(storage_lib,name);
}
/** \ingroup msg_storage_management
- * \brief Return a dynar containing all the storages declared at a given point of time
+ * \brief Returns a dynar containing all the storage elements declared at a given point of time
+ *
+ *
+ *
+ * @TODO implement a new msg_storage_t structure that hides members (use xbt_dict)
*/
xbt_dynar_t MSG_storages_as_dynar(void) {
- xbt_dynar_t storages = xbt_dynar_new(sizeof(msg_host_t), NULL);
- xbt_dynar_t hosts;
- msg_host_t host;
- unsigned int i;
-
- hosts = MSG_hosts_as_dynar();
- xbt_dynar_foreach(hosts, i, host){
- xbt_dynar_push(storages,xbt_lib_get_level((void *)host, SURF_STORAGE_LEVEL));
+ xbt_lib_cursor_t cursor;
+ char *key;
+ void **data;
+ xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),NULL);
+ msg_storage_t storage;
+ xbt_lib_foreach(storage_lib, cursor, key, data) {
+ if(routing_get_network_element_type(key) == ROUTING_STORAGE_LEVEL) {
+ xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor);
+ storage = xbt_new(s_msg_storage_t, 1);
+ storage->name = elm->key;
+ storage->simdata = xbt_new0(s_simdata_storage_t,1);
+ smx_storage_t simix_storage = xbt_lib_get_or_null(storage_lib, elm->key, SURF_STORAGE_LEVEL);
+ storage->simdata->smx_storage = simix_storage;
+ storage->data = NULL;
+ xbt_dynar_push(res, &storage);
+ }
}
- return storages;
+
+ return res;
}
return surf_workstation_model->extension.workstation.get_used_size(host,name);
}
+xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t simcall, smx_storage_t storage){
+ return SIMIX_storage_get_properties(storage);
+}
+xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage){
+ xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)");
+ return surf_storage_model->extension.storage.get_properties(storage);
+}
+
void SIMIX_post_io(smx_action_t action)
{
xbt_fifo_item_t i;
size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,const char* name);
size_t SIMIX_storage_get_used_size(smx_process_t process,const char* name);
+xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage);
+xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t, smx_storage_t);
+
void SIMIX_post_io(smx_action_t action);
void SIMIX_io_destroy(smx_action_t action);
void SIMIX_io_finish(smx_action_t action);
ACTION(SIMCALL_FILE_GET_INFO, file_get_info, WITH_ANSWER, TSPEC(result, xbt_dynar_t), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
ACTION(SIMCALL_STORAGE_GET_USED_SIZE, storage_get_used_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \
+ACTION(SIMCALL_STORAGE_GET_PROPERTIES, storage_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \
ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(name)) sep
/* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated
/**
* \ingroup simix_storage_management
- * \brief Return the free space size on a given storage element.
+ * \brief Returns the free space size on a given storage element.
* \param storage name
* \return Return the free space size on a given storage element (as size_t)
*/
/**
* \ingroup simix_storage_management
- * \brief Return the used space size on a given storage element.
+ * \brief Returns the used space size on a given storage element.
* \param storage name
* \return Return the used space size on a given storage element (as size_t)
*/
/**
* \ingroup simix_storage_management
- * \brief Return the list of storages mounted on an host.
+ * \brief Returns the list of storages mounted on an host.
* \param host A SIMIX host
* \return a dynar containing all storages mounted on the host
*/
return simcall_BODY_host_get_storage_list(host);
}
+/**
+ * \ingroup simix_storage_management
+ * \brief Returns a dict of the properties assigned to a storage element.
+ *
+ * \param storage A storage element
+ * \return The properties of this storage element
+ */
+xbt_dict_t simcall_storage_get_properties(smx_storage_t storage)
+{
+ return simcall_BODY_storage_get_properties(storage);
+}
+
#ifdef HAVE_MC
return (surf_action_t) action;
}
+static xbt_dict_t storage_get_properties(const void *storage)
+{
+ return surf_resource_properties(storage);
+}
+
static void* storage_create_resource(const char* id, const char* model,
const char* type_id, const char* content_name, const char* content_type){
storage_t storage = NULL;
storage->size = 0;
storage->write_actions = xbt_dynar_new(sizeof(char *),NULL);
+
storage_type_t storage_type = xbt_lib_get_or_null(storage_type_lib, type_id,ROUTING_STORAGE_TYPE_LEVEL);
double Bread =
surf_parse_get_bandwidth(xbt_dict_get(storage_type->properties,"Bread"));
surf_storage_model->extension.storage.write = storage_action_write;
surf_storage_model->extension.storage.ls = storage_action_ls;
+ surf_storage_model->extension.storage.get_properties = storage_get_properties;
+
if (!storage_maxmin_system) {
storage_maxmin_system = lmm_system_new(storage_selective_update);
}
sg_platf_storage_type_add_cb(storage_parse_storage_type);
sg_platf_mount_add_cb(storage_parse_mount);
}
+
size_t used_size;
char *type_id;
xbt_dynar_t write_actions;
+ xbt_dict_t properties;
} s_storage_t, *storage_t;
typedef enum {
int SURF_CPU_LEVEL; //Surf cpu level
int SURF_WKS_LEVEL; //Surf workstation level
int SIMIX_HOST_LEVEL; //Simix level
-int MSG_HOST_LEVEL; //Msg level
+int SIMIX_STORAGE_LEVEL; //Simix level
+int MSG_HOST_LEVEL; //Msg host level
int SD_HOST_LEVEL; //Simdag level
int COORD_HOST_LEVEL=0; //Coordinates level
int NS3_HOST_LEVEL; //host node for ns3