From: navarro Date: Tue, 31 Jan 2012 20:51:09 +0000 (+0100) Subject: Use m_file_t instead of m_file_t* X-Git-Tag: exp_20120216~97^2~5 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/22ee43de174bafecc4d073e1e7fba1f6c45a678d Use m_file_t instead of m_file_t* --- diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index c52c2fd905..c490eb0396 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(io_file, int host(int argc, char *argv[]) { - m_file_t* file; + m_file_t file; file = MSG_file_open("test.txt","rw"); XBT_INFO("Host '%s' open %p",MSG_host_get_name(MSG_host_self()), file); diff --git a/include/msg/msg.h b/include/msg/msg.h index c002bfb766..c8691f0b4c 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -40,10 +40,10 @@ XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void); /************************** File handling ***********************************/ -XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, m_file_t* stream); -XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, m_file_t* stream); -XBT_PUBLIC(m_file_t*) MSG_file_open(const char* path, const char* mode); -XBT_PUBLIC(int) MSG_file_close(m_file_t* fp); +XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, m_file_t stream); +XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, m_file_t stream); +XBT_PUBLIC(m_file_t) MSG_file_open(const char* path, const char* mode); +XBT_PUBLIC(int) MSG_file_close(m_file_t fp); XBT_PUBLIC(int) MSG_file_stat(int fd, void* buf); diff --git a/include/simix/simix.h b/include/simix/simix.h index 8c94fcb42d..cc84f0cd6d 100644 --- a/include/simix/simix.h +++ b/include/simix/simix.h @@ -244,10 +244,10 @@ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems); XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem); -XBT_PUBLIC(size_t) simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t* stream); -XBT_PUBLIC(size_t) simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t* stream); -XBT_PUBLIC(smx_file_t*) simcall_file_open(const char* path, const char* mode); -XBT_PUBLIC(int) simcall_file_close(smx_file_t* fp); +XBT_PUBLIC(size_t) simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream); +XBT_PUBLIC(size_t) simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream); +XBT_PUBLIC(smx_file_t) simcall_file_open(const char* path, const char* mode); +XBT_PUBLIC(int) simcall_file_close(smx_file_t fp); XBT_PUBLIC(int) simcall_file_stat(int fd, void* buf); SG_END_DECL() diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index 3c4a69ef62..0ab1ee1cb9 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -8,24 +8,24 @@ // FILE -size_t MSG_file_read(void* ptr, size_t size, size_t nmemb, m_file_t* stream) +size_t MSG_file_read(void* ptr, size_t size, size_t nmemb, m_file_t stream) { - return simcall_file_read(ptr, size, nmemb, (smx_file_t*)stream); + return simcall_file_read(ptr, size, nmemb, (smx_file_t)stream); } -size_t MSG_file_write(const void* ptr, size_t size, size_t nmemb, m_file_t* stream) +size_t MSG_file_write(const void* ptr, size_t size, size_t nmemb, m_file_t stream) { - return simcall_file_write(ptr, size, nmemb, (smx_file_t*)stream); + return simcall_file_write(ptr, size, nmemb, (smx_file_t)stream); } -m_file_t* MSG_file_open(const char* path, const char* mode) +m_file_t MSG_file_open(const char* path, const char* mode) { - return (m_file_t*) simcall_file_open(path, mode); + return (m_file_t) simcall_file_open(path, mode); } -int MSG_file_close(m_file_t* fp) +int MSG_file_close(m_file_t fp) { - return simcall_file_close((smx_file_t*)fp); + return simcall_file_close((smx_file_t)fp); } int MSG_file_stat(int fd, void* buf) diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index 57206589c4..031577da60 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -26,7 +26,7 @@ void SIMIX_pre_file_read(smx_simcall_t simcall) simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t* stream) +smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_action_t action; smx_host_t host = process->smx_host; @@ -68,7 +68,7 @@ void SIMIX_pre_file_write(smx_simcall_t simcall) simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t* stream) +smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_action_t action; smx_host_t host = process->smx_host; @@ -147,7 +147,7 @@ void SIMIX_pre_file_close(smx_simcall_t simcall) simcall->issuer->waiting_action = action; } -smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t* fp) +smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fp) { smx_action_t action; smx_host_t host = process->smx_host; diff --git a/src/simix/smx_io_private.h b/src/simix/smx_io_private.h index 16a022bd06..821e9cd6df 100644 --- a/src/simix/smx_io_private.h +++ b/src/simix/smx_io_private.h @@ -24,10 +24,10 @@ void SIMIX_pre_file_open(smx_simcall_t simcall); void SIMIX_pre_file_close(smx_simcall_t simcall); void SIMIX_pre_file_stat(smx_simcall_t simcall); -smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t* stream); -smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t* stream); +smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size, size_t nmemb, smx_file_t stream); +smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr, size_t size, size_t nmemb, smx_file_t stream); smx_action_t SIMIX_file_open(smx_process_t process, const char* path, const char* mode); -smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t* fp); +smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fp); smx_action_t SIMIX_file_stat(smx_process_t process, int fd, void* buf); void SIMIX_post_io(smx_action_t action); diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index 026252c691..4552149c91 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -511,7 +511,7 @@ typedef struct s_smx_simcall { void *ptr; size_t size; size_t nmemb; - smx_file_t* stream; + smx_file_t stream; size_t result; } file_read; @@ -519,18 +519,18 @@ typedef struct s_smx_simcall { const void *ptr; size_t size; size_t nmemb; - smx_file_t* stream; + smx_file_t stream; size_t result; } file_write; struct { const char* path; const char* mode; - smx_file_t* result; + smx_file_t result; } file_open; struct { - smx_file_t* fp; + smx_file_t fp; int result; } file_close; diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index e26d97fe81..4acc81d1d4 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1177,7 +1177,7 @@ int simcall_sem_get_capacity(smx_sem_t sem) return simcall->sem_get_capacity.result; } -size_t simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t* stream) +size_t simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); @@ -1191,7 +1191,7 @@ size_t simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t* strea return simcall->file_read.result; } -size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t* stream) +size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); @@ -1205,7 +1205,7 @@ size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t return simcall->file_write.result; } -smx_file_t* simcall_file_open(const char* path, const char* mode) +smx_file_t simcall_file_open(const char* path, const char* mode) { smx_simcall_t simcall = SIMIX_simcall_mine(); @@ -1217,7 +1217,7 @@ smx_file_t* simcall_file_open(const char* path, const char* mode) return simcall->file_open.result; } -int simcall_file_close(smx_file_t* fp) +int simcall_file_close(smx_file_t fp) { smx_simcall_t simcall = SIMIX_simcall_mine();