use a proper naming then.
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);
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
// 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;
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;
*
* \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;
}
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;