Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to sort out the surf headers a bit, if possible
[simgrid.git] / src / surf / storage_interface.cpp
index 7cc21ff..026ed9a 100644 (file)
@@ -18,7 +18,6 @@ int ROUTING_STORAGE_HOST_LEVEL;
 int SURF_STORAGE_LEVEL;
 xbt_lib_t storage_type_lib;
 int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level
-xbt_dynar_t mount_list = NULL;
 simgrid::surf::StorageModel *surf_storage_model = NULL;
 
 namespace simgrid {
@@ -104,12 +103,9 @@ xbt_dict_t Storage::parseContent(const char *filename)
     return NULL;
 
   xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free_f);
-  FILE *file = NULL;
 
-  file = surf_fopen(filename, "r");
-  if (file == NULL)
-    xbt_die("Cannot open file '%s' (path=%s)", filename,
-            xbt_str_join(surf_path, ":"));
+  FILE *file =  surf_fopen(filename, "r");
+  xbt_assert(file, "Cannot open file '%s' (path=%s)", filename, xbt_str_join(surf_path, ":"));
 
   char *line = NULL;
   size_t len = 0;
@@ -119,14 +115,12 @@ xbt_dict_t Storage::parseContent(const char *filename)
 
   while ((read = xbt_getline(&line, &len, file)) != -1) {
     if (read){
-      if(sscanf(line,"%s %llu", path, &size) == 2) {
-        m_usedSize += size;
-        sg_size_t *psize = xbt_new(sg_size_t, 1);
-        *psize = size;
-        xbt_dict_set(parse_content,path,psize,NULL);
-      } else {
-        xbt_die("Be sure of passing a good format for content file.\n");
-      }
+      xbt_assert(sscanf(line,"%s %llu", path, &size) == 2, "Parse error in %s: %s",filename,line);
+
+      m_usedSize += size;
+      sg_size_t *psize = xbt_new(sg_size_t, 1);
+      *psize = size;
+      xbt_dict_set(parse_content,path,psize,NULL);
     }
   }
   free(line);
@@ -140,7 +134,7 @@ bool Storage::isUsed()
   return false;
 }
 
-void Storage::updateState(tmgr_trace_iterator_t /*event_type*/, double /*value*/, double /*date*/)
+void Storage::apply_event(tmgr_trace_iterator_t /*event*/, double /*value*/)
 {
   THROW_UNIMPLEMENTED;
 }