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 MSG_file_write(msg_file_t fd, sg_size_t size)
{
msg_file_priv_t file_priv = MSG_file_priv(fd);
/* 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);
/* 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);
- offset = simcall_file_tell(file_priv->simdata->smx_file);
- write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
+ sg_size_t offset = simcall_file_tell(file_priv->simdata->smx_file);
+ sg_size_t write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
/* Find the real host destination where the file will be physically stored */
xbt_dict_cursor_t cursor = NULL;
/* Find the real host destination where the file will be physically stored */
xbt_dict_cursor_t cursor = NULL;
msg_storage_t storage_dest = NULL;
msg_host_t host_dest;
size_t longest_prefix_length = 0;
xbt_dict_t storage_list = host->mountedStoragesAsDict();
msg_storage_t storage_dest = NULL;
msg_host_t host_dest;
size_t longest_prefix_length = 0;
xbt_dict_t storage_list = host->mountedStoragesAsDict();
xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
strncpy(file_mount_name,fullpath,strlen(mount_name)+1);
file_mount_name[strlen(mount_name)] = '\0';
strncpy(file_mount_name,fullpath,strlen(mount_name)+1);
file_mount_name[strlen(mount_name)] = '\0';
if(longest_prefix_length>0){
/* Mount point found, retrieve the host the storage is attached to */
msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest);
host_name_dest = (char*)storage_dest_priv->hostname;
host_dest = MSG_host_by_name(host_name_dest);
if(longest_prefix_length>0){
/* Mount point found, retrieve the host the storage is attached to */
msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest);
host_name_dest = (char*)storage_dest_priv->hostname;
host_dest = MSG_host_by_name(host_name_dest);
}else{
XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host));
return MSG_TASK_CANCELED;
}else{
XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host));
return MSG_TASK_CANCELED;