Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / simix / smx_io.cpp
index e033cb9..ee23b9d 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Storage.hpp"
+#include "src/surf/FileImpl.hpp"
 #include "src/surf/StorageImpl.hpp"
 
 #include <mc/mc.h>
@@ -117,9 +118,7 @@ int SIMIX_file_unlink(smx_file_t fd, sg_host_t host)
   if (host->isOff())
     THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
 
-  int res = surf_host_unlink(host, fd->surf_file);
-  xbt_free(fd);
-  return res;
+  return surf_host_unlink(host, fd->surf_file);
 }
 
 sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd)
@@ -129,8 +128,7 @@ sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd)
 
 sg_size_t SIMIX_file_get_size(smx_actor_t process, smx_file_t fd)
 {
-  sg_host_t host = process->host;
-  return  surf_host_get_size(host, fd->surf_file);
+  return fd->surf_file->size();
 }
 
 sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd)
@@ -140,8 +138,7 @@ sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd)
 
 sg_size_t SIMIX_file_tell(smx_actor_t process, smx_file_t fd)
 {
-  sg_host_t host = process->host;
-  return  surf_host_file_tell(host, fd->surf_file);
+  return fd->surf_file->tell();
 }
 
 int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin)