Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid multiple declaration on the same line/statement
[simgrid.git] / src / msg / msg_io.cpp
index 98c1348..b5f2a2b 100644 (file)
@@ -9,8 +9,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, "Logging specific to MSG (io)");
 
-/** @addtogroup msg_file_management
- * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Files" --> \endhtmlonly
+/** @addtogroup msg_file
  * (#msg_file_t) and the functions for managing it.
  *
  *  \see #msg_file_t
@@ -33,7 +32,7 @@ void __MSG_file_get_info(msg_file_t fd){
   xbt_dynar_free_container(&info);
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  *
  * \brief Set the user data of a #msg_file_t.
  *
@@ -46,7 +45,7 @@ msg_error_t MSG_file_set_data(msg_file_t fd, void *data)
   return MSG_OK;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  *
  * \brief Return the user data of a #msg_file_t.
  *
@@ -58,7 +57,7 @@ void *MSG_file_get_data(msg_file_t fd)
   return priv->data;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Display information related to a file descriptor
  *
  * \param fd is a the file descriptor
@@ -81,7 +80,7 @@ void MSG_file_dump (msg_file_t fd){
            priv->content_type, priv->desc_id);
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Read a file (local or remote)
  *
  * \param size of the file to read
@@ -127,7 +126,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
   return read_size;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Write into a file (local or remote)
  *
  * \param size of the file to write
@@ -137,7 +136,6 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
 sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
 {
   msg_file_priv_t file_priv = MSG_file_priv(fd);
-  sg_size_t write_size, offset;
 
   /* Find the host where the file is physically located (remote or local)*/
   msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId);
@@ -170,14 +168,14 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
     }
   }
   /* Write file on local or remote host */
-  offset = simcall_file_tell(file_priv->simdata->smx_file);
-  write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
+  sg_size_t offset = simcall_file_tell(file_priv->simdata->smx_file);
+  sg_size_t write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
   file_priv->size = offset+write_size;
 
   return write_size;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Opens the file whose name is the string pointed to by path
  *
  * \param fullpath is the file location on the storage
@@ -205,7 +203,7 @@ msg_file_t MSG_file_open(const char* fullpath, void* data)
   return fd;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Close the file
  *
  * \param fd is the file to close
@@ -226,7 +224,7 @@ int MSG_file_close(msg_file_t fd)
   return res;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Unlink the file pointed by fd
  *
  * \param fd is the file descriptor (#msg_file_t)
@@ -244,7 +242,7 @@ msg_error_t MSG_file_unlink(msg_file_t fd)
   return (msg_error_t) res;
 }
 
-/** \ingroup msg_file_management
+/** \ingroup msg_file
  * \brief Return the size of a file
  *
  * \param fd is the file descriptor (#msg_file_t)
@@ -256,7 +254,7 @@ sg_size_t MSG_file_get_size(msg_file_t fd){
 }
 
 /**
- * \ingroup msg_file_management
+ * \ingroup msg_file
  * \brief Set the file position indicator in the msg_file_t by adding offset bytes
  * to the position specified by origin (either SEEK_SET, SEEK_CUR, or SEEK_END).
  *
@@ -274,7 +272,7 @@ msg_error_t MSG_file_seek(msg_file_t fd, sg_offset_t offset, int origin)
 }
 
 /**
- * \ingroup msg_file_management
+ * \ingroup msg_file
  * \brief Returns the current value of the position indicator of the file
  *
  * \param fd : file object that identifies the stream
@@ -294,7 +292,7 @@ const char *MSG_file_get_name(msg_file_t fd) {
 }
 
 /**
- * \ingroup msg_file_management
+ * \ingroup msg_file
  * \brief Move a file to another location on the *same mount point*.
  *
  */
@@ -305,7 +303,7 @@ msg_error_t MSG_file_move (msg_file_t fd, const char* fullpath)
 }
 
 /**
- * \ingroup msg_file_management
+ * \ingroup msg_file
  * \brief Copy a file to another location on a remote host.
  * \param file : the file to move
  * \param host : the remote host where the file has to be copied
@@ -326,14 +324,14 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
 
   /* Find the real host destination where the file will be physically stored */
   xbt_dict_cursor_t cursor = NULL;
-  char *mount_name, *storage_name, *file_mount_name, *host_name_dest;
   msg_storage_t storage_dest = NULL;
   msg_host_t host_dest;
   size_t longest_prefix_length = 0;
 
   xbt_dict_t storage_list = host->mountedStoragesAsDict();
+  char *mount_name, *storage_name;
   xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
-    file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1));
+    char* file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1));
     strncpy(file_mount_name,fullpath,strlen(mount_name)+1);
     file_mount_name[strlen(mount_name)] = '\0';
 
@@ -346,12 +344,12 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
   }
   xbt_dict_free(&storage_list);
 
+  char* host_name_dest = nullptr;
   if(longest_prefix_length>0){
     /* Mount point found, retrieve the host the storage is attached to */
     msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest);
     host_name_dest = (char*)storage_dest_priv->hostname;
     host_dest = MSG_host_by_name(host_name_dest);
-
   }else{
     XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host));
     return MSG_TASK_CANCELED;
@@ -389,7 +387,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
 }
 
 /**
- * \ingroup msg_file_management
+ * \ingroup msg_file
  * \brief Move a file to another location on a remote host.
  * \param file : the file to move
  * \param host : the remote host where the file has to be moved
@@ -414,7 +412,6 @@ void __MSG_file_destroy(msg_file_priv_t file) {
 
 /********************************* Storage **************************************/
 /** @addtogroup msg_storage_management
- * \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Storages" --> \endhtmlonly
  * (#msg_storage_t) and the functions for managing it.
  */