never really used.
XBT_INFO("\tOpen file '%s'",file->name);
- read = MSG_file_read(ptr,10000000,sizeof(char*),file); // Read for 10MB
+ read = MSG_file_read(ptr,10000000,file); // Read for 10MB
XBT_INFO("\tHave read %zu on %s",read,file->name);
- write = MSG_file_write(ptr,100000,sizeof(char*),file); // Write for 100KB
+ write = MSG_file_write(ptr,100000,file); // Write for 100KB
XBT_INFO("\tHave written %zu on %s",write,file->name);
- read = MSG_file_read(ptr,110000,sizeof(char*),file); // Read for 110KB
+ read = MSG_file_read(ptr,110000,file); // Read for 110KB
XBT_INFO("\tHave read %zu on %s (of size %zu)",read,file->name,
MSG_file_get_size(file));
file = MSG_file_open(mount,FILENAME1);
// Write into the new file
- write = MSG_file_write(ptr,100000,sizeof(char*),file); // Write for 100Ko
+ write = MSG_file_write(ptr,100000,file); // Write for 100Ko
XBT_INFO("\tHave written %zu on %s",write,file->name);
// Close the file
/************************** File handling ***********************************/
-XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb,
- msg_file_t fd);
-XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb,
- msg_file_t fd);
+XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, msg_file_t fd);
+XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, msg_file_t fd);
XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path);
XBT_PUBLIC(int) MSG_file_close(msg_file_t fd);
XBT_PUBLIC(size_t) MSG_file_get_size(msg_file_t fd);
double max_duration);
XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
-XBT_PUBLIC(double) simcall_file_read(void* ptr, size_t size, size_t nmemb,
- smx_file_t fd);
+XBT_PUBLIC(size_t) simcall_file_read(void* ptr, size_t size, smx_file_t fd);
XBT_PUBLIC(size_t) simcall_file_write(const void* ptr, size_t size,
- size_t nmemb, smx_file_t fd);
+ smx_file_t fd);
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);
(*env)->ReleaseStringUTFChars(env, jpath, path);
}
JNIEXPORT jlong JNICALL
-Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize, jlong jnmemb) {
+Java_org_simgrid_msg_File_read(JNIEnv *env, jobject jfile, jlong jsize) {
msg_file_t file = jfile_get_native(env, jfile);
size_t n;
- n = MSG_file_read(NULL,(size_t)jsize, (size_t)jnmemb, file);
+ n = MSG_file_read(NULL,(size_t)jsize, file);
return (jlong)n;
}
JNIEXPORT jlong JNICALL
-Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize, jlong jnmemb) {
+Java_org_simgrid_msg_File_write(JNIEnv *env, jobject jfile, jlong jsize) {
msg_file_t file = jfile_get_native(env, jfile);
size_t n;
- n = MSG_file_write(NULL, (size_t)jsize, (size_t)jnmemb, file);
+ n = MSG_file_write(NULL, (size_t)jsize, file);
return (jlong)n;
}
JNIEXPORT void JNICALL
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, void* ptr, double size, size_t nmemb,
+ surf_action_t(*read) (void *storage, void* ptr, size_t size,
surf_file_t fd);
surf_action_t(*write) (void *storage, const void* ptr, size_t size,
- size_t nmemb, surf_file_t fd);
+ surf_file_t fd);
surf_action_t(*stat) (void *storage, surf_file_t fd);
surf_action_t(*ls) (void *storage, const char *path);
} s_surf_model_extension_storage_t;
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, void* ptr, size_t size, size_t nmemb,
+ surf_action_t(*read) (void *workstation, void* ptr, size_t size,
surf_file_t fd);
surf_action_t(*write) (void *workstation, const void* ptr, size_t size,
- size_t nmemb, surf_file_t fd);
+ surf_file_t fd);
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);
* \brief Read elements of a file
*
* \param ptr buffer to where the data is copied
- * \param size of each element
- * \param nmemb is the number of elements of data to read
+ * \param size of the file to read
* \param fd is a the file descriptor
* \return the number of items successfully read
*/
-size_t MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t fd)
+size_t MSG_file_read(void* ptr, size_t size, msg_file_t fd)
{
- return simcall_file_read(ptr, size, nmemb, fd->simdata->smx_file);
+ return simcall_file_read(ptr, size, fd->simdata->smx_file);
}
/** \ingroup msg_file_management
* \brief Write elements into a file
*
* \param ptr buffer from where the data is copied
- * \param size of each element
- * \param nmemb is the number of elements of data to write
+ * \param size of the file to write
* \param fd is a the file descriptor
* \return the number of items successfully write
*/
-size_t MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t fd)
+size_t MSG_file_write(const void* ptr, size_t size, msg_file_t fd)
{
- return simcall_file_write(ptr, size, nmemb, fd->simdata->smx_file);
+ return simcall_file_write(ptr, size, fd->simdata->smx_file);
}
/** \ingroup msg_file_management
//SIMIX FILE READ
void SIMIX_pre_file_read(smx_simcall_t simcall, void *ptr, size_t size,
- size_t nmemb, smx_file_t fd)
+ smx_file_t fd)
{
- smx_action_t action = SIMIX_file_read(simcall->issuer, ptr, size, nmemb, fd);
+ smx_action_t action = SIMIX_file_read(simcall->issuer, ptr, size, fd);
xbt_fifo_push(action->simcalls, 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 fd)
+ smx_file_t fd)
{
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, ptr, size, nmemb,
+ surf_workstation_model->extension.workstation.read(host, ptr, size,
fd->surf_file);
surf_workstation_model->action_data_set(action->io.surf_io, action);
//SIMIX FILE WRITE
void SIMIX_pre_file_write(smx_simcall_t simcall, const void *ptr, size_t size,
- size_t nmemb, smx_file_t fd)
+ smx_file_t fd)
{
- smx_action_t action = SIMIX_file_write(simcall->issuer, ptr, size, nmemb, fd);
+ smx_action_t action = SIMIX_file_write(simcall->issuer, ptr, size, fd);
xbt_fifo_push(action->simcalls, 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 fd)
+ size_t size, smx_file_t fd)
{
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, ptr, size,
- nmemb, fd->surf_file);
+ fd->surf_file);
surf_workstation_model->action_data_set(action->io.surf_io, action);
XBT_DEBUG("Create io action %p", action);
#include "smx_smurf_private.h"
void SIMIX_pre_file_read(smx_simcall_t simcall, void *ptr, size_t size,
- size_t nmemb, smx_file_t fd);
+ smx_file_t fd);
void SIMIX_pre_file_write(smx_simcall_t simcall, const void *ptr, size_t size,
- size_t nmemb, smx_file_t fd);
+ smx_file_t fd);
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);
size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd);
smx_action_t SIMIX_file_read(smx_process_t process, void* ptr, size_t size,
- size_t nmemb, smx_file_t fd);
+ smx_file_t fd);
smx_action_t SIMIX_file_write(smx_process_t process, const void* ptr,
- size_t size, size_t nmemb, smx_file_t fd);
+ size_t size, smx_file_t fd);
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_ACQUIRE, sem_acquire, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \
ACTION(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem_acquire_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t), TDOUBLE(timeout)) sep \
ACTION(SIMCALL_SEM_GET_CAPACITY, sem_get_capacity, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \
-ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TDOUBLE(result), TPTR(ptr), TSIZE(size), TSIZE(nmemb), TSPEC(fd, smx_file_t)) sep \
-ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TCPTR(ptr), TSIZE(size), TSIZE(nmemb), TSPEC(fd, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TSIZE(result), TPTR(ptr), TSIZE(size), TSPEC(fd, smx_file_t)) sep \
+ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TCPTR(ptr), TSIZE(size), TSPEC(fd, smx_file_t)) 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
*
*/
-double simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t fd)
+size_t simcall_file_read(void* ptr, size_t size, smx_file_t fd)
{
- return simcall_BODY_file_read(ptr, size, nmemb, fd);
+ return simcall_BODY_file_read(ptr, size, fd);
}
/**
* \ingroup simix_file_management
*
*/
-size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb,
+size_t simcall_file_write(const void* ptr, size_t size,
smx_file_t fd)
{
- return simcall_BODY_file_write(ptr, size, nmemb, fd);
+ return simcall_BODY_file_write(ptr, size, fd);
}
/**
return action;
}
-static surf_action_t storage_action_read(void *storage, void* ptr, double size,
- size_t nmemb, surf_file_t fd)
+static surf_action_t storage_action_read(void *storage, void* ptr,
+ size_t size, surf_file_t fd)
{
if(size > fd->size)
size = fd->size;
}
static surf_action_t storage_action_write(void *storage, const void* ptr,
- size_t size, size_t nmemb,
- surf_file_t fd)
+ size_t size, surf_file_t fd)
{
char *filename = fd->name;
XBT_DEBUG("\tWrite file '%s' size '%zu/%zu'",filename,size,fd->size);
}
static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size,
- size_t nmemb, surf_file_t fd)
+ surf_file_t fd)
{
storage_t st = find_storage_on_mount_list(workstation, fd->storage);
XBT_DEBUG("READ on disk '%s'",st->generic_resource.name);
surf_model_t model = st->generic_resource.model;
- return model->extension.storage.read(st, ptr, (double)size, nmemb, fd);
+ return model->extension.storage.read(st, ptr, size, fd);
}
static surf_action_t ws_action_write(void *workstation, const void* ptr,
- size_t size, size_t nmemb, surf_file_t fd)
+ size_t size, surf_file_t fd)
{
storage_t st = find_storage_on_mount_list(workstation, fd->storage);
XBT_DEBUG("WRITE on disk '%s'",st->generic_resource.name);
surf_model_t model = st->generic_resource.model;
- return model->extension.storage.write(st, ptr, size, nmemb, fd);
+ return model->extension.storage.write(st, ptr, size, fd);
}
static int ws_file_unlink(void *workstation, surf_file_t fd)