Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change parameters order for msg_file_read, msg_file_write and in all their internal...
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Wed, 2 Oct 2013 09:14:07 +0000 (11:14 +0200)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Wed, 2 Oct 2013 09:14:07 +0000 (11:14 +0200)
12 files changed:
examples/msg/io/file.c
examples/msg/io/file_unlink.c
include/msg/msg.h
include/simgrid/simix.h
src/include/surf/surf.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
src/surf/storage.c
src/surf/workstation.c

index 7fe3888..733c24d 100644 (file)
@@ -49,13 +49,13 @@ int host(int argc, char *argv[])
 
   XBT_INFO("\tOpen file '%s'",file->fullname);
 
 
   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);
 
   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);
 
   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));
 
   XBT_INFO("\tHave read    %zu on %s (of size %zu)",read,file->fullname,
       MSG_file_get_size(file));
 
index ace947f..a604a18 100644 (file)
@@ -46,7 +46,7 @@ int host(int argc, char *argv[])
   file = MSG_file_open(mount,FILENAME1, NULL);
 
   // Write into the new 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_INFO("\tHave written %zu on %s",write,file->fullname);
 
   // Close the file
index 083d34a..2e68208 100644 (file)
@@ -81,8 +81,8 @@ XBT_PUBLIC(const char *) MSG_environment_as_get_model(msg_as_t as);
 XBT_PUBLIC(xbt_dynar_t) MSG_environment_as_get_hosts(msg_as_t as);
 
 /************************** File handling ***********************************/
 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);
 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);
index 3dbbba2..1cce813 100644 (file)
@@ -481,8 +481,8 @@ XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
 /*****************************   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);
 /*****************************   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);
 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);
index b1afac9..1e34b2c 100644 (file)
@@ -233,8 +233,8 @@ typedef struct surf_network_model_extension_public {
 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);
 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(*stat) (void *storage, surf_file_t fd);
   surf_action_t(*ls) (void *storage, const char *path);
   xbt_dict_t(*get_properties) (const void *storage);
@@ -279,20 +279,20 @@ typedef struct surf_workstation_model_extension_public {
   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(*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);
   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);
 
   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;
   xbt_dict_t (*get_storage_list) (void *workstation);
 
 } s_surf_model_extension_workstation_t;
index 69a18e2..1d4c19e 100644 (file)
@@ -85,9 +85,9 @@ void MSG_file_dump (msg_file_t fd){
  * \param fd is a the file descriptor
  * \return the number of bytes successfully read
  */
  * \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
 }
 
 /** \ingroup msg_file_management
@@ -97,9 +97,9 @@ sg_storage_size_t MSG_file_read(sg_storage_size_t size, msg_file_t fd)
  * \param fd is a the file descriptor
  * \return the number of bytes successfully write
  */
  * \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
 }
 
 /** \ingroup msg_file_management
index a657e1b..aee5550 100644 (file)
@@ -55,16 +55,14 @@ void SIMIX_file_set_data(smx_file_t fd, void *data){
 }
 
 //SIMIX FILE READ
 }
 
 //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;
 }
 
   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;
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -85,8 +83,7 @@ smx_action_t SIMIX_file_read(smx_process_t process, sg_storage_size_t size,
 
   action->io.host = host;
   action->io.surf_io =
 
   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);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -95,16 +92,14 @@ smx_action_t SIMIX_file_read(smx_process_t process, sg_storage_size_t size,
 }
 
 //SIMIX FILE WRITE
 }
 
 //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;
 }
 
   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;
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -125,8 +120,7 @@ smx_action_t SIMIX_file_write(smx_process_t process,
 
   action->io.host = host;
   action->io.surf_io =
 
   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);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
index c6032e4..3cc0356 100644 (file)
@@ -23,8 +23,8 @@ static inline smx_storage_priv_t SIMIX_storage_priv(smx_storage_t storage){
 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);
 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_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);
@@ -36,10 +36,8 @@ xbt_dynar_t SIMIX_pre_file_get_info(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);
 
 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);
 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);
index 0b57815..1e191f7 100644 (file)
@@ -349,8 +349,8 @@ ACTION(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem_acquire_timeout, WITHOUT_ANSWER, TVOID(r
 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_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 \
 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 \
index 1492cdd..bcc6ba8 100644 (file)
@@ -1203,18 +1203,18 @@ void simcall_file_set_data(smx_file_t fd, void *data)
  * \ingroup simix_file_management
  *
  */
  * \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
  *
  */
 }
 
 /**
  * \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);
 }
 
 /**
 }
 
 /**
index 971b778..c36d8e6 100644 (file)
@@ -125,8 +125,7 @@ static surf_action_t storage_action_close(void *storage, surf_file_t fd)
   return action;
 }
 
   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;
 {
   if(size > fd->size)
     size = fd->size;
@@ -134,8 +133,7 @@ static surf_action_t storage_action_read(void *storage, sg_storage_size_t size,
   return action;
 }
 
   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 "'",
 {
   char *filename = fd->name;
   XBT_DEBUG("\tWrite file '%s' size '%" PRIu64 "/%" PRIu64 "'",
index a949716..bbd9664 100644 (file)
@@ -400,22 +400,20 @@ static surf_action_t ws_action_close(void *workstation, surf_file_t fd)
   return model->extension.storage.close(st, fd);
 }
 
   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;
 {
   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;
 {
   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)
 }
 
 static int ws_file_unlink(void *workstation, surf_file_t fd)