XBT_INFO("\tOpen file '%s'",file->fullname);
- read = MSG_file_read(10000000,file); // Read for 10MB
+ read = MSG_file_read(file, 10000000); // Read for 10MB
XBT_INFO("\tHave read %zu on %s",read,file->fullname);
- write = MSG_file_write(100000,file); // Write for 100KB
+ write = MSG_file_write(file, 100000); // Write for 100KB
XBT_INFO("\tHave written %zu on %s",write,file->fullname);
- read = MSG_file_read(110000,file); // Read for 110KB
+ read = MSG_file_read(file, 110000); // Read for 110KB
XBT_INFO("\tHave read %zu on %s (of size %zu)",read,file->fullname,
MSG_file_get_size(file));
file = MSG_file_open(mount,FILENAME1, NULL);
// Write into the new file
- write = MSG_file_write(100000,file); // Write for 100Ko
+ write = MSG_file_write(file,100000); // Write for 100Ko
XBT_INFO("\tHave written %zu on %s",write,file->fullname);
// Close the file
XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_as_t as);
/************************** File handling ***********************************/
-XBT_PUBLIC(sg_storage_size_t) MSG_file_read(sg_storage_size_t size, msg_file_t fd);
-XBT_PUBLIC(sg_storage_size_t) MSG_file_write(sg_storage_size_t size, msg_file_t fd);
+XBT_PUBLIC(sg_storage_size_t) MSG_file_read(msg_file_t fd, sg_storage_size_t size);
+XBT_PUBLIC(sg_storage_size_t) MSG_file_write(msg_file_t fd, sg_storage_size_t size);
XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path,
void* data);
XBT_PUBLIC(void*) MSG_file_get_data(msg_file_t fd);
/***************************** File **********************************/
XBT_PUBLIC(void *) simcall_file_get_data(smx_file_t fd);
XBT_PUBLIC(void) simcall_file_set_data(smx_file_t fd, void *data);
-XBT_PUBLIC(sg_storage_size_t) simcall_file_read(sg_storage_size_t size, smx_file_t fd);
-XBT_PUBLIC(sg_storage_size_t) simcall_file_write(sg_storage_size_t size, smx_file_t fd);
+XBT_PUBLIC(sg_storage_size_t) simcall_file_read(smx_file_t fd, sg_storage_size_t size);
+XBT_PUBLIC(sg_storage_size_t) simcall_file_write(smx_file_t fd, sg_storage_size_t size);
XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path);
XBT_PUBLIC(int) simcall_file_close(smx_file_t fd);
XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd);
typedef struct surf_storage_model_extension_public {
surf_action_t(*open) (void *storage, const char* mount, const char* path);
surf_action_t(*close) (void *storage, surf_file_t fd);
- surf_action_t(*read) (void *storage, size_t size, surf_file_t fd);
- surf_action_t(*write) (void *storage, size_t size, surf_file_t fd);
+ surf_action_t(*read) (void *storage, surf_file_t fd, sg_storage_size_t size);
+ surf_action_t(*write) (void *storage, surf_file_t fd, sg_storage_size_t size);
surf_action_t(*stat) (void *storage, surf_file_t fd);
surf_action_t(*ls) (void *storage, const char *path);
xbt_dict_t(*get_properties) (const void *storage);
surf_action_t(*open) (void *workstation, const char* storage,
const char* path);
surf_action_t(*close) (void *workstation, surf_file_t fd);
- surf_action_t(*read) (void *workstation, size_t size, surf_file_t fd);
- surf_action_t(*write) (void *workstation, size_t size, surf_file_t fd);
+ surf_action_t(*read) (void *workstation, surf_file_t fd, sg_storage_size_t size);
+ surf_action_t(*write) (void *workstation, surf_file_t fd, sg_storage_size_t size);
surf_action_t(*stat) (void *workstation, surf_file_t fd);
int(*unlink) (void *workstation, surf_file_t fd);
surf_action_t(*ls) (void *workstation, const char* mount, const char *path);
- size_t (*get_size) (void *workstation, surf_file_t fd);
+ sg_storage_size_t (*get_size) (void *workstation, surf_file_t fd);
xbt_dynar_t (*get_info) (void *workstation, surf_file_t fd);
int (*link_shared) (const void *link);
xbt_dict_t(*get_properties) (const void *resource);
void (*add_traces) (void);
- size_t (*get_free_size) (void *workstation,const char* name);
- size_t (*get_used_size) (void *workstation,const char* name);
+ sg_storage_size_t (*get_free_size) (void *workstation,const char* name);
+ sg_storage_size_t (*get_used_size) (void *workstation,const char* name);
xbt_dict_t (*get_storage_list) (void *workstation);
} s_surf_model_extension_workstation_t;
* \param fd is a the file descriptor
* \return the number of bytes successfully read
*/
-sg_storage_size_t MSG_file_read(sg_storage_size_t size, msg_file_t fd)
+sg_storage_size_t MSG_file_read(msg_file_t fd, sg_storage_size_t size)
{
- return simcall_file_read(size, fd->simdata->smx_file);
+ return simcall_file_read(fd->simdata->smx_file, size);
}
/** \ingroup msg_file_management
* \param fd is a the file descriptor
* \return the number of bytes successfully write
*/
-sg_storage_size_t MSG_file_write(sg_storage_size_t size, msg_file_t fd)
+sg_storage_size_t MSG_file_write(msg_file_t fd, sg_storage_size_t size)
{
- return simcall_file_write(size, fd->simdata->smx_file);
+ return simcall_file_write(fd->simdata->smx_file, size);
}
/** \ingroup msg_file_management
}
//SIMIX FILE READ
-void SIMIX_pre_file_read(smx_simcall_t simcall, sg_storage_size_t size,
- smx_file_t fd)
+void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size)
{
- smx_action_t action = SIMIX_file_read(simcall->issuer, size, fd);
+ smx_action_t action = SIMIX_file_read(simcall->issuer, fd, size);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
-smx_action_t SIMIX_file_read(smx_process_t process, sg_storage_size_t size,
- smx_file_t fd)
+smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_size_t size)
{
smx_action_t action;
smx_host_t host = process->smx_host;
action->io.host = host;
action->io.surf_io =
- surf_workstation_model->extension.workstation.read(host, size,
- fd->surf_file);
+ surf_workstation_model->extension.workstation.read(host, fd->surf_file, size);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
}
//SIMIX FILE WRITE
-void SIMIX_pre_file_write(smx_simcall_t simcall, sg_storage_size_t size,
- smx_file_t fd)
+void SIMIX_pre_file_write(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size)
{
- smx_action_t action = SIMIX_file_write(simcall->issuer, size, fd);
+ smx_action_t action = SIMIX_file_write(simcall->issuer, fd, size);
xbt_fifo_push(action->simcalls, simcall);
simcall->issuer->waiting_action = action;
}
-smx_action_t SIMIX_file_write(smx_process_t process,
- sg_storage_size_t size, smx_file_t fd)
+smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_storage_size_t size)
{
smx_action_t action;
smx_host_t host = process->smx_host;
action->io.host = host;
action->io.surf_io =
- surf_workstation_model->extension.workstation.write(host, size,
- fd->surf_file);
+ surf_workstation_model->extension.workstation.write(host, fd->surf_file, size);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data);
void* SIMIX_pre_file_get_data(smx_simcall_t simcall,smx_file_t fd);
void SIMIX_pre_file_set_data(smx_simcall_t simcall, smx_file_t fd, void *data);
-void SIMIX_pre_file_read(smx_simcall_t simcall, sg_storage_size_t size, smx_file_t fd);
-void SIMIX_pre_file_write(smx_simcall_t simcall, sg_storage_size_t size, smx_file_t fd);
+void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_storage_size_t size);
+void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_storage_size_t size);
void SIMIX_pre_file_open(smx_simcall_t simcall, const char* mount,
const char* path);
void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fd);
void* SIMIX_file_get_data(smx_file_t fd);
void SIMIX_file_set_data(smx_file_t fd, void *data);
-smx_action_t SIMIX_file_read(smx_process_t process, sg_storage_size_t size,
- smx_file_t fd);
-smx_action_t SIMIX_file_write(smx_process_t process, sg_storage_size_t size,
- smx_file_t fd);
+smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_storage_size_t size);
+smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_storage_size_t size);
smx_action_t SIMIX_file_open(smx_process_t process, const char* storage,
const char* path);
smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd);
ACTION(SIMCALL_SEM_GET_CAPACITY, sem_get_capacity, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \
ACTION(SIMCALL_FILE_GET_DATA, file_get_data, WITH_ANSWER, TPTR(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_FILE_SET_DATA, file_set_data, WITH_ANSWER, TVOID(result), TSPEC(fd, smx_file_t), TPTR(data)) sep \
-ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TSIZE(result), TSIZE(size), TSPEC(fd, smx_file_t)) sep \
-ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TSIZE(size), TSPEC(fd, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TSIZE(result), TSPEC(fd, smx_file_t), TSIZE(size)) sep \
+ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TSPEC(fd, smx_file_t), TSIZE(size)) sep \
ACTION(SIMCALL_FILE_OPEN, file_open, WITHOUT_ANSWER, TSPEC(result, smx_file_t), TSTRING(mount), TSTRING(path)) sep \
ACTION(SIMCALL_FILE_CLOSE, file_close, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \
ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITH_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \
* \ingroup simix_file_management
*
*/
-sg_storage_size_t simcall_file_read(sg_storage_size_t size, smx_file_t fd)
+sg_storage_size_t simcall_file_read(smx_file_t fd, sg_storage_size_t size)
{
- return simcall_BODY_file_read(size, fd);
+ return simcall_BODY_file_read(fd, size);
}
/**
* \ingroup simix_file_management
*
*/
-sg_storage_size_t simcall_file_write(sg_storage_size_t size, smx_file_t fd)
+sg_storage_size_t simcall_file_write(smx_file_t fd, sg_storage_size_t size)
{
- return simcall_BODY_file_write(size, fd);
+ return simcall_BODY_file_write(fd, size);
}
/**
return action;
}
-static surf_action_t storage_action_read(void *storage, sg_storage_size_t size,
- surf_file_t fd)
+static surf_action_t storage_action_read(void *storage, surf_file_t fd, sg_storage_size_t size)
{
if(size > fd->size)
size = fd->size;
return action;
}
-static surf_action_t storage_action_write(void *storage, sg_storage_size_t size,
- surf_file_t fd)
+static surf_action_t storage_action_write(void *storage, surf_file_t fd, sg_storage_size_t size)
{
char *filename = fd->name;
XBT_DEBUG("\tWrite file '%s' size '%" PRIu64 "/%" PRIu64 "'",
return model->extension.storage.close(st, fd);
}
-static surf_action_t ws_action_read(void *workstation, sg_storage_size_t size,
- surf_file_t fd)
+static surf_action_t ws_action_read(void *workstation, surf_file_t fd, sg_storage_size_t size)
{
storage_t st = find_storage_on_mount_list(workstation, fd->mount);
XBT_DEBUG("READ on disk '%s'",st->generic_resource.name);
surf_model_t model = st->generic_resource.model;
- return model->extension.storage.read(st, size, fd);
+ return model->extension.storage.read(st, fd, size);
}
-static surf_action_t ws_action_write(void *workstation, sg_storage_size_t size,
- surf_file_t fd)
+static surf_action_t ws_action_write(void *workstation, surf_file_t fd, sg_storage_size_t size)
{
storage_t st = find_storage_on_mount_list(workstation, fd->mount);
XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);
surf_model_t model = st->generic_resource.model;
- return model->extension.storage.write(st, size, fd);
+ return model->extension.storage.write(st, fd, size);
}
static int ws_file_unlink(void *workstation, surf_file_t fd)