X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4078fd06852ccf32fff89e3c7a8774fe41727240..a02888b15739104c0def9ee3c782e314949876d9:/src/msg/msg_io.c diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 5ddba3db34..898604db09 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -140,7 +140,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) { msg_file_priv_t file_priv = MSG_file_priv(fd); - sg_size_t write_size; + sg_size_t write_size, offset; /* Find the host where the file is physically located (remote or local)*/ msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId); @@ -172,7 +172,9 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) } } /* Write file on local or remote host */ + offset = simcall_file_tell(file_priv->simdata->smx_file); write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host); + file_priv->size = offset+write_size; return write_size; } @@ -266,7 +268,7 @@ sg_size_t MSG_file_get_size(msg_file_t fd){ * MSG_TASK_CANCELED (=8). * */ -msg_error_t MSG_file_seek(msg_file_t fd, sg_size_t offset, int origin) +msg_error_t MSG_file_seek(msg_file_t fd, sg_offset_t offset, int origin) { msg_file_priv_t priv = MSG_file_priv(fd); return simcall_file_seek(priv->simdata->smx_file, offset, origin); @@ -321,6 +323,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId); msg_storage_priv_t storage_priv_src = MSG_storage_priv(storage_src); msg_host_t attached_host = MSG_get_host_by_name(storage_priv_src->hostname); + MSG_file_seek(file, 0, SEEK_SET); read_size = simcall_file_read(file_priv->simdata->smx_file, file_priv->size, attached_host); /* Find the real host destination where the file will be physically stored */