Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
clean up that mess of layers
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 27 Jun 2017 15:22:07 +0000 (17:22 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 27 Jun 2017 15:22:07 +0000 (17:22 +0200)
src/include/surf/surf.h
src/simix/smx_io.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/surf_c_bindings.cpp

index 191c350..ef5036b 100644 (file)
@@ -192,16 +192,6 @@ XBT_PUBLIC(sg_size_t) surf_host_get_used_size(sg_host_t resource, const char* na
  */
 XBT_PUBLIC(int) surf_host_unlink(sg_host_t host, surf_file_t fd);
 
-/**
- * @brief Get the size of a file on a host
- *
- * @param host The surf host
- * @param fd The file descriptor
- *
- * @return The size in bytes of the file
- */
-XBT_PUBLIC(size_t) surf_host_get_size(sg_host_t host, surf_file_t fd);
-
 /**
  * @brief Get the current position of the file descriptor
  *
@@ -238,33 +228,6 @@ XBT_PUBLIC(int) surf_host_file_move(sg_host_t host, surf_file_t fd, const char*
  */
 XBT_PUBLIC(int) surf_host_file_seek(sg_host_t host, surf_file_t fd, sg_offset_t offset, int origin);
 
-/**
- * @brief Get the size in bytes of a storage
- *
- * @param resource The surf storage
- * @return The size in bytes of the storage
- */
-XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_storage_t resource);
-
-/**
- * @brief Get the available size in bytes of a storage
- *
- * @param resource The surf storage
- * @return The available size in bytes of the storage
- */
-XBT_PUBLIC(sg_size_t) surf_storage_get_free_size(surf_storage_t resource);
-
-/**
- * @brief Get the size in bytes of a storage
- *
- * @param resource The surf storage
- * @return The used size in bytes of the storage
- */
-XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_storage_t resource);
-
-/** @brief return the properties set associated to that storage */
-XBT_PUBLIC(xbt_dict_t) surf_storage_get_properties(surf_storage_t resource);
-
 /**
  * @brief [brief description]
  * @details [long description]
@@ -290,25 +253,6 @@ XBT_PUBLIC(double) surf_network_action_get_latency_limited(surf_action_t action)
  */
 XBT_PUBLIC(surf_file_t) surf_storage_action_get_file(surf_action_t action);
 
-/**
- * @brief Get the result dictionary of an ls action
- *
- * @param action The surf storage action
- * @return The dictionry listing a path
- */
-XBT_PUBLIC(xbt_dict_t) surf_storage_action_get_ls_dict(surf_action_t action);
-
-
-/**
- * @brief Get the host the storage is attached to
- *
- * @param resource The surf storage
- * @return The host name
- * may not exist.
- */
-XBT_PUBLIC(const char*) surf_storage_get_host(surf_storage_t resource);
-XBT_PUBLIC(const char*) surf_storage_get_name(surf_storage_t resource);
-
 /** @} */
 
 /**************************************/
index eb041ec..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>
@@ -127,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)
@@ -138,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)
index 9a80433..b636340 100644 (file)
@@ -158,16 +158,6 @@ int HostImpl::unlink(surf_file_t fd)
   }
 }
 
-sg_size_t HostImpl::getSize(surf_file_t fd)
-{
-  return fd->size();
-}
-
-sg_size_t HostImpl::fileTell(surf_file_t fd)
-{
-  return fd->tell();
-}
-
 int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin)
 {
   switch (origin) {
index d22e5d4..d57d519 100644 (file)
@@ -89,14 +89,6 @@ public:
    */
   virtual int unlink(surf_file_t fd);
 
-  /**
-   * @brief Get the size in bytes of the file
-   *
-   * @param fd The file descriptor to read
-   * @return The size in bytes of the file
-   */
-  virtual sg_size_t getSize(surf_file_t fd);
-
   /**
    * @brief Read a file
    *
@@ -115,14 +107,6 @@ public:
    */
   virtual Action* write(surf_file_t fd, sg_size_t size);
 
-  /**
-   * @brief Get the current position of the file descriptor
-   *
-   * @param fd The file descriptor
-   * @return The current position of the file descriptor
-   */
-  virtual sg_size_t fileTell(surf_file_t fd);
-
   /**
    * @brief Set the position indicator associated with the file descriptor to a new position
    * @details [long description]
index fb3169c..9e2e4c5 100644 (file)
@@ -173,10 +173,6 @@ int surf_host_unlink(sg_host_t host, surf_file_t fd){
   return host->pimpl_->unlink(fd);
 }
 
-size_t surf_host_get_size(sg_host_t host, surf_file_t fd){
-  return host->pimpl_->getSize(fd);
-}
-
 surf_action_t surf_host_read(sg_host_t host, surf_file_t fd, sg_size_t size){
   return host->pimpl_->read(fd, size);
 }
@@ -185,10 +181,6 @@ surf_action_t surf_host_write(sg_host_t host, surf_file_t fd, sg_size_t size){
   return host->pimpl_->write(fd, size);
 }
 
-size_t surf_host_file_tell(sg_host_t host, surf_file_t fd){
-  return host->pimpl_->fileTell(fd);
-}
-
 int surf_host_file_seek(sg_host_t host, surf_file_t fd,
                                sg_offset_t offset, int origin){
   return host->pimpl_->fileSeek(fd, offset, origin);
@@ -198,36 +190,6 @@ int surf_host_file_move(sg_host_t host, surf_file_t fd, const char* fullpath){
   return host->pimpl_->fileMove(fd, fullpath);
 }
 
-sg_size_t surf_storage_get_size(surf_storage_t resource)
-{
-  return static_cast<simgrid::surf::StorageImpl*>(resource)->size_;
-}
-
-sg_size_t surf_storage_get_free_size(surf_storage_t resource)
-{
-  return static_cast<simgrid::surf::StorageImpl*>(resource)->getFreeSize();
-}
-
-sg_size_t surf_storage_get_used_size(surf_storage_t resource)
-{
-  return static_cast<simgrid::surf::StorageImpl*>(resource)->getUsedSize();
-}
-
-xbt_dict_t surf_storage_get_properties(surf_storage_t resource)
-{
-  return static_cast<simgrid::surf::StorageImpl*>(resource)->getProperties();
-}
-
-const char* surf_storage_get_host(surf_storage_t resource)
-{
-  return static_cast<simgrid::surf::StorageImpl*>(resource)->attach_.c_str();
-}
-
-const char* surf_storage_get_name(surf_storage_t resource)
-{
-  return static_cast<simgrid::surf::StorageImpl*>(resource)->cname();
-}
-
 void surf_cpu_action_set_bound(surf_action_t action, double bound) {
   static_cast<simgrid::surf::CpuAction*>(action)->setBound(bound);
 }