Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Wed, 13 Jun 2012 13:33:05 +0000 (15:33 +0200)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Wed, 13 Jun 2012 13:33:05 +0000 (15:33 +0200)
15 files changed:
examples/msg/io/file.c
examples/msg/masterslave/platform_script.lua
examples/platforms/storage.xml
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/storage_private.h
src/surf/surfxml_parse.c
src/surf/workstation.c

index b7a6134..ed8e91a 100644 (file)
@@ -34,9 +34,10 @@ int host(int argc, char *argv[])
 {
   msg_file_t file = NULL;
   s_msg_stat_t stat;
-
-  char* mount = bprintf("C:");
+  void *ptr = NULL;
+  char* mount = bprintf("/home");
   size_t read,write;
+
   if(!strcmp(MSG_process_get_name(MSG_process_self()),"0"))
     file = MSG_file_open(mount,FILENAME1,"rw");
   else if(!strcmp(MSG_process_get_name(MSG_process_self()),"1"))
@@ -49,20 +50,20 @@ int host(int argc, char *argv[])
 
   XBT_INFO("\tOpen file '%s'",file->name);
 
-  read = MSG_file_read(mount,NULL,10000000,sizeof(char*),file);     // Read for 10Mo
+  read = MSG_file_read(ptr,10000000,sizeof(char*),file);     // Read for 10Mo
   XBT_INFO("\tHaving read  %zu \ton %s",read,file->name);
 
-  write = MSG_file_write(mount,NULL,100000,sizeof(char*),file);  // Write for 100Ko
+  write = MSG_file_write(ptr,100000,sizeof(char*),file);  // Write for 100Ko
   XBT_INFO("\tHaving write %zu \ton %s",write,file->name);
 
-  read = MSG_file_read(mount,NULL,10000000,sizeof(char*),file);     // Read for 10Mo
+  read = MSG_file_read(ptr,10000000,sizeof(char*),file);     // Read for 10Mo
   XBT_INFO("\tHaving read  %zu \ton %s",read,file->name);
 
-  MSG_file_stat(mount,file,&stat);
+  MSG_file_stat(file,&stat);
   XBT_INFO("\tFile %s Size %d",file->name,(int)stat.size);
 
   XBT_INFO("\tClose file '%s'",file->name);
-  MSG_file_close(mount,file);
+  MSG_file_close(file);
 
   free(mount);
   return 0;
index 32215a9..75dac4f 100644 (file)
@@ -1,7 +1,7 @@
 -- Copyright (c) 2010-2012. The SimGrid Team. All rights reserved.
 
 -- This program is free software; you can redistribute it and/or modify it
---under the terms of the license (GNU LGPL) which comes with this package.
+-- under the terms of the license (GNU LGPL) which comes with this package.
 
 
 -- This file describes a platform very similar to the small_platform.xml, but in lua
 
 require "simgrid"
 
-  simgrid.AS.new{id="AS0",mode="Full"}; 
-
-  simgrid.AS.addHost{AS="AS0",id="Tremblay",power=98095000};
-  simgrid.AS.addHost{AS="AS0",id="Jupiter",power=76296000};
-  simgrid.AS.addHost{AS="AS0",id="Fafard",power=76296000};
-  simgrid.AS.addHost{AS="AS0",id="Ginette",power=48492000};
-  simgrid.AS.addHost{AS="AS0",id="Bourassa",power=48492000};
-
-    -- create Links
-  for i=10,0,-1 do
-    simgrid.AS.addLink{AS="AS0",id=i,bandwidth=252750+ i*768,latency=0.000270544+i*0.087};   
-  end
-  -- simgrid.route.new(src_id,des_id,links_nb,links_list)
-   simgrid.AS.addRoute("AS0","Tremblay","Jupiter",{"1"});
-   simgrid.AS.addRoute("AS0","Tremblay","Fafard",{"0","1","2","3","4","8"});
-   simgrid.AS.addRoute("AS0","Tremblay","Ginette",{"3","4","5"});
-   simgrid.AS.addRoute("AS0","Tremblay","Bourassa",{"0","1","3","2","4","6","7"});
-
-   simgrid.AS.addRoute("AS0","Jupiter","Tremblay",{"1"});
-   simgrid.AS.addRoute("AS0","Jupiter","Fafard",{"0","1","2","3","4","8","9"});
-   simgrid.AS.addRoute("AS0","Jupiter","Ginette",{"3","4","5","9"});
-   simgrid.AS.addRoute("AS0","Jupiter","Bourassa",{"0","1","2","3","4","6","7","9"});
-   simgrid.AS.addRoute("AS0","Fafard","Tremblay",{"0","1","2","3","4","8"});
-   simgrid.AS.addRoute("AS0","Fafard","Jupiter",{"0","1","2","3","4","8","9"});
-   simgrid.AS.addRoute("AS0","Fafard","Ginette",{"0","1","2","5","8"});
-   simgrid.AS.addRoute("AS0","Fafard","Bourassa",{"6","7","8"});
-  
-   simgrid.AS.addRoute("AS0","Ginette","Tremblay",{"3","4","5"});
-   simgrid.AS.addRoute("AS0","Ginette","Jupiter",{"3","4","5","9"});
-   simgrid.AS.addRoute("AS0","Ginette","Fafard",{"0","1","2","5","8"});
-   simgrid.AS.addRoute("AS0","Ginette","Bourassa",{"0","1","2","5","6","7"});
-
-   simgrid.AS.addRoute("AS0","Bourassa","Tremblay",{"0","1","3","2","4","6","7"});
-   simgrid.AS.addRoute("AS0","Bourassa","Jupiter",{"0","1","2","3","4","6","7","9"});
-   simgrid.AS.addRoute("AS0","Bourassa","Fafard",{"6","7","8"});
-   simgrid.AS.addRoute("AS0","Bourassa","Ginette",{"0","1","2","5","6","7"});
-  
-   --Save Platform
-   simgrid.msg_register_platform();
-
-  --Set Application
-   simgrid.host.set_function{host="Tremblay",fct="master",args="20,550000000,1000000,4"};
-   simgrid.host.set_function{host="Bourassa",fct="slave",args="0"};
-   simgrid.host.set_function{host="Jupiter",fct="slave",args="1"};
-   simgrid.host.set_function{host="Fafard",fct="slave",args="2"};
-   simgrid.host.set_function{host="Ginette",fct="slave",args="3"};
-   
-  --Save Application 
-   simgrid.msg_register_application(); 
+simgrid.platf.open();
 
+simgrid.platf.AS_open{id="AS0",mode="Full"};
 
+simgrid.platf.host_new{id="Tremblay",power=98095000};
+simgrid.platf.host_new{id="Jupiter",power=76296000};
+simgrid.platf.host_new{id="Fafard",power=76296000};
+simgrid.platf.host_new{id="Ginette",power=48492000};
+simgrid.platf.host_new{id="Bourassa",power=48492000};
+
+-- create Links
+for i=10,0,-1 do
+    simgrid.platf.link_new{id=i,bandwidth=252750+ i*768,latency=0.000270544+i*0.087};
+end
+
+simgrid.platf.route_new{src="Tremblay",dest="Jupiter",links="1",symmetrical=0};
+simgrid.platf.route_new{src="Tremblay",dest="Fafard",links="0,1,2,3,4,8",symmetrical=0};
+simgrid.platf.route_new{src="Tremblay",dest="Ginette",links="3,4,5",symmetrical=0};
+simgrid.platf.route_new{src="Tremblay",dest="Bourassa",links="0,1,3,2,4,6,7",symmetrical=0};
+
+simgrid.platf.route_new{src="Jupiter",dest="Tremblay",links="1",symmetrical=0};
+simgrid.platf.route_new{src="Jupiter",dest="Fafard",links="0,1,2,3,4,8,9",symmetrical=0};
+simgrid.platf.route_new{src="Jupiter",dest="Ginette",links="3,4,5,9",symmetrical=0};
+simgrid.platf.route_new{src="Jupiter",dest="Bourassa",links="0,1,2,3,4,6,7,9",symmetrical=0};
+
+simgrid.platf.route_new{src="Fafard",dest="Tremblay",links="0,1,2,3,4,8",symmetrical=0};
+simgrid.platf.route_new{src="Fafard",dest="Jupiter",links="0,1,2,3,4,8,9",symmetrical=0};
+simgrid.platf.route_new{src="Fafard",dest="Ginette",links="0,1,2,5,8",symmetrical=0};
+simgrid.platf.route_new{src="Fafard",dest="Bourassa",links="6,7,8",symmetrical=0};
+
+simgrid.platf.route_new{src="Ginette",dest="Tremblay",links="3,4,5",symmetrical=0};
+simgrid.platf.route_new{src="Ginette",dest="Jupiter",links="3,4,5,9",symmetrical=0};
+simgrid.platf.route_new{src="Ginette",dest="Fafard",links="0,1,2,5,8",symmetrical=0};
+simgrid.platf.route_new{src="Ginette",dest="Bourassa",links="0,1,2,5,6,7",symmetrical=0};
+
+simgrid.platf.route_new{src="Bourassa",dest="Tremblay",links="0,1,3,2,4,6,7",symmetrical=0};
+simgrid.platf.route_new{src="Bourassa",dest="Jupiter",links="0,1,2,3,4,6,7,9",symmetrical=0};
+simgrid.platf.route_new{src="Bourassa",dest="Fafard",links="6,7,8",symmetrical=0};
+simgrid.platf.route_new{src="Bourassa",dest="Ginette",links="0,1,2,5,6,7",symmetrical=0};
+simgrid.platf.AS_close();
+
+simgrid.platf.close();
+simgrid.msg_register_platform();
+
+--Set Application
+simgrid.host.set_function{host="Tremblay",fct="master",args="20,550000000,1000000,4"};
+simgrid.host.set_function{host="Bourassa",fct="slave",args="0"};
+simgrid.host.set_function{host="Jupiter",fct="slave",args="1"};
+simgrid.host.set_function{host="Fafard",fct="slave",args="2"};
+simgrid.host.set_function{host="Ginette",fct="slave",args="3"};
+
+--Save Application
+simgrid.msg_register_application();
index 1f32718..8046a21 100644 (file)
                <storage id="Disk4" typeId="wdigital"/>
 
                <host id="bob" power="1000000000">
-                       <mount id="Disk1" name="C:"/>                   
+                       <mount id="Disk1" name="/home"/>                        
                </host>         
                
                <host id="alice" power="1000000000">
-                       <mount id="Disk2" name="C:"/>
+                       <mount id="Disk2" name="/home"/>
                </host>
 
                <host id="carl" power="1000000000">             
-                       <mount id="Disk3" name="C:"/>           
+                       <mount id="Disk3" name="/home"/>                
                </host>
                
                <host id="denise" power="1000000000">
-                       <mount id="Disk4" name="C:"/>   
+                       <mount id="Disk4" name="/home"/>        
                </host>
 
                <link id="link1" bandwidth="125000000" latency="5E-5" />
index b69b691..dd7c38c 100644 (file)
@@ -56,11 +56,11 @@ XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void);
 
 
 /************************** File handling ***********************************/
-XBT_PUBLIC(size_t) MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb, msg_file_t stream);
-XBT_PUBLIC(size_t) MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, msg_file_t stream);
-XBT_PUBLIC(msg_file_t) MSG_file_open(const char* storage, const char* path, const char* mode);
-XBT_PUBLIC(int) MSG_file_close(const char* storage, msg_file_t fp);
-XBT_PUBLIC(int) MSG_file_stat(const char* storage, msg_file_t fd, s_msg_stat_t *buf);
+XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream);
+XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream);
+XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode);
+XBT_PUBLIC(int) MSG_file_close(msg_file_t fp);
+XBT_PUBLIC(int) MSG_file_stat(msg_file_t fd, s_msg_stat_t *buf);
 
 
 /************************** Host handling ***********************************/
index f1d989f..dfd7ac0 100644 (file)
@@ -429,11 +429,11 @@ 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(const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
-XBT_PUBLIC(size_t) simcall_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, smx_file_t stream);
+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* storage, const char* path, const char* mode);
-XBT_PUBLIC(int) simcall_file_close(const char* storage, smx_file_t fp);
-XBT_PUBLIC(int) simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf);
+XBT_PUBLIC(int) simcall_file_close(smx_file_t fp);
+XBT_PUBLIC(int) simcall_file_stat(smx_file_t fd, s_file_stat_t *buf);
 
 SG_END_DECL()
 #endif                          /* _SIMIX_SIMIX_H */
index 6a7131d..806d6e9 100644 (file)
@@ -218,7 +218,7 @@ typedef struct surf_network_model_extension_public {
  */
 
 typedef struct surf_storage_model_extension_public {
-  surf_action_t(*open) (void *storage, const char* path, const char* mode);
+  surf_action_t(*open) (void *storage, const char* mount, const char* path, const char* mode);
   surf_action_t(*close) (void *storage, surf_file_t fp);
   surf_action_t(*read) (void *storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
   surf_action_t(*write) (void *storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
@@ -252,10 +252,10 @@ typedef struct surf_workstation_model_extension_public {
   double (*get_link_bandwidth) (const void *link);                                         /**< Return the current bandwidth of a network link */
   double (*get_link_latency) (const void *link);                                           /**< Return the current latency of a network link */
   surf_action_t(*open) (void *workstation, const char* storage, const char* path, const char* mode);
-  surf_action_t(*close) (void *workstation, const char* storage, surf_file_t fp);
-  surf_action_t(*read) (void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
-  surf_action_t(*write) (void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
-  surf_action_t(*stat) (void *workstation, const char* storage, surf_file_t stream);
+  surf_action_t(*close) (void *workstation, surf_file_t fp);
+  surf_action_t(*read) (void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+  surf_action_t(*write) (void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream);
+  surf_action_t(*stat) (void *workstation, surf_file_t stream);
   int (*link_shared) (const void *link);
    xbt_dict_t(*get_properties) (const void *resource);
   void* (*link_create_resource) (const char *name,
index 0e8b55d..affae9d 100644 (file)
@@ -22,37 +22,35 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg,
 /** \ingroup msg_file_management
  * \brief Read elements of a file
  *
- * \param storage is the name where find the stream
  * \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 stream to read
  * \return the number of items successfully read
  */
-size_t MSG_file_read(const char* storage, void* ptr, size_t size, size_t nmemb,  msg_file_t stream)
+size_t MSG_file_read(void* ptr, size_t size, size_t nmemb,  msg_file_t stream)
 {
-  return simcall_file_read(storage, ptr, size, nmemb, stream->simdata->smx_file);
+  return simcall_file_read(ptr, size, nmemb, stream->simdata->smx_file);
 }
 
 /** \ingroup msg_file_management
  * \brief Write elements into a file
  *
- * \param storage is the name where find the stream
  * \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 stream to write
  * \return the number of items successfully write
  */
-size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t nmemb, msg_file_t stream)
+size_t MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream)
 {
-  return simcall_file_write(storage, ptr, size, nmemb, stream->simdata->smx_file);
+  return simcall_file_write(ptr, size, nmemb, stream->simdata->smx_file);
 }
 
 /** \ingroup msg_file_management
  * \brief Opens the file whose name is the string pointed to by path
  *
- * \param storage is the name where find the file to open
+ * \param mount is the mount point where find the file is located
  * \param path is the file location on the storage
  * \param mode points to a string beginning with one of the following sequences (Additional characters may follow these sequences.):
  *      r      Open text file for reading.  The stream is positioned at the beginning of the file.
@@ -66,38 +64,36 @@ size_t MSG_file_write(const char* storage, const void* ptr, size_t size, size_t
  *
  * \return An #msg_file_t associated to the file
  */
-msg_file_t MSG_file_open(const char* storage, const char* path, const char* mode)
+msg_file_t MSG_file_open(const char* mount, const char* path, const char* mode)
 {
   msg_file_t file = xbt_new(s_msg_file_t,1);
   file->name = strdup(path);
   file->simdata = xbt_new0(s_simdata_file_t,1);
-  file->simdata->smx_file = simcall_file_open(storage, path, mode);
+  file->simdata->smx_file = simcall_file_open(mount, path, mode);
   return file;
 }
 
 /** \ingroup msg_file_management
  * \brief Close the file
  *
- * \param storage is the name where find the stream
  * \param fp is the file to close
  * \return 0 on success or 1 on error
  */
-int MSG_file_close(const char* storage, msg_file_t fp)
+int MSG_file_close(msg_file_t fp)
 {
-  return simcall_file_close(storage, fp->simdata->smx_file);
+  return simcall_file_close(fp->simdata->smx_file);
 }
 
 /** \ingroup msg_file_management
  * \brief Stats the file pointed by fd
  *
- * \param storage is the name where find the stream
  * \param fd is the file descriptor (#msg_file_t)
  * \param buf is the return structure with informations
  * \return 0 on success or 1 on error
  */
-int MSG_file_stat(const char* storage, msg_file_t fd, s_msg_stat_t *buf)
+int MSG_file_stat(msg_file_t fd, s_msg_stat_t *buf)
 {
   int res;
-  res = simcall_file_stat(storage, fd->simdata->smx_file, buf);
+  res = simcall_file_stat(fd->simdata->smx_file, buf);
   return res;
 }
index 6c7868c..8030aca 100644 (file)
@@ -18,7 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix,
 void SIMIX_pre_file_read(smx_simcall_t simcall)
 {
   smx_action_t action = SIMIX_file_read(simcall->issuer,
-      simcall->file_read.storage,
       simcall->file_read.ptr,
       simcall->file_read.size,
       simcall->file_read.nmemb,
@@ -27,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, const char* storage, 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;
@@ -47,7 +46,7 @@ smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* p
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, storage, ptr, size, nmemb, stream->surf_file),
+  action->io.surf_io = surf_workstation_model->extension.workstation.read(host->host, ptr, size, nmemb, stream->surf_file),
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -59,7 +58,6 @@ smx_action_t SIMIX_file_read(smx_process_t process, const char* storage, void* p
 void SIMIX_pre_file_write(smx_simcall_t simcall)
 {
   smx_action_t action = SIMIX_file_write(simcall->issuer,
-      simcall->file_write.storage,
       simcall->file_write.ptr,
       simcall->file_write.size,
       simcall->file_write.nmemb,
@@ -68,7 +66,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 char* storage, 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;
@@ -88,7 +86,7 @@ smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, storage, ptr, size, nmemb, stream->surf_file);
+  action->io.surf_io = surf_workstation_model->extension.workstation.write(host->host, ptr, size, nmemb, stream->surf_file);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -100,14 +98,14 @@ smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, const
 void SIMIX_pre_file_open(smx_simcall_t simcall)
 {
   smx_action_t action = SIMIX_file_open(simcall->issuer,
-      simcall->file_open.storage,
+      simcall->file_open.mount,
       simcall->file_open.path,
       simcall->file_open.mode);
   xbt_fifo_push(action->simcalls, simcall);
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const char* path, const char* mode)
+smx_action_t SIMIX_file_open(smx_process_t process ,const char* mount, const char* path, const char* mode)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -127,7 +125,7 @@ smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const c
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.open(host->host, storage, path, mode);
+  action->io.surf_io = surf_workstation_model->extension.workstation.open(host->host, mount, path, mode);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -139,13 +137,12 @@ smx_action_t SIMIX_file_open(smx_process_t process ,const char* storage, const c
 void SIMIX_pre_file_close(smx_simcall_t simcall)
 {
   smx_action_t action = SIMIX_file_close(simcall->issuer,
-      simcall->file_close.storage,
       simcall->file_close.fp);
   xbt_fifo_push(action->simcalls, simcall);
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, 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;
@@ -165,7 +162,7 @@ smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_fi
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, storage, fp->surf_file);
+  action->io.surf_io = surf_workstation_model->extension.workstation.close(host->host, fp->surf_file);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
@@ -177,14 +174,13 @@ smx_action_t SIMIX_file_close(smx_process_t process ,const char* storage, smx_fi
 void SIMIX_pre_file_stat(smx_simcall_t simcall)
 {
   smx_action_t action = SIMIX_file_stat(simcall->issuer,
-      simcall->file_stat.storage,
       simcall->file_stat.fd,
       simcall->file_stat.buf);
   xbt_fifo_push(action->simcalls, simcall);
   simcall->issuer->waiting_action = action;
 }
 
-smx_action_t SIMIX_file_stat(smx_process_t process ,const char* storage, smx_file_t fd, s_file_stat_t buf)
+smx_action_t SIMIX_file_stat(smx_process_t process, smx_file_t fd, s_file_stat_t buf)
 {
   smx_action_t action;
   smx_host_t host = process->smx_host;
@@ -203,7 +199,7 @@ smx_action_t SIMIX_file_stat(smx_process_t process ,const char* storage, smx_fil
 #endif
 
   action->io.host = host;
-  action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, storage, fd->surf_file);
+  action->io.surf_io = surf_workstation_model->extension.workstation.stat(host->host, fd->surf_file);
 
   surf_workstation_model->action_data_set(action->io.surf_io, action);
   XBT_DEBUG("Create io action %p", action);
index 945538d..c457a02 100644 (file)
@@ -16,11 +16,11 @@ 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, const char* storage, void* ptr, size_t size, size_t nmemb, smx_file_t stream);
-smx_action_t SIMIX_file_write(smx_process_t process, const char* storage, 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* storage, const char* path, const char* mode);
-smx_action_t SIMIX_file_close(smx_process_t process, const char* storage, smx_file_t fp);
-smx_action_t SIMIX_file_stat(smx_process_t process, const char* storage, smx_file_t fd, s_file_stat_t buf);
+smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fp);
+smx_action_t SIMIX_file_stat(smx_process_t process, smx_file_t fd, s_file_stat_t buf);
 
 void SIMIX_post_io(smx_action_t action);
 void SIMIX_io_destroy(smx_action_t action);
index 13233a7..6ce40e2 100644 (file)
@@ -509,7 +509,6 @@ typedef struct s_smx_simcall {
     } sem_get_capacity;
 
     struct {
-      const char* storage;
       void *ptr;
       size_t size;
       size_t nmemb;
@@ -518,7 +517,6 @@ typedef struct s_smx_simcall {
     } file_read;
 
     struct {
-      const char* storage;
       const void *ptr;
       size_t size;
       size_t nmemb;
@@ -527,20 +525,18 @@ typedef struct s_smx_simcall {
     } file_write;
 
     struct {
-      const char* storage;
+      const char* mount;
       const char* path;
       const char* mode;
       smx_file_t result;
     } file_open;
 
     struct {
-      const char* storage;
       smx_file_t fp;
       int result;
     } file_close;
 
     struct {
-      const char* storage;
       smx_file_t fd;
       s_file_stat_t buf;
       int result;
index a23bdda..880771b 100644 (file)
@@ -1203,12 +1203,11 @@ int simcall_sem_get_capacity(smx_sem_t sem)
   return simcall->sem_get_capacity.result;
 }
 
-size_t simcall_file_read(const char* storage, 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();
 
   simcall->call = SIMCALL_FILE_READ;
-  simcall->file_read.storage = storage;
   simcall->file_read.ptr = ptr;
   simcall->file_read.size = size;
   simcall->file_read.nmemb = nmemb;
@@ -1218,12 +1217,11 @@ size_t simcall_file_read(const char* storage, void* ptr, size_t size, size_t nme
   return simcall->file_read.result;
 }
 
-size_t simcall_file_write(const char* storage, 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();
 
   simcall->call = SIMCALL_FILE_WRITE;
-  simcall->file_write.storage = storage;
   simcall->file_write.ptr = ptr;
   simcall->file_write.size = size;
   simcall->file_write.nmemb = nmemb;
@@ -1233,12 +1231,12 @@ size_t simcall_file_write(const char* storage, const void* ptr, size_t size, siz
   return simcall->file_write.result;
 }
 
-smx_file_t simcall_file_open(const char* storage, const char* path, const char* mode)
+smx_file_t simcall_file_open(const char* mount, const char* path, const char* mode)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_FILE_OPEN;
-  simcall->file_open.storage = storage;
+  simcall->file_open.mount = mount;
   simcall->file_open.path = path;
   simcall->file_open.mode = mode;
   SIMIX_simcall_push(simcall->issuer);
@@ -1246,23 +1244,21 @@ smx_file_t simcall_file_open(const char* storage, const char* path, const char*
   return simcall->file_open.result;
 }
 
-int simcall_file_close(const char* storage, smx_file_t fp)
+int simcall_file_close(smx_file_t fp)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_FILE_CLOSE;
-  simcall->file_close.storage = storage;
   simcall->file_close.fp = fp;
   SIMIX_simcall_push(simcall->issuer);
 
   return simcall->file_close.result;
 }
 
-int simcall_file_stat(const char* storage, smx_file_t fd, s_file_stat_t *buf)
+int simcall_file_stat(smx_file_t fd, s_file_stat_t *buf)
 {
   smx_simcall_t simcall = SIMIX_simcall_mine();
   simcall->call = SIMCALL_FILE_STAT;
-  simcall->file_stat.storage = storage;
   simcall->file_stat.fd = fd;
 
   SIMIX_simcall_push(simcall->issuer);
index 5bde923..acf02e6 100644 (file)
@@ -50,7 +50,7 @@ static surf_action_t storage_action_stat(void *storage, surf_file_t stream)
   return action;
 }
 
-static surf_action_t storage_action_open(void *storage, const char* path, const char* mode)
+static surf_action_t storage_action_open(void *storage, const char* mount, const char* path, const char* mode)
 {
   XBT_DEBUG("\tOpen file '%s'",path);
   char *storage_type_id = xbt_lib_get_or_null(
@@ -64,6 +64,7 @@ static surf_action_t storage_action_open(void *storage, const char* path, const
   surf_file_t file = xbt_new0(s_surf_file_t,1);
   file->name = xbt_strdup(path);
   file->content = content;
+  file->storage = mount;
 
   surf_action_t action = storage_action_execute(storage,0, OPEN);
   action->file = (void *)file;
index 4b95551..d55fc6c 100644 (file)
@@ -30,6 +30,7 @@ typedef struct surf_stat { /* file status structure */
 typedef struct surf_file {
   char *name;
   surf_stat_t content;
+  const char* storage;
 } s_surf_file_t;
 
 typedef struct storage {
index 91e0254..c695806 100644 (file)
@@ -593,20 +593,22 @@ void STag_surfxml_random(void){
        surfxml_call_cb_functions(STag_surfxml_random_cb_list);
 }
 
-#define parse_method(type,name) \
-void type##Tag_surfxml_##name(void) \
-{ surfxml_call_cb_functions(type##Tag_surfxml_##name##_cb_list); }
-parse_method(E, route)
-parse_method(E, link_ctn)
-parse_method(E, process)
-parse_method(E, argument)
-parse_method(E, prop)
-parse_method(E, trace)
-parse_method(E, trace_connect)
-parse_method(E, random)
-parse_method(E, ASroute)
-parse_method(E, bypassRoute)
-parse_method(E, bypassASroute)
+#define parse_method(type,name)                                         \
+  void type##Tag_surfxml_##name(void)                                   \
+  { surfxml_call_cb_functions(type##Tag_surfxml_##name##_cb_list); }    \
+  void type##Tag_surfxml_##name(void)
+
+parse_method(E, route);
+parse_method(E, link_ctn);
+parse_method(E, process);
+parse_method(E, argument);
+parse_method(E, prop);
+parse_method(E, trace);
+parse_method(E, trace_connect);
+parse_method(E, random);
+parse_method(E, ASroute);
+parse_method(E, bypassRoute);
+parse_method(E, bypassASroute);
 
 /* Open and Close parse file */
 
index 346c706..0f3196e 100644 (file)
@@ -303,41 +303,41 @@ static storage_t find_storage_on_mount_list(void *workstation,const char* storag
   return st;
 }
 
-static surf_action_t ws_action_open(void *workstation, const char* storage, const char* path, const char* mode)
+static surf_action_t ws_action_open(void *workstation, const char* mount, const char* path, const char* mode)
 {
-  storage_t st = find_storage_on_mount_list(workstation, storage);
+  storage_t st = find_storage_on_mount_list(workstation, mount);
   XBT_DEBUG("OPEN on disk '%s'",st->generic_resource.name);
   surf_model_t model = st->generic_resource.model;
-  return model->extension.storage.open(st, path, mode);
+  return model->extension.storage.open(st, mount, path, mode);
 }
 
-static surf_action_t ws_action_close(void *workstation, const char* storage, surf_file_t fp)
+static surf_action_t ws_action_close(void *workstation, surf_file_t fp)
 {
-  storage_t st = find_storage_on_mount_list(workstation, storage);
+  storage_t st = find_storage_on_mount_list(workstation, fp->storage);
   XBT_DEBUG("CLOSE on disk '%s'",st->generic_resource.name);
   surf_model_t model = st->generic_resource.model;
   return model->extension.storage.close(st, fp);
 }
 
-static surf_action_t ws_action_read(void *workstation, const char* storage, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t ws_action_read(void *workstation, void* ptr, size_t size, size_t nmemb, surf_file_t stream)
 {
-  storage_t st = find_storage_on_mount_list(workstation, storage);
+  storage_t st = find_storage_on_mount_list(workstation, stream->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, size, nmemb, stream);
 }
 
-static surf_action_t ws_action_write(void *workstation, const char* storage, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
+static surf_action_t ws_action_write(void *workstation, const void* ptr, size_t size, size_t nmemb, surf_file_t stream)
 {
-  storage_t st = find_storage_on_mount_list(workstation, storage);
+  storage_t st = find_storage_on_mount_list(workstation, stream->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, stream);
 }
 
-static surf_action_t ws_action_stat(void *workstation, const char* storage, surf_file_t stream)
+static surf_action_t ws_action_stat(void *workstation, surf_file_t stream)
 {
-  storage_t st = find_storage_on_mount_list(workstation, storage);
+  storage_t st = find_storage_on_mount_list(workstation, stream->storage);
   XBT_DEBUG("STAT on disk '%s'",st->generic_resource.name);
   surf_model_t model = st->generic_resource.model;
   return model->extension.storage.stat(st,  stream);