Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a function to retrieve the size of an msg_file_t
authorsuter <frederic.suter@cc.in2p3.fr>
Thu, 6 Jun 2013 15:27:05 +0000 (17:27 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Thu, 6 Jun 2013 16:40:17 +0000 (18:40 +0200)
include/msg/msg.h
src/msg/msg_io.c

index 9a5aa26..2ab76ca 100644 (file)
@@ -75,6 +75,7 @@ XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_
 XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream);
 XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode);
 XBT_PUBLIC(int) MSG_file_close(msg_file_t fp);
+XBT_PUBLIC(size_t) MSG_file_get_size(msg_file_t fd);
 
 XBT_PUBLIC(int) MSG_file_unlink(msg_file_t fd);
 XBT_PUBLIC(xbt_dict_t) MSG_file_ls(const char *mount, const char *path);
index 008c7bf..c5a995c 100644 (file)
@@ -103,6 +103,17 @@ int MSG_file_unlink(msg_file_t fd)
   return res;
 }
 
+/** \ingroup msg_file_management
+ * \brief Return the size of a file
+ *
+ * \param fd is the file descriptor (#msg_file_t)
+ * \return the size of the file (as a size_t)
+ */
+
+size_t MSG_file_get_size(msg_file_t fd){
+  return fd->simdata->smx_file->surf_file->size;
+}
+
 /** \ingroup msg_file_management
  * \brief Search for file
  *