Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar and simplify simcalls (before killing them)
[simgrid.git] / src / simix / smx_io.cpp
index e033cb9..91690a9 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,42 +118,22 @@ 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)
+sg_size_t SIMIX_file_get_size(smx_file_t fd)
 {
-  return SIMIX_file_get_size(simcall->issuer, fd);
+  return fd->surf_file->size();
 }
 
-sg_size_t SIMIX_file_get_size(smx_actor_t process, smx_file_t fd)
+sg_size_t SIMIX_file_tell(smx_file_t fd)
 {
-  sg_host_t host = process->host;
-  return  surf_host_get_size(host, fd->surf_file);
-}
-
-sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd)
-{
-  return SIMIX_file_tell(simcall->issuer, 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);
-}
-
-int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin)
-{
-  return SIMIX_file_seek(simcall->issuer, fd, offset, origin);
+  return fd->surf_file->tell();
 }
 
-int SIMIX_file_seek(smx_actor_t process, smx_file_t fd, sg_offset_t offset, int origin)
+int SIMIX_file_seek(smx_file_t fd, sg_offset_t offset, int origin)
 {
-  sg_host_t host = process->host;
-  return  surf_host_file_seek(host, fd->surf_file, offset, origin);
+  return fd->surf_file->seek(offset, origin);
 }
 
 int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t file, const char* fullpath)