Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use storage and not name and type in File
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 21 Nov 2017 14:57:13 +0000 (15:57 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 21 Nov 2017 14:57:13 +0000 (15:57 +0100)
include/simgrid/s4u/File.hpp
src/msg/msg_io.cpp
src/s4u/s4u_file.cpp

index cdc9b97..14b370b 100644 (file)
@@ -59,9 +59,8 @@ public:
   /** Remove a file from disk */
   int unlink();
 
   /** Remove a file from disk */
   int unlink();
 
-  std::string storage_type;
-  std::string storageId;
   std::string mount_point;
   std::string mount_point;
+  Storage* onStorage;
   int desc_id = 0;
 
 private:
   int desc_id = 0;
 
 private:
index 11de4c7..fffbd34 100644 (file)
@@ -73,7 +73,7 @@ void MSG_file_dump (msg_file_t fd){
            "\t\tStorage Id: '%s'\n"
            "\t\tStorage Type: '%s'\n"
            "\t\tFile Descriptor Id: %d",
            "\t\tStorage Id: '%s'\n"
            "\t\tStorage Type: '%s'\n"
            "\t\tFile Descriptor Id: %d",
-           fd->getPath(), fd->size(), fd->mount_point.c_str(), fd->storageId.c_str(), fd->storage_type.c_str(),
+           fd->getPath(), fd->size(), fd->mount_point.c_str(), fd->onStorage->getCname(), fd->onStorage->getType(),
            fd->desc_id);
 }
 
            fd->desc_id);
 }
 
@@ -92,7 +92,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
     return 0;
 
   /* Find the host where the file is physically located and read it */
     return 0;
 
   /* Find the host where the file is physically located and read it */
-  msg_storage_t storage_src           = simgrid::s4u::Storage::byName(fd->storageId);
+  msg_storage_t storage_src           = fd->onStorage;
   msg_host_t attached_host            = storage_src->getHost();
   read_size                           = fd->read(size);
 
   msg_host_t attached_host            = storage_src->getHost();
   read_size                           = fd->read(size);
 
@@ -133,7 +133,7 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
     return 0;
 
   /* Find the host where the file is physically located (remote or local)*/
     return 0;
 
   /* Find the host where the file is physically located (remote or local)*/
-  msg_storage_t storage_src = simgrid::s4u::Storage::byName(fd->storageId);
+  msg_storage_t storage_src = fd->onStorage;
   msg_host_t attached_host  = storage_src->getHost();
 
   if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) {
   msg_host_t attached_host  = storage_src->getHost();
 
   if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) {
@@ -275,7 +275,7 @@ msg_error_t MSG_file_move (msg_file_t fd, const char* fullpath)
 msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpath)
 {
   /* Find the host where the file is physically located and read it */
 msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpath)
 {
   /* Find the host where the file is physically located and read it */
-  msg_storage_t storage_src = simgrid::s4u::Storage::byName(file->storageId);
+  msg_storage_t storage_src = file->onStorage;
   msg_host_t src_host       = storage_src->getHost();
   MSG_file_seek(file, 0, SEEK_SET);
   sg_size_t read_size = file->read(file->size());
   msg_host_t src_host       = storage_src->getHost();
   MSG_file_seek(file, 0, SEEK_SET);
   sg_size_t read_size = file->read(file->size());
index 14c73e0..f9fa944 100644 (file)
@@ -45,8 +45,7 @@ File::File(std::string fullpath, sg_host_t host, void* userdata) : path_(fullpat
 
   pimpl_ =
       simgrid::simix::kernelImmediate([this, st, path] { return new simgrid::surf::FileImpl(st, path, mount_point); });
 
   pimpl_ =
       simgrid::simix::kernelImmediate([this, st, path] { return new simgrid::surf::FileImpl(st, path, mount_point); });
-  storage_type = st->getType();
-  storageId    = st->getName();
+  onStorage = st;
 }
 
 File::~File()
 }
 
 File::~File()