Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use m_file_t instead of m_file_t*
authornavarro <navarro@caraja.(none)>
Tue, 31 Jan 2012 20:51:09 +0000 (21:51 +0100)
committernavarro <navarro@caraja.(none)>
Tue, 31 Jan 2012 21:11:05 +0000 (22:11 +0100)
examples/msg/io/file.c
include/msg/msg.h
include/simix/simix.h
src/msg/msg_io.c
src/simix/smx_io.c
src/simix/smx_io_private.h
src/simix/smx_smurf_private.h
src/simix/smx_user.c

index c52c2fd..c490eb0 100644 (file)
@@ -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);
 
index c002bfb..c8691f0 100644 (file)
@@ -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);
 
 
index 8c94fcb..cc84f0c 100644 (file)
@@ -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()
index 3c4a69e..0ab1ee1 100644 (file)
@@ -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)
index 5720658..031577d 100644 (file)
@@ -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;
index 16a022b..821e9cd 100644 (file)
@@ -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);
index 026252c..4552149 100644 (file)
@@ -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;
 
index e26d97f..4acc81d 100644 (file)
@@ -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();