Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't call things storage when it's mount
[simgrid.git] / src / surf / workstation.c
index b19db9d38384a69a4979cad86828daf7004f5e77..1d0fcca4cece0352a211d3bdd520b53e21511133 100644 (file)
@@ -227,6 +227,14 @@ static double ws_get_speed(void *workstation, double load)
       get_speed(workstation, load);
 }
 
+static int ws_get_core(void *workstation)
+{
+  return surf_cpu_model->extension.cpu.
+      get_core(workstation);
+}
+
+
+
 static double ws_get_available_speed(void *workstation)
 {
   return surf_cpu_model->extension.cpu.
@@ -337,28 +345,28 @@ static surf_action_t ws_action_open(void *workstation, const char* mount,
 
 static surf_action_t ws_action_close(void *workstation, surf_file_t fd)
 {
-  storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+  storage_t st = find_storage_on_mount_list(workstation, fd->mount);
   XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name);
   surf_model_t model = st->generic_resource.model;
   return model->extension.storage.close(st, fd);
 }
 
-static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size,
-                                    size_t nmemb, surf_file_t fd)
+static surf_action_t ws_action_read(void *workstation, size_t size,
+                                    surf_file_t fd)
 {
-  storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+  storage_t st = find_storage_on_mount_list(workstation, fd->mount);
   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, (double)size, nmemb, fd);
+  return model->extension.storage.read(st, size, fd);
 }
 
-static surf_action_t ws_action_write(void *workstation, const void* ptr,
-                                     size_t size, size_t nmemb, surf_file_t fd)
+static surf_action_t ws_action_write(void *workstation, size_t size, 
+                                     surf_file_t fd)
 {
-  storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+  storage_t st = find_storage_on_mount_list(workstation, fd->mount);
   XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);
   surf_model_t model = st->generic_resource.model;
-  return model->extension.storage.write(st,  ptr, size, nmemb, fd);
+  return model->extension.storage.write(st, size, fd);
 }
 
 static int ws_file_unlink(void *workstation, surf_file_t fd)
@@ -368,7 +376,7 @@ static int ws_file_unlink(void *workstation, surf_file_t fd)
     return 0;
   } else {
 //    XBT_INFO("%s %zu", fd->storage, fd->size);
-    storage_t st = find_storage_on_mount_list(workstation, fd->storage);
+    storage_t st = find_storage_on_mount_list(workstation, fd->mount);
     xbt_dict_t content_dict = (st)->content;
     /* Check if the file is on this storage */
     if (!xbt_dict_get_or_null(content_dict, fd->name)){
@@ -383,7 +391,7 @@ static int ws_file_unlink(void *workstation, surf_file_t fd)
       xbt_dict_remove(content_dict,fd->name);
 
       free(fd->name);
-      free(fd->storage);
+      free(fd->mount);
       xbt_free(fd);
       return 1;
     }
@@ -438,6 +446,7 @@ static void surf_workstation_model_init_internal(void)
   surf_workstation_model->extension.workstation.execute = ws_execute;
   surf_workstation_model->extension.workstation.sleep = ws_action_sleep;
   surf_workstation_model->extension.workstation.get_state = ws_get_state;
+  surf_workstation_model->extension.workstation.get_core = ws_get_core;
   surf_workstation_model->extension.workstation.get_speed = ws_get_speed;
   surf_workstation_model->extension.workstation.get_available_speed =
       ws_get_available_speed;