Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update file.c example since new modifications in surf and simix for storage.
authornavarro <navarro@caraja.(none)>
Fri, 2 Mar 2012 18:25:50 +0000 (19:25 +0100)
committernavarro <navarro@caraja.(none)>
Fri, 2 Mar 2012 18:29:22 +0000 (19:29 +0100)
examples/msg/io/file.c
examples/platforms/storage.xml

index 29ebc85..69e45db 100644 (file)
@@ -17,20 +17,24 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(io_file,
 int host(int argc, char *argv[])
 {
   m_file_t file;
 int host(int argc, char *argv[])
 {
   m_file_t file;
-  file = MSG_file_open("test.txt","rw");
+  char* mount = bprintf("C:");
+
+  file = MSG_file_open(mount,"test.txt","rw");
   XBT_INFO("Host '%s' open %p",MSG_host_get_name(MSG_host_self()), file);
 
   XBT_INFO("Host '%s' open %p",MSG_host_get_name(MSG_host_self()), file);
 
-  size_t read = MSG_file_read(NULL,0,0,file);
+  size_t read = MSG_file_read(mount,NULL,0,0,file);
   XBT_INFO("Host '%s' read %zu", MSG_host_get_name(MSG_host_self()), read);
 
   XBT_INFO("Host '%s' read %zu", MSG_host_get_name(MSG_host_self()), read);
 
-  size_t write = MSG_file_write(NULL,0,0,file);
+  size_t write = MSG_file_write(mount,NULL,0,0,file);
   XBT_INFO("Host '%s' write %zu", MSG_host_get_name(MSG_host_self()), write);
 
   XBT_INFO("Host '%s' write %zu", MSG_host_get_name(MSG_host_self()), write);
 
-  int res = MSG_file_stat(0,NULL);
+  int res = MSG_file_stat(mount,0,NULL);
   XBT_INFO("Host '%s' stat %d",MSG_host_get_name(MSG_host_self()), res);
 
   XBT_INFO("Host '%s' stat %d",MSG_host_get_name(MSG_host_self()), res);
 
-  res = MSG_file_close(file);
+  res = MSG_file_close(mount,file);
   XBT_INFO("Host '%s' close %d",MSG_host_get_name(MSG_host_self()), res);
   XBT_INFO("Host '%s' close %d",MSG_host_get_name(MSG_host_self()), res);
+
+  free(mount);
   return 0;
 }
 
   return 0;
 }
 
index 9495b89..7fca614 100644 (file)
@@ -31,7 +31,7 @@
                </host>         
                
                <host id="alice" power="1000000000">
                </host>         
                
                <host id="alice" power="1000000000">
-                       <mstorage typeId="crucial" name="C:"/>
+                       <mount id="Disk1" name="C:"/>
                </host>
 
                <storage id="Disk4" typeId="wdigital"/>
                </host>
 
                <storage id="Disk4" typeId="wdigital"/>