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);
/************************** 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);
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()
// 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)
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;
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;
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;
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);
void *ptr;
size_t size;
size_t nmemb;
- smx_file_t* stream;
+ smx_file_t stream;
size_t result;
} file_read;
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;
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();
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();
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();
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();