From: Pierre Veyre Date: Wed, 14 Aug 2013 07:31:29 +0000 (+0200) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid X-Git-Tag: v3_9_90~128 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ee52f84fe512219acf534c4d4654c3df56659e91?hp=ca56c046667fe56766ea8d522fd87cf2c23df4a4 Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid --- diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index c0baaf3a82..c844ad10af 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -128,12 +128,8 @@ typedef struct msg_file *msg_file_t; typedef struct simdata_storage *simdata_storage_t; typedef struct msg_storage { - char *model; - char *content_type; - char *type_id; - size_t size; - xbt_dict_t properties; - simdata_storage_t simdata; /**< @brief simulator data */ + char *name; + simdata_storage_t simdata; /**< @brief simulator data */ void *data; /**< @brief user data */ } s_msg_storage_t; diff --git a/include/msg/msg.h b/include/msg/msg.h index c118a7501f..4a95329176 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -94,6 +94,8 @@ XBT_PUBLIC(void) __MSG_file_get_info(msg_file_t fd); /************************** Storage handling ***********************************/ XBT_PUBLIC(size_t) MSG_storage_get_free_size(const char* name); XBT_PUBLIC(size_t) MSG_storage_get_used_size(const char* name); +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); /************************** AS Router handling ************************************/ XBT_PUBLIC(const char *) MSG_as_router_get_property_value(const char* asr, const char *name); diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 5132e7b45f..34bf54fa6c 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -179,6 +179,8 @@ xbt_dict_t MSG_file_ls(const char *mount, const char *path) return simcall_file_ls(mount, path); } +/********************************* Storage **************************************/ + /** \ingroup msg_storage_management * \brief Return the free space size of a storage element * \param the storage name (#char*) @@ -196,3 +198,45 @@ size_t MSG_storage_get_free_size(const char* name){ size_t MSG_storage_get_used_size(const char* name){ return simcall_storage_get_used_size(name); } + +/** \ingroup msg_storage_management + * \brief Returns a xbt_dict_t consisting of the list of properties assigned to this storage + * \param storage a storage + * \return a dict containing the properties + */ +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)); +} + +/** \ingroup msg_storage_management + * \brief Finds a msg_storage_t using its name. + * \param name the name of a storage. + * \return the corresponding storage + */ +msg_storage_t MSG_storage_get_by_name(const char *name) +{ + return (msg_storage_t) xbt_lib_get_elm_or_null(host_lib,name); +} + +/** \ingroup msg_storage_management + * \brief Return a dynar containing all the storages declared at a given point of time + */ +xbt_dynar_t MSG_storages_as_dynar(void) { + xbt_lib_cursor_t cursor; + char *key; + void **data; + xbt_dynar_t res = xbt_dynar_new(sizeof(msg_storage_t),NULL); + + xbt_lib_foreach(host_lib, cursor, key, data) { + if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST) { + xbt_dictelm_t elm = xbt_dict_cursor_get_elm(cursor); + xbt_dynar_push(res, &elm); + } + } + return res; +} diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 30ee757f9f..0c02e5e001 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1289,7 +1289,7 @@ size_t simcall_storage_get_used_size (const char* name){ } /** - * \ingroup simix_host_management + * \ingroup simix_storage_management * \brief Return the list of storages mounted on an host. * \param host A SIMIX host * \return a dynar containing all storages mounted on the host