Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
the name field of a msg_file_t is actually a full name (including path),
authorsuter <frederic.suter@cc.in2p3.fr>
Tue, 9 Jul 2013 09:32:05 +0000 (11:32 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Tue, 9 Jul 2013 11:36:35 +0000 (13:36 +0200)
use a proper naming then.

examples/msg/io/file.c
examples/msg/io/file_unlink.c
include/msg/datatypes.h
src/msg/msg_io.c

index 4e0ee91..023c1db 100644 (file)
@@ -46,19 +46,19 @@ int host(int argc, char *argv[])
     file = MSG_file_open(mount,FILENAME4);
   else xbt_die("FILENAME NOT DEFINED %s",MSG_process_get_name(MSG_process_self()));
 
-  XBT_INFO("\tOpen file '%s'",file->name);
+  XBT_INFO("\tOpen file '%s'",file->fullname);
 
   read = MSG_file_read(10000000,file);     // Read for 10MB
-  XBT_INFO("\tHave read    %zu on %s",read,file->name);
+  XBT_INFO("\tHave read    %zu on %s",read,file->fullname);
 
   write = MSG_file_write(100000,file);  // Write for 100KB
-  XBT_INFO("\tHave written %zu on %s",write,file->name);
+  XBT_INFO("\tHave written %zu on %s",write,file->fullname);
 
   read = MSG_file_read(110000,file);     // Read for 110KB
-  XBT_INFO("\tHave read    %zu on %s (of size %zu)",read,file->name,
+  XBT_INFO("\tHave read    %zu on %s (of size %zu)",read,file->fullname,
       MSG_file_get_size(file));
 
-  XBT_INFO("\tClose file '%s'",file->name);
+  XBT_INFO("\tClose file '%s'",file->fullname);
   MSG_file_close(file);
 
   free(mount);
index 911b499..8bcf082 100644 (file)
@@ -38,7 +38,7 @@ int host(int argc, char *argv[])
   file = MSG_file_open(mount,FILENAME1);
 
   // Unlink the file
-  XBT_INFO("\tUnlink file '%s'",file->name);
+  XBT_INFO("\tUnlink file '%s'",file->fullname);
   MSG_file_unlink(file);
 
   // Re Open the file wich is in fact created
@@ -47,10 +47,10 @@ int host(int argc, char *argv[])
 
   // Write into the new file
   write = MSG_file_write(100000,file);  // Write for 100Ko
-  XBT_INFO("\tHave written %zu on %s",write,file->name);
+  XBT_INFO("\tHave written %zu on %s",write,file->fullname);
 
   // Close the file
-  XBT_INFO("\tClose file '%s'",file->name);
+  XBT_INFO("\tClose file '%s'",file->fullname);
   MSG_file_close(file);
 
   xbt_dict_t dict_ls;
index c79248f..91310e9 100644 (file)
@@ -103,8 +103,8 @@ typedef struct msg_vm {
 typedef struct simdata_file *simdata_file_t;
 
 typedef struct msg_file {
-  char *name;                   /**< @brief file name */
-  simdata_file_t simdata;                /**< @brief simulator data  */
+  char *fullname;               /**< @brief file full name (path+name)*/
+  simdata_file_t simdata;       /**< @brief simulator data  */
   void *data;                   /**< @brief user data */
 } s_msg_file_t;
 
index 575347b..e6cade0 100644 (file)
@@ -51,12 +51,12 @@ size_t MSG_file_write(size_t size, msg_file_t fd)
  *
  * \return An #msg_file_t associated to the file
  */
-msg_file_t MSG_file_open(const char* mount, const char* path)
+msg_file_t MSG_file_open(const char* mount, const char* fullname)
 {
   msg_file_t file = xbt_new(s_msg_file_t,1);
-  file->name = xbt_strdup(path);
+  file->fullname = xbt_strdup(fullname);
   file->simdata = xbt_new0(s_simdata_file_t,1);
-  file->simdata->smx_file = simcall_file_open(mount, path);
+  file->simdata->smx_file = simcall_file_open(mount, fullname);
   return file;
 }
 
@@ -69,7 +69,7 @@ msg_file_t MSG_file_open(const char* mount, const char* path)
 int MSG_file_close(msg_file_t fd)
 {
   int res = simcall_file_close(fd->simdata->smx_file);
-  free(fd->name);
+  free(fd->fullname);
   xbt_free(fd->simdata);
   xbt_free(fd);
   return res;