Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
the plugin is now complete \o/
[simgrid.git] / src / msg / msg_io.cpp
index 8a8e8fb..aff1939 100644 (file)
@@ -13,99 +13,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, "Logging specific to MSG (io)");
 
 extern "C" {
 
-/** @addtogroup msg_file
- * (#msg_file_t) and the functions for managing it.
- *
- *  \see #msg_file_t
- */
-
-/** \ingroup msg_file
- * \brief Read a file (local or remote)
- *
- * \param size of the file to read
- * \param fd is a the file descriptor
- * \return the number of bytes successfully read or -1 if an error occurred
- */
-sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
-{
-  sg_size_t read_size;
-
-  if (fd->size() == 0) /* Nothing to read, return */
-    return 0;
-
-  /* Find the host where the file is physically located and read it */
-  msg_storage_t storage_src           = fd->localStorage;
-  msg_host_t attached_host            = storage_src->getHost();
-  read_size                           = fd->read(size);
-
-  if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) {
-    /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
-    XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->getCname(), read_size);
-    msg_host_t m_host_list[] = {MSG_host_self(), attached_host};
-    double flops_amount[]    = {0, 0};
-    double bytes_amount[]    = {0, 0, static_cast<double>(read_size), 0};
-
-    msg_task_t task = MSG_parallel_task_create("file transfer for read", 2, m_host_list, flops_amount, bytes_amount,
-                      nullptr);
-    msg_error_t transfer = MSG_parallel_task_execute(task);
-    MSG_task_destroy(task);
-
-    if(transfer != MSG_OK){
-      if (transfer == MSG_HOST_FAILURE)
-        XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->getCname());
-      if (transfer == MSG_TASK_CANCELED)
-        XBT_WARN("Transfer error, task has been canceled!");
-
-      return -1;
-    }
-  }
-  return read_size;
-}
-
-/** \ingroup msg_file
- * \brief Write into a file (local or remote)
- *
- * \param size of the file to write
- * \param fd is a the file descriptor
- * \return the number of bytes successfully write or -1 if an error occurred
- */
-sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
-{
-  if (size == 0) /* Nothing to write, return */
-    return 0;
-
-  /* Find the host where the file is physically located (remote or local)*/
-  msg_storage_t storage_src = fd->localStorage;
-  msg_host_t attached_host  = storage_src->getHost();
-
-  if (strcmp(attached_host->getCname(), MSG_host_self()->getCname())) {
-    /* the file is hosted on a remote host, initiate a communication between src and dest hosts for data transfer */
-    XBT_DEBUG("File is on %s remote host, initiate data transfer of %llu bytes.", attached_host->getCname(), size);
-    msg_host_t m_host_list[] = {MSG_host_self(), attached_host};
-    double flops_amount[]    = {0, 0};
-    double bytes_amount[]    = {0, static_cast<double>(size), 0, 0};
-
-    msg_task_t task = MSG_parallel_task_create("file transfer for write", 2, m_host_list, flops_amount, bytes_amount,
-                                               nullptr);
-    msg_error_t transfer = MSG_parallel_task_execute(task);
-    MSG_task_destroy(task);
-
-    if(transfer != MSG_OK){
-      if (transfer == MSG_HOST_FAILURE)
-        XBT_WARN("Transfer error, %s remote host just turned off!", attached_host->getCname());
-      if (transfer == MSG_TASK_CANCELED)
-        XBT_WARN("Transfer error, task has been canceled!");
-
-      return -1;
-    }
-  }
-  /* Write file on local or remote host */
-  sg_size_t write_size = fd->write(size);
-
-  return write_size;
-}
-
-
 /********************************* Storage **************************************/
 /** @addtogroup msg_storage_management
  * (#msg_storage_t) and the functions for managing it.