Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Put double instead of size_t.
authornavarro <navarro@caraja.(none)>
Thu, 21 Jun 2012 15:48:33 +0000 (17:48 +0200)
committernavarro <navarro@caraja.(none)>
Thu, 21 Jun 2012 15:50:10 +0000 (17:50 +0200)
examples/msg/io/file.c
src/include/surf/surf.h
src/surf/storage.c
src/surf/workstation.c

index b419a3a..e899d95 100644 (file)
@@ -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("\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);
 
   XBT_INFO("\tClose file '%s'",file->name);
   MSG_file_close(file);
index df8f9c9..82536d7 100644 (file)
@@ -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);
 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);
   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);
index 079a799..15db4c7 100644 (file)
@@ -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 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)
 {
 
 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;
 }
 
   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;
 {
   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;
   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;
 }
   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;
 }
 
   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;
 
 {
   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);
   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("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);
     }
   }
 
     }
   }
 
index 0f3196e..62797b0 100644 (file)
@@ -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;
   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)
 }
 
 static surf_action_t ws_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)