From 2b859d7b5c2aed26d77af4b362ba4f3d39626a9a Mon Sep 17 00:00:00 2001 From: suter Date: Tue, 9 Jul 2013 11:32:05 +0200 Subject: [PATCH] the name field of a msg_file_t is actually a full name (including path), use a proper naming then. --- examples/msg/io/file.c | 10 +++++----- examples/msg/io/file_unlink.c | 6 +++--- include/msg/datatypes.h | 4 ++-- src/msg/msg_io.c | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index 4e0ee91b81..023c1dbdbe 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -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); diff --git a/examples/msg/io/file_unlink.c b/examples/msg/io/file_unlink.c index 911b499d6d..8bcf082499 100644 --- a/examples/msg/io/file_unlink.c +++ b/examples/msg/io/file_unlink.c @@ -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; diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index c79248f92e..91310e9139 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -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; diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 575347be12..e6cade0433 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -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; -- 2.20.1