Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simgrid::surf::Storage => simgrid::surf::StorageImpl
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 24 May 2017 14:15:16 +0000 (16:15 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 24 May 2017 14:15:16 +0000 (16:15 +0200)
this avoids confusion with simgrid::s4u::Storage

16 files changed:
include/simgrid/forward.h
src/include/surf/surf.h
src/msg/msg_io.cpp
src/s4u/s4u_storage.cpp
src/simix/smx_global.cpp
src/surf/HostImpl.cpp
src/surf/HostImpl.hpp
src/surf/StorageImpl.cpp [moved from src/surf/storage_interface.cpp with 73% similarity]
src/surf/StorageImpl.hpp [moved from src/surf/storage_interface.hpp with 67% similarity]
src/surf/host_clm03.hpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp
src/surf/surf_c_bindings.cpp
src/surf/surf_interface.cpp
tools/cmake/DefinePackages.cmake

index 628f1e5..8ae6a89 100644 (file)
@@ -35,7 +35,7 @@ namespace simgrid {
     class Cpu;
     class LinkImpl;
     class HostImpl;
-    class Storage;
+    class StorageImpl;
   }
   namespace trace_mgr {
     class trace;
index 09941a4..4a3c109 100644 (file)
@@ -16,7 +16,6 @@
 #include "surf/surf_routing.h"
 #include "surf/datatypes.h"
 #include "xbt/lib.h"
-#include "surf/surf_routing.h"
 #include "simgrid/datatypes.h"
 #include "simgrid/forward.h"
 
@@ -52,7 +51,7 @@ typedef simgrid::surf::CpuModel surf_CpuModel;
 typedef simgrid::surf::Cpu surf_Cpu;
 typedef simgrid::surf::HostModel surf_HostModel;
 typedef simgrid::surf::NetworkModel surf_NetworkModel;
-typedef simgrid::surf::Storage surf_Storage;
+typedef simgrid::surf::StorageImpl surf_Storage;
 typedef simgrid::surf::StorageModel surf_StorageModel;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::surf::HostImpl surf_Host;
@@ -65,7 +64,7 @@ typedef struct surf_CpuModel surf_CpuModel;
 typedef struct surf_Cpu surf_Cpu;
 typedef struct surf_HostModel surf_HostModel;
 typedef struct surf_NetworkModel surf_NetworkModel;
-typedef struct surf_Storage surf_Storage;
+typedef struct surf_StorageImpl surf_Storage;
 typedef struct surf_StorageModel surf_StorageModel;
 typedef struct surf_Resource surf_Resource;
 typedef struct surf_Host surf_Host;
index 2331428..ef67c5b 100644 (file)
@@ -3,9 +3,9 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "../surf/StorageImpl.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "src/msg/msg_private.h"
-#include "src/surf/storage_interface.hpp"
 #include <numeric>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, "Logging specific to MSG (io)");
index ba1820b..d010801 100644 (file)
@@ -3,9 +3,9 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include "../surf/StorageImpl.hpp"
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.hpp"
-#include "src/surf/storage_interface.hpp"
 #include "xbt/lib.h"
 #include <unordered_map>
 
index 25c861e..8fc4bca 100644 (file)
 #include "simgrid/s4u/Host.hpp"
 
 #include "src/surf/surf_interface.hpp"
-#include "src/surf/storage_interface.hpp"
 #include "src/surf/xml/platf.hpp"
 #include "smx_private.h"
 #include "xbt/ex.h"             /* ex_backtrace_display */
+
 #include "mc/mc.h"
-#include "src/mc/mc_replay.h"
 #include "simgrid/sg_config.h"
+#include "src/mc/mc_replay.h"
+#include "src/surf/StorageImpl.hpp"
 
 #include "src/smpi/smpi_process.hpp"
 
@@ -233,7 +234,7 @@ void SIMIX_global_init(int *argc, char **argv)
         host.extension_set<simgrid::simix::Host>(new simgrid::simix::Host());
     });
 
-    simgrid::surf::storageCreatedCallbacks.connect([](simgrid::surf::Storage* storage) {
+    simgrid::surf::storageCreatedCallbacks.connect([](simgrid::surf::StorageImpl* storage) {
       const char* name = storage->cname();
       // TODO, create sg_storage_by_name
       sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, name);
index 48e0d36..b8ca1e8 100644 (file)
@@ -106,7 +106,7 @@ HostImpl::HostImpl(s4u::Host* host) : piface_(host)
   piface_->pimpl_ = this;
 }
 
-simgrid::surf::Storage* HostImpl::findStorageOnMountList(const char* mount)
+simgrid::surf::StorageImpl* HostImpl::findStorageOnMountList(const char* mount)
 {
   XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->cname());
   if (storage_.find(mount) == storage_.end())
@@ -135,7 +135,7 @@ void HostImpl::getAttachedStorageList(std::vector<const char*>* storages)
   xbt_lib_foreach(storage_lib, cursor, key, data)
   {
     if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
-      simgrid::surf::Storage* storage = static_cast<simgrid::surf::Storage*>(
+      simgrid::surf::StorageImpl* storage = static_cast<simgrid::surf::StorageImpl*>(
           xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
       if (not strcmp(static_cast<const char*>(storage->attach_), piface_->cname())) {
         storages->push_back(storage->cname());
@@ -146,7 +146,7 @@ void HostImpl::getAttachedStorageList(std::vector<const char*>* storages)
 
 Action* HostImpl::open(const char* fullpath)
 {
-  simgrid::surf::Storage* st = nullptr;
+  simgrid::surf::StorageImpl* st = nullptr;
   size_t longest_prefix_length = 0;
   std::string path;
   std::string mount_name;
@@ -175,21 +175,21 @@ Action* HostImpl::open(const char* fullpath)
 
 Action* HostImpl::close(surf_file_t fd)
 {
-  simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+  simgrid::surf::StorageImpl* st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("CLOSE %s on disk '%s'", fd->name, st->cname());
   return st->close(fd);
 }
 
 Action* HostImpl::read(surf_file_t fd, sg_size_t size)
 {
-  simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+  simgrid::surf::StorageImpl* st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("READ %s on disk '%s'", fd->name, st->cname());
   return st->read(fd, size);
 }
 
 Action* HostImpl::write(surf_file_t fd, sg_size_t size)
 {
-  simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+  simgrid::surf::StorageImpl* st = findStorageOnMountList(fd->mount);
   XBT_DEBUG("WRITE %s on disk '%s'", fd->name, st->cname());
   return st->write(fd, size);
 }
@@ -201,7 +201,7 @@ int HostImpl::unlink(surf_file_t fd)
     return -1;
   } else {
 
-    simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+    simgrid::surf::StorageImpl* st = findStorageOnMountList(fd->mount);
     /* Check if the file is on this storage */
     if (st->content_->find(fd->name) == st->content_->end()) {
       XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name, st->cname());
@@ -230,7 +230,7 @@ sg_size_t HostImpl::getSize(surf_file_t fd)
 
 xbt_dynar_t HostImpl::getInfo(surf_file_t fd)
 {
-  simgrid::surf::Storage* st = findStorageOnMountList(fd->mount);
+  simgrid::surf::StorageImpl* st = findStorageOnMountList(fd->mount);
   sg_size_t* psize           = xbt_new(sg_size_t, 1);
   *psize                     = fd->size;
   xbt_dynar_t info           = xbt_dynar_new(sizeof(void*), nullptr);
index 12287e3..4d7c3ea 100644 (file)
@@ -4,11 +4,11 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf_interface.hpp"
-#include "storage_interface.hpp"
 #include "cpu_interface.hpp"
 #include "network_interface.hpp"
 #include "src/surf/PropertyHolder.hpp"
 
+#include "StorageImpl.hpp"
 #include <xbt/base.h>
 
 #ifndef SURF_HOST_INTERFACE_HPP_
@@ -67,7 +67,7 @@ public:
   virtual ~HostImpl() = default;
 
   /** @brief Return the storage of corresponding mount point */
-  virtual simgrid::surf::Storage* findStorageOnMountList(const char* storage);
+  virtual simgrid::surf::StorageImpl* findStorageOnMountList(const char* storage);
 
   /** @brief Get the xbt_dict_t of mount_point: Storage */
   virtual xbt_dict_t getMountedStorageList();
@@ -173,7 +173,7 @@ public:
    */
   virtual int fileMove(surf_file_t fd, const char* fullpath);
 
-  std::map<std::string, simgrid::surf::Storage*> storage_;
+  std::map<std::string, simgrid::surf::StorageImpl*> storage_;
   simgrid::s4u::Host* piface_ = nullptr;
 
   simgrid::s4u::Host* getHost() { return piface_; }
similarity index 73%
rename from src/surf/storage_interface.cpp
rename to src/surf/StorageImpl.cpp
index d0c8e8f..3eb9910 100644 (file)
@@ -4,7 +4,8 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "storage_interface.hpp"
+#include "StorageImpl.hpp"
+
 #include "surf_private.h"
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/join.hpp>
@@ -14,9 +15,9 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, "Logging specific to the SURF storage module");
 
 xbt_lib_t storage_lib;
-int MSG_STORAGE_LEVEL          = -1; // Msg storage level
-int SURF_STORAGE_LEVEL = -1;
-simgrid::surf::StorageModel *surf_storage_model = nullptr;
+int MSG_STORAGE_LEVEL                           = -1; // Msg storage level
+int SURF_STORAGE_LEVEL                          = -1;
+simgrid::surf::StorageModelsurf_storage_model = nullptr;
 
 namespace simgrid {
 namespace surf {
@@ -25,21 +26,22 @@ namespace surf {
  * Callbacks *
  *************/
 
-simgrid::xbt::signal<void(Storage*)> storageCreatedCallbacks;
-simgrid::xbt::signal<void(Storage*)> storageDestructedCallbacks;
-simgrid::xbt::signal<void(Storage*, int, int)> storageStateChangedCallbacks; // signature: wasOn, isOn
+simgrid::xbt::signal<void(StorageImpl*)> storageCreatedCallbacks;
+simgrid::xbt::signal<void(StorageImpl*)> storageDestructedCallbacks;
+simgrid::xbt::signal<void(StorageImpl*, int, int)> storageStateChangedCallbacks; // signature: wasOn, isOn
 simgrid::xbt::signal<void(StorageAction*, Action::State, Action::State)> storageActionStateChangedCallbacks;
 
 /*********
  * Model *
  *********/
 
-StorageModel::StorageModel(): Model()
+StorageModel::StorageModel() : Model()
 {
   maxminSystem_ = lmm_system_new(true /* lazy update */);
 }
 
-StorageModel::~StorageModel(){
+StorageModel::~StorageModel()
+{
   lmm_system_free(maxminSystem_);
   surf_storage_model = nullptr;
 }
@@ -48,8 +50,8 @@ StorageModel::~StorageModel(){
  * Resource *
  ************/
 
-Storage::Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
-                 const char* type_id, const char* content_name, sg_size_t size, const char* attach)
+StorageImpl::StorageImpl(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+                         const char* type_id, const char* content_name, sg_size_t size, const char* attach)
     : Resource(model, name, lmm_constraint_new(maxminSystem, this, MAX(bread, bwrite)))
     , size_(size)
     , usedSize_(0)
@@ -64,7 +66,8 @@ Storage::Storage(Model* model, const char* name, lmm_system_t maxminSystem, doub
   constraintWrite_ = lmm_constraint_new(maxminSystem, this, bwrite);
 }
 
-Storage::~Storage(){
+StorageImpl::~StorageImpl()
+{
   storageDestructedCallbacks(this);
   if (content_ != nullptr) {
     for (auto entry : *content_)
@@ -75,7 +78,7 @@ Storage::~Storage(){
   free(attach_);
 }
 
-std::map<std::string, sg_size_t*>* Storage::parseContent(const char* filename)
+std::map<std::string, sg_size_t*>* StorageImpl::parseContent(const char* filename)
 {
   usedSize_ = 0;
   if ((not filename) || (strcmp(filename, "") == 0))
@@ -97,7 +100,7 @@ std::map<std::string, sg_size_t*>* Storage::parseContent(const char* filename)
 
       usedSize_ += size;
       sg_size_t* psize = new sg_size_t;
-      *psize = size;
+      *psize           = size;
       parse_content->insert({tokens.front(), psize});
     }
   } while (not fs->eof());
@@ -105,66 +108,70 @@ std::map<std::string, sg_size_t*>* Storage::parseContent(const char* filename)
   return parse_content;
 }
 
-bool Storage::isUsed()
+bool StorageImpl::isUsed()
 {
   THROW_UNIMPLEMENTED;
   return false;
 }
 
-void Storage::apply_event(tmgr_trace_event_t /*event*/, double /*value*/)
+void StorageImpl::apply_event(tmgr_trace_event_t /*event*/, double /*value*/)
 {
   THROW_UNIMPLEMENTED;
 }
 
-void Storage::turnOn() {
+void StorageImpl::turnOn()
+{
   if (isOff()) {
     Resource::turnOn();
     storageStateChangedCallbacks(this, 0, 1);
   }
 }
-void Storage::turnOff() {
+void StorageImpl::turnOff()
+{
   if (isOn()) {
     Resource::turnOff();
     storageStateChangedCallbacks(this, 1, 0);
   }
 }
 
-std::map<std::string, sg_size_t*>* Storage::getContent()
+std::map<std::string, sg_size_t*>* StorageImpl::getContent()
 {
   /* For the moment this action has no cost, but in the future we could take in account access latency of the disk */
   return content_;
 }
 
-sg_size_t Storage::getFreeSize(){
+sg_size_t StorageImpl::getFreeSize()
+{
   return size_ - usedSize_;
 }
 
-sg_size_t Storage::getUsedSize(){
+sg_size_t StorageImpl::getUsedSize()
+{
   return usedSize_;
 }
 
 /**********
  * Action *
  **********/
-StorageAction::StorageAction(Model* model, double cost, bool failed, Storage* storage,
+StorageAction::StorageAction(Model* model, double cost, bool failed, StorageImpl* storage,
                              e_surf_action_storage_type_t type)
     : Action(model, cost, failed), type_(type), storage_(storage), file_(nullptr)
 {
   progress_ = 0;
 };
 
-StorageAction::StorageAction(Model* model, double cost, bool failed, lmm_variable_t var, Storage* storage,
+StorageAction::StorageAction(Model* model, double cost, bool failed, lmm_variable_t var, StorageImpl* storage,
                              e_surf_action_storage_type_t type)
     : Action(model, cost, failed, var), type_(type), storage_(storage), file_(nullptr)
 {
   progress_ = 0;
 }
 
-void StorageAction::setState(Action::State state){
+void StorageAction::setState(Action::State state)
+{
   Action::State old = getState();
   Action::setState(state);
   storageActionStateChangedCallbacks(this, old, state);
 }
-
 }
 }
similarity index 67%
rename from src/surf/storage_interface.hpp
rename to src/surf/StorageImpl.hpp
index 9e79f47..b02503e 100644 (file)
@@ -31,25 +31,29 @@ class StorageAction;
  * @brief Callbacks handler which emit the callbacks after Storage creation *
  * @details Callback functions have the following signature: `void(Storage*)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::Storage*)>) storageCreatedCallbacks;
+XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::StorageImpl*)>) storageCreatedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage destruction *
  * @details Callback functions have the following signature: `void(StoragePtr)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::Storage*)>) storageDestructedCallbacks;
+XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::StorageImpl*)>) storageDestructedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after Storage State changed *
- * @details Callback functions have the following signature: `void(StorageAction *action, int previouslyOn, int currentlyOn)`
+ * @details Callback functions have the following signature: `void(StorageAction *action, int previouslyOn, int
+ * currentlyOn)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::Storage*, int, int)>) storageStateChangedCallbacks;
+XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::StorageImpl*, int, int)>) storageStateChangedCallbacks;
 
 /** @ingroup SURF_callbacks
  * @brief Callbacks handler which emit the callbacks after StorageAction State changed *
- * @details Callback functions have the following signature: `void(StorageAction *action, simgrid::surf::Action::State old, simgrid::surf::Action::State current)`
+ * @details Callback functions have the following signature: `void(StorageAction *action, simgrid::surf::Action::State
+ * old, simgrid::surf::Action::State current)`
  */
-XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::StorageAction*, simgrid::surf::Action::State, simgrid::surf::Action::State)>) storageActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(simgrid::xbt::signal<void(simgrid::surf::StorageAction*, simgrid::surf::Action::State,
+                                          simgrid::surf::Action::State)>)
+storageActionStateChangedCallbacks;
 
 /*********
  * Model *
@@ -63,9 +67,10 @@ public:
   StorageModel();
   ~StorageModel();
 
-  virtual Storage* createStorage(const char* id, const char* type_id, const char* content_name, const char* attach) = 0;
+  virtual StorageImpl* createStorage(const char* id, const char* type_id, const char* content_name,
+                                     const char* attach) = 0;
 
-  std::vector<Storage*> p_storageList;
+  std::vector<StorageImpl*> p_storageList;
 };
 
 /************
@@ -75,15 +80,13 @@ public:
  * @brief SURF storage interface class
  * @details A Storage represent a storage unit (e.g.: hard drive, usb key)
  */
-class Storage : public simgrid::surf::Resource,
-        public simgrid::surf::PropertyHolder {
+class StorageImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder {
 public:
-
   /** @brief Storage constructor */
-  Storage(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite, const char* type_id,
-      const char* content_name, sg_size_t size, const char* attach);
+  StorageImpl(Model* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
+              const char* type_id, const char* content_name, sg_size_t size, const char* attach);
 
-  ~Storage();
+  ~StorageImpl();
 
   /** @brief Check if the Storage is used (if an action currently uses its resources) */
   bool isUsed() override;
@@ -96,8 +99,8 @@ public:
   std::map<std::string, sg_size_t*>* content_;
   sg_size_t size_;
   sg_size_t usedSize_;
-  char * typeId_;
-  char* attach_; //FIXME: this is the name of the host. Use the host directly
+  char* typeId_;
+  char* attach_; // FIXME: this is the name of the host. Use the host directly
 
   /**
    * @brief Open a file
@@ -107,7 +110,7 @@ public:
    *
    * @return The StorageAction corresponding to the opening
    */
-  virtual StorageAction *open(const char* mount, const char* path)=0;
+  virtual StorageAction* open(const char* mount, const char* path) = 0;
 
   /**
    * @brief Close a file
@@ -115,7 +118,7 @@ public:
    * @param fd The file descriptor to close
    * @return The StorageAction corresponding to the closing
    */
-  virtual StorageAction *close(surf_file_t fd)=0;
+  virtual StorageAction* close(surf_file_t fd) = 0;
 
   /**
    * @brief Read a file
@@ -124,7 +127,7 @@ public:
    * @param size The size in bytes to read
    * @return The StorageAction corresponding to the reading
    */
-  virtual StorageAction *read(surf_file_t fd, sg_size_t size)=0;
+  virtual StorageAction* read(surf_file_t fd, sg_size_t size) = 0;
 
   /**
    * @brief Write a file
@@ -133,7 +136,7 @@ public:
    * @param size The size in bytes to write
    * @return The StorageAction corresponding to the writing
    */
-  virtual StorageAction *write(surf_file_t fd, sg_size_t size)=0;
+  virtual StorageAction* write(surf_file_t fd, sg_size_t size) = 0;
 
   /**
    * @brief Get the content of the current Storage
@@ -160,8 +163,8 @@ public:
 
   std::vector<StorageAction*> writeActions_;
 
-  lmm_constraint_t constraintWrite_;    /* Constraint for maximum write bandwidth*/
-  lmm_constraint_t constraintRead_;     /* Constraint for maximum write bandwidth*/
+  lmm_constraint_t constraintWrite_; /* Constraint for maximum write bandwidth*/
+  lmm_constraint_t constraintRead_;  /* Constraint for maximum write bandwidth*/
 };
 
 /**********
@@ -172,11 +175,11 @@ public:
  * @brief The possible type of action for the storage component
  */
 typedef enum {
-  READ=0, /**< Read a file */
-  WRITE,  /**< Write in a file */
-  STAT,   /**< Stat a file */
-  OPEN,   /**< Open a file */
-  CLOSE  /**< Close a file */
+  READ = 0, /**< Read a file */
+  WRITE,    /**< Write in a file */
+  STAT,     /**< Stat a file */
+  OPEN,     /**< Open a file */
+  CLOSE     /**< Close a file */
 } e_surf_action_storage_type_t;
 
 /** @ingroup SURF_storage_interface
@@ -193,37 +196,35 @@ public:
    * @param storage The Storage associated to this StorageAction
    * @param type [description]
    */
-  StorageAction(Model *model, double cost, bool failed, Storage *storage,
-      e_surf_action_storage_type_t type);
+  StorageAction(Model* model, double cost, bool failed, StorageImpl* storage, e_surf_action_storage_type_t type);
 
-    /**
  * @brief StorageAction constructor
  *
  * @param model The StorageModel associated to this StorageAction
  * @param cost The cost of this  StorageAction in [TODO]
  * @param failed [description]
  * @param var The lmm variable associated to this StorageAction if it is part of a LMM component
  * @param storage The Storage associated to this StorageAction
  * @param type [description]
  */
-  StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
-      Storage *storage, e_surf_action_storage_type_t type);
+  /**
+ * @brief StorageAction constructor
+ *
+ * @param model The StorageModel associated to this StorageAction
+ * @param cost The cost of this  StorageAction in [TODO]
+ * @param failed [description]
+ * @param var The lmm variable associated to this StorageAction if it is part of a LMM component
+ * @param storage The Storage associated to this StorageAction
+ * @param type [description]
+ */
+  StorageAction(Model* model, double cost, bool failed, lmm_variable_t var, StorageImpl* storage,
+                e_surf_action_storage_type_t type);
 
   void setState(simgrid::surf::Action::State state) override;
 
   e_surf_action_storage_type_t type_;
-  Storage* storage_;
+  StorageImpl* storage_;
   surf_file_t file_;
   double progress_;
 };
-
 }
 }
 
 typedef struct s_storage_type {
-  char *model;
-  char *content;
-  char *type_id;
+  charmodel;
+  charcontent;
+  chartype_id;
   xbt_dict_t properties;
   std::map<std::string, std::string>* model_properties;
   sg_size_t size;
@@ -231,8 +232,8 @@ typedef struct s_storage_type {
 typedef s_storage_type_t* storage_type_t;
 
 typedef struct surf_file {
-  char *name;
-  char *mount;
+  charname;
+  charmount;
   sg_size_t size;
   sg_size_t current_position;
 } s_surf_file_t;
index 6dfffde..b9da9f5 100644 (file)
@@ -6,10 +6,10 @@
 
 #include <xbt/base.h>
 
-#include "storage_interface.hpp"
+#include "StorageImpl.hpp"
 #include "cpu_interface.hpp"
-#include "src/surf/HostImpl.hpp"
 #include "network_interface.hpp"
+#include "src/surf/HostImpl.hpp"
 
 #ifndef SURF_HOST_CLM03_HPP_
 #define SURF_HOST_CLM03_HPP_
index d369a11..0b49f04 100644 (file)
@@ -28,7 +28,7 @@
 #include <string>
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
 
-XBT_PRIVATE std::map<std::string, simgrid::surf::Storage*> mount_list;
+XBT_PRIVATE std::map<std::string, simgrid::surf::StorageImpl*> mount_list;
 XBT_PRIVATE std::vector<std::string> known_storages;
 
 namespace simgrid {
index 688d59a..5cffd79 100644 (file)
@@ -22,8 +22,8 @@ static void check_disk_attachment()
   void** data;
   xbt_lib_foreach(storage_lib, cursor, key, data) {
     if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
-      simgrid::surf::Storage* storage =
-          static_cast<simgrid::surf::Storage*>(xbt_lib_get_or_null(storage_lib, key, SURF_STORAGE_LEVEL));
+      simgrid::surf::StorageImpl* storage =
+          static_cast<simgrid::surf::StorageImpl*>(xbt_lib_get_or_null(storage_lib, key, SURF_STORAGE_LEVEL));
       simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(storage->attach_);
       if (not host_elm)
         surf_parse_error("Unable to attach storage %s: host %s does not exist.", storage->cname(), storage->attach_);
@@ -36,9 +36,8 @@ void storage_register_callbacks()
   simgrid::s4u::onPlatformCreated.connect(check_disk_attachment);
   instr_routing_define_callbacks();
 
-  SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, [](void *self) {
-    delete static_cast<simgrid::surf::Storage*>(self);
-  });
+  SURF_STORAGE_LEVEL =
+      xbt_lib_add_level(storage_lib, [](void* self) { delete static_cast<simgrid::surf::StorageImpl*>(self); });
 }
 
 /*********
@@ -54,8 +53,8 @@ void surf_storage_model_init_default()
 namespace simgrid {
 namespace surf {
 
-Storage* StorageN11Model::createStorage(const char* id, const char* type_id, const char* content_name,
-                                        const char* attach)
+StorageImpl* StorageN11Model::createStorage(const char* id, const char* type_id, const char* content_name,
+                                            const char* attach)
 {
   storage_type_t storage_type = storage_types.at(type_id);
 
@@ -64,8 +63,8 @@ Storage* StorageN11Model::createStorage(const char* id, const char* type_id, con
   double Bwrite = surf_parse_get_bandwidth(storage_type->model_properties->at("Bwrite").c_str(),
                                            "property Bwrite, storage", type_id);
 
Storage* storage = new StorageN11(this, id, maxminSystem_, Bread, Bwrite, type_id, (char*)content_name,
-                                   storage_type->size, (char*)attach);
 StorageImpl* storage = new StorageN11(this, id, maxminSystem_, Bread, Bwrite, type_id, (char*)content_name,
+                                        storage_type->size, (char*)attach);
   xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
   storageCreatedCallbacks(storage);
 
@@ -156,7 +155,7 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
 
 StorageN11::StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
                        const char* type_id, char* content_name, sg_size_t size, char* attach)
-    : Storage(model, name, maxminSystem, bread, bwrite, type_id, content_name, size, attach)
+    : StorageImpl(model, name, maxminSystem, bread, bwrite, type_id, content_name, size, attach)
 {
   XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
 }
@@ -246,10 +245,10 @@ StorageAction *StorageN11::write(surf_file_t fd, sg_size_t size)
  * Action *
  **********/
 
-StorageN11Action::StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type)
-: StorageAction(model, cost, failed,
-    lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0 , 3),
-    storage, type) {
+StorageN11Action::StorageN11Action(Model* model, double cost, bool failed, StorageImpl* storage,
+                                   e_surf_action_storage_type_t type)
+    : StorageAction(model, cost, failed, lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0, 3), storage, type)
+{
   XBT_IN("(%s,%g", storage->cname(), cost);
 
   // Must be less than the max bandwidth for all actions
index 9c8d866..00bd08d 100644 (file)
@@ -6,7 +6,7 @@
 
 #include <xbt/base.h>
 
-#include "storage_interface.hpp"
+#include "StorageImpl.hpp"
 
 #ifndef STORAGE_N11_HPP_
 #define STORAGE_N11_HPP_
@@ -28,7 +28,8 @@ class XBT_PRIVATE StorageN11Action;
 
 class StorageN11Model : public StorageModel {
 public:
-  Storage* createStorage(const char* id, const char* type_id, const char* content_name, const char* attach) override;
+  StorageImpl* createStorage(const char* id, const char* type_id, const char* content_name,
+                             const char* attach) override;
   double nextOccuringEvent(double now) override;
   void updateActionsState(double now, double delta) override;
 };
@@ -37,7 +38,7 @@ public:
  * Resource *
  ************/
 
-class StorageN11 : public Storage {
+class StorageN11 : public StorageImpl {
 public:
   StorageN11(StorageModel* model, const char* name, lmm_system_t maxminSystem, double bread, double bwrite,
              const char* type_id, char* content_name, sg_size_t size, char* attach);
@@ -55,7 +56,7 @@ public:
 
 class StorageN11Action : public StorageAction {
 public:
-  StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type);
+  StorageN11Action(Model* model, double cost, bool failed, StorageImpl* storage, e_surf_action_storage_type_t type);
   void suspend();
   int unref();
   void cancel();
@@ -63,7 +64,6 @@ public:
   bool isSuspended();
   void setMaxDuration(double duration);
   void setPriority(double priority);
-
 };
 
 }
index c35e6d1..23cc5cc 100644 (file)
@@ -207,27 +207,27 @@ int surf_host_file_move(sg_host_t host, surf_file_t fd, const char* fullpath){
 }
 
 sg_size_t surf_storage_get_size(surf_resource_t resource){
-  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->size_;
+  return static_cast<simgrid::surf::StorageImpl*>(surf_storage_resource_priv(resource))->size_;
 }
 
 sg_size_t surf_storage_get_free_size(surf_resource_t resource){
-  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getFreeSize();
+  return static_cast<simgrid::surf::StorageImpl*>(surf_storage_resource_priv(resource))->getFreeSize();
 }
 
 sg_size_t surf_storage_get_used_size(surf_resource_t resource){
-  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getUsedSize();
+  return static_cast<simgrid::surf::StorageImpl*>(surf_storage_resource_priv(resource))->getUsedSize();
 }
 
 xbt_dict_t surf_storage_get_properties(surf_resource_t resource){
-  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->getProperties();
+  return static_cast<simgrid::surf::StorageImpl*>(surf_storage_resource_priv(resource))->getProperties();
 }
 
 const char* surf_storage_get_host(surf_resource_t resource){
-  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->attach_;
+  return static_cast<simgrid::surf::StorageImpl*>(surf_storage_resource_priv(resource))->attach_;
 }
 
 const char* surf_storage_get_name(surf_resource_t resource){
-  return static_cast<simgrid::surf::Storage*>(surf_storage_resource_priv(resource))->cname();
+  return static_cast<simgrid::surf::StorageImpl*>(surf_storage_resource_priv(resource))->cname();
 }
 
 void surf_cpu_action_set_bound(surf_action_t action, double bound) {
index 845a924..d168c33 100644 (file)
@@ -259,7 +259,7 @@ int find_model_description(s_surf_model_description_t * table,
 
 static inline void surf_storage_free(void *r)
 {
-  delete static_cast<simgrid::surf::Storage*>(r);
+  delete static_cast<simgrid::surf::StorageImpl*>(r);
 }
 
 void sg_version_check(int lib_version_major,int lib_version_minor,int lib_version_patch) {
index 17f25b1..ddb333a 100644 (file)
@@ -60,7 +60,7 @@ set(EXTRA_DIST
   src/surf/xml/simgrid_dtd.c
   src/surf/xml/surfxml_sax_cb.cpp
 
-  src/surf/storage_interface.hpp
+  src/surf/StorageImpl.hpp
   src/surf/storage_n11.hpp
   src/surf/surf_interface.hpp
   src/surf/surf_private.h
@@ -343,7 +343,7 @@ set(SURF_SRC
   src/surf/plugins/host_load.cpp
   src/surf/PropertyHolder.cpp
   src/surf/sg_platf.cpp
-  src/surf/storage_interface.cpp
+  src/surf/StorageImpl.cpp
   src/surf/storage_n11.cpp
   src/surf/surf_c_bindings.cpp
   src/surf/surf_interface.cpp