X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/26f60d943e887977ea88e6ef97d7c1dd47acda1c..4078fd06852ccf32fff89e3c7a8774fe41727240:/src/msg/msg_io.c?ds=sidebyside diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 3b77073b5d..5ddba3db34 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -187,13 +187,15 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) */ msg_file_t MSG_file_open(const char* fullpath, void* data) { + char name[2048]; msg_file_priv_t priv = xbt_new(s_msg_file_priv_t, 1); priv->data = data; priv->fullpath = xbt_strdup(fullpath); priv->simdata = xbt_new0(s_simdata_file_t,1); priv->simdata->smx_file = simcall_file_open(fullpath, MSG_host_self()); - xbt_lib_set(file_lib, fullpath, MSG_FILE_LEVEL, priv); - msg_file_t fd = (msg_file_t) xbt_lib_get_elm_or_null(file_lib, fullpath); + sprintf(name, "%s:%s",MSG_host_get_name(MSG_host_self()),fullpath); + xbt_lib_set(file_lib, name, MSG_FILE_LEVEL, priv); + msg_file_t fd = (msg_file_t) xbt_lib_get_elm_or_null(file_lib, name); __MSG_file_get_info(fd); return fd; @@ -216,9 +218,11 @@ void __MSG_file_priv_free(msg_file_priv_t priv) */ int MSG_file_close(msg_file_t fd) { + char name[2048]; msg_file_priv_t priv = MSG_file_priv(fd); int res = simcall_file_close(priv->simdata->smx_file, MSG_host_self()); - xbt_lib_unset(file_lib, priv->fullpath, MSG_FILE_LEVEL, 1); + sprintf(name, "%s:%s",MSG_host_get_name(MSG_host_self()),priv->fullpath); + xbt_lib_unset(file_lib, name, MSG_FILE_LEVEL, 1); return res; } @@ -322,7 +326,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa /* Find the real host destination where the file will be physically stored */ xbt_dict_cursor_t cursor = NULL; char *mount_name, *storage_name, *file_mount_name, *host_name_dest; - msg_storage_t storage_dest; + msg_storage_t storage_dest = NULL; msg_host_t host_dest; size_t longest_prefix_length = 0; @@ -443,20 +447,20 @@ const char *MSG_storage_get_name(msg_storage_t storage) { /** \ingroup msg_storage_management * \brief Returns the free space size of a storage element - * \param name the name of a storage + * \param storage a storage * \return the free space size of the storage element (as a #sg_size_t) */ -sg_size_t MSG_storage_get_free_size(const char* name){ - return simcall_storage_get_free_size(name); +sg_size_t MSG_storage_get_free_size(msg_storage_t storage){ + return simcall_storage_get_free_size(storage); } /** \ingroup msg_storage_management * \brief Returns the used space size of a storage element - * \param name the name of a storage + * \param storage a storage * \return the used space size of the storage element (as a #sg_size_t) */ -sg_size_t MSG_storage_get_used_size(const char* name){ - return simcall_storage_get_used_size(name); +sg_size_t MSG_storage_get_used_size(msg_storage_t storage){ + return simcall_storage_get_used_size(storage); } /** \ingroup msg_storage_management @@ -550,6 +554,12 @@ xbt_dict_t MSG_storage_get_content(msg_storage_t storage) return SIMIX_storage_get_content(storage); } +/** \ingroup msg_storage_management + * + * \brief Returns the size of a #msg_storage_t. + * \param storage a storage + * \return The size of the storage + */ sg_size_t MSG_storage_get_size(msg_storage_t storage) { return SIMIX_storage_get_size(storage);