From: navarro Date: Thu, 21 Jun 2012 15:48:33 +0000 (+0200) Subject: Put double instead of size_t. X-Git-Tag: v3_8~507 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/68282355ac5ae3e6996e98a609de46aee9d866c9?ds=sidebyside Put double instead of size_t. --- diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index b419a3a309..e899d95b68 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -60,7 +60,7 @@ int host(int argc, char *argv[]) XBT_INFO("\tHaving read %zu \ton %s",read,file->name); MSG_file_stat(file,&stat); - XBT_INFO("\tFile stat %s Size %d",file->name,(int)stat.size); + XBT_INFO("\tFile stat %s Size %f",file->name,stat.size); XBT_INFO("\tClose file '%s'",file->name); MSG_file_close(file); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index df8f9c949c..82536d7d06 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -220,7 +220,7 @@ typedef struct surf_network_model_extension_public { typedef struct surf_storage_model_extension_public { surf_action_t(*open) (void *storage, const char* mount, const char* path, const char* mode); surf_action_t(*close) (void *storage, surf_file_t fp); - surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream); + surf_action_t(*read) (void *storage, void* ptr, double size, size_t nmemb, surf_file_t stream); surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream); surf_action_t(*stat) (void *storage, surf_file_t stream); void* (*create_resource) (const char* id, const char* model, const char* type_id, const char *content); diff --git a/src/surf/storage.c b/src/surf/storage.c index 079a799a58..15db4c7d5a 100644 --- a/src/surf/storage.c +++ b/src/surf/storage.c @@ -37,7 +37,7 @@ static xbt_dynar_t storage_list; static xbt_dict_t parse_storage_content(char *filename, unsigned long *used_size); static void storage_action_state_set(surf_action_t action, e_surf_action_state_t state); -static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type); +static surf_action_t storage_action_execute (void *storage, double size, e_surf_action_storage_type_t type); static surf_action_t storage_action_stat(void *storage, surf_file_t stream) { @@ -74,13 +74,14 @@ static surf_action_t storage_action_close(void *storage, surf_file_t fp) return action; } -static surf_action_t storage_action_read(void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream) +static surf_action_t storage_action_read(void *storage, void* ptr, double size, size_t nmemb, surf_file_t stream) { char *filename = stream->name; surf_stat_t content = stream->content; - XBT_DEBUG("\tRead file '%s' size '%f/%zu'",filename,content->stat.size,size); + XBT_INFO("\tRead file '%s' size '%f/%f'",filename,content->stat.size,size); if(size > content->stat.size) size = content->stat.size; + XBT_INFO("Really read file '%s' for %f",filename,size); surf_action_t action = storage_action_execute(storage,size,READ); return action; } @@ -101,12 +102,12 @@ static surf_action_t storage_action_write(void *storage, const void* ptr, size_t return action; } -static surf_action_t storage_action_execute (void *storage, size_t size, e_surf_action_storage_type_t type) +static surf_action_t storage_action_execute (void *storage, double size, e_surf_action_storage_type_t type) { surf_action_storage_t action = NULL; storage_t STORAGE = storage; - XBT_IN("(%s,%zu)", surf_resource_name(STORAGE), size); + XBT_IN("(%s,%f)", surf_resource_name(STORAGE), size); action = surf_action_new(sizeof(s_surf_action_storage_t), size, surf_storage_model, STORAGE->state_current != SURF_RESOURCE_ON); @@ -214,6 +215,7 @@ static void storage_update_actions_state(double now, double delta) XBT_INFO("Update %f + %f = %f",((surf_action_t)action)->file->content->stat.size,delta * rate,((surf_action_t)action)->file->content->stat.size+delta * rate); ((storage_t)(action->storage))->used_size += delta * rate; // disk usage ((surf_action_t)action)->file->content->stat.size += delta * rate; // file size + XBT_INFO("Have updating to %f",((surf_action_t)action)->file->content->stat.size); } } diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 0f3196e485..62797b0d5e 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -324,7 +324,7 @@ static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size, s storage_t st = find_storage_on_mount_list(workstation, stream->storage); XBT_DEBUG("READ on disk '%s'",st->generic_resource.name); surf_model_t model = st->generic_resource.model; - return model->extension.storage.read(st, ptr, size, nmemb, stream); + return model->extension.storage.read(st, ptr, (double)size, nmemb, stream); } static surf_action_t ws_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)