Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add MSG_file_seek function
[simgrid.git] / src / surf / surf_interface.cpp
index b23ea89..f2ac787 100644 (file)
@@ -10,7 +10,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel);
 /*********
  * TOOLS *
  *********/
-extern double NOW;
 
 static CpuPtr get_casted_cpu(surf_resource_t resource){
   return dynamic_cast<CpuPtr>(static_cast<ResourcePtr>(surf_cpu_resource_priv(resource)));
@@ -32,9 +31,10 @@ char *surf_routing_edge_name(sg_routing_edge_t edge){
 static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
 #endif
 
-static double *surf_mins = NULL; /* return value of share_resources for each model */
-static int surf_min_index;       /* current index in surf_mins */
-static double surf_min;               /* duration determined by surf_solve */
+extern double NOW;
+extern double *surf_mins; /* return value of share_resources for each model */
+extern int surf_min_index;       /* current index in surf_mins */
+extern double surf_min;               /* duration determined by surf_solve */
 
 void surf_presolve(void)
 {
@@ -349,11 +349,11 @@ size_t surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd){
   return get_casted_workstation(workstation)->getSize(fd);
 }
 
-surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){
+surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_size_t size){
   return get_casted_workstation(resource)->read(fd, size);
 }
 
-surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){
+surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_size_t size){
   return get_casted_workstation(resource)->write(fd, size);
 }
 
@@ -361,14 +361,22 @@ xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd){
   return get_casted_workstation(resource)->getInfo(fd);
 }
 
-sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){
+sg_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){
   return get_casted_workstation(resource)->getFreeSize(name);
 }
 
-sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){
+sg_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){
   return get_casted_workstation(resource)->getUsedSize(name);
 }
 
+size_t surf_workstation_file_tell(surf_resource_t workstation, surf_file_t fd){
+  return get_casted_workstation(workstation)->fileTell(fd);
+}
+
+int surf_workstation_file_seek(surf_resource_t workstation, surf_file_t fd, sg_size_t offset, int origin){
+  return get_casted_workstation(workstation)->fileSeek(fd, offset, origin);
+}
+
 xbt_dynar_t surf_workstation_get_vms(surf_resource_t resource){
   return get_casted_workstation(resource)->getVms();
 }
@@ -433,7 +441,7 @@ xbt_dict_t surf_storage_get_content(surf_resource_t resource){
   return dynamic_cast<StoragePtr>(static_cast<ResourcePtr>(surf_storage_resource_priv(resource)))->getContent();
 }
 
-sg_storage_size_t surf_storage_get_size(surf_resource_t resource){
+sg_size_t surf_storage_get_size(surf_resource_t resource){
   return dynamic_cast<StoragePtr>(static_cast<ResourcePtr>(surf_storage_resource_priv(resource)))->getSize();
 }
 
@@ -502,11 +510,11 @@ int surf_action_get_cost(surf_action_t action){
 }
 
 void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask) {
-  dynamic_cast<CpuActionLmmPtr>(action)->setAffinity( dynamic_cast<CpuLmmPtr>(get_casted_cpu(cpu)), mask);
+  dynamic_cast<CpuActionPtr>(action)->setAffinity(get_casted_cpu(cpu), mask);
 }
 
 void surf_cpu_action_set_bound(surf_action_t action, double bound) {
-  dynamic_cast<CpuActionLmmPtr>(action)->setBound(bound);
+  dynamic_cast<CpuActionPtr>(action)->setBound(bound);
 }
 
 surf_file_t surf_storage_action_get_file(surf_action_t action){