Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add use of MSG_file_set_data and MSG_file_get_data in examples
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Tue, 27 May 2014 07:46:57 +0000 (09:46 +0200)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Tue, 27 May 2014 08:51:18 +0000 (10:51 +0200)
examples/msg/io/storage.c
examples/msg/io/storage.tesh

index 05f14d1..22325ae 100644 (file)
@@ -89,15 +89,21 @@ static int host(int argc, char *argv[]){
   XBT_INFO("*** Move '/tmp/data.txt' into '/tmp/simgrid.readme'");
   MSG_file_move(file, "/home/tmp/simgrid.readme");
 
   XBT_INFO("*** Move '/tmp/data.txt' into '/tmp/simgrid.readme'");
   MSG_file_move(file, "/home/tmp/simgrid.readme");
 
+  // Attach some user data to the file
+  MSG_file_set_data(file, xbt_strdup("777"));
+  // Retrieve these data
+  char *data = MSG_file_get_data(file);
+  XBT_INFO("User data attached to the file: %s", data);
+
   MSG_file_close(file);
   free(file_name);
 
   // Now attach some user data to disk1
   XBT_INFO("*** Get/set data for storage element: %s ***",storage_name);
 
   MSG_file_close(file);
   free(file_name);
 
   // Now attach some user data to disk1
   XBT_INFO("*** Get/set data for storage element: %s ***",storage_name);
 
-  char *data = MSG_storage_get_data(storage);
+  data = MSG_storage_get_data(storage);
 
 
-  XBT_INFO("Get data: '%s'", data);
+  XBT_INFO("Get storage data: '%s'", data);
 
   MSG_storage_set_data(storage, xbt_strdup("Some user data"));
   data = MSG_storage_get_data(storage);
 
   MSG_storage_set_data(storage, xbt_strdup("Some user data"));
   data = MSG_storage_get_data(storage);
index f3512c0..e81f583 100644 (file)
@@ -30,8 +30,9 @@ $ ${bindir:=.}/io/storage ${srcdir:=.}/examples/platforms/storage.xml "--log=roo
 >              Storage Type: 'single_SSD'
 >              Content Type: 'txt_unix'
 > [  0.007917] (1:(null)@denise) *** Move '/tmp/data.txt' into '/tmp/simgrid.readme'
 >              Storage Type: 'single_SSD'
 >              Content Type: 'txt_unix'
 > [  0.007917] (1:(null)@denise) *** Move '/tmp/data.txt' into '/tmp/simgrid.readme'
+> [  0.007917] (1:(null)@denise) User data attached to the file: 777
 > [  0.007917] (1:(null)@denise) *** Get/set data for storage element: Disk4 ***
 > [  0.007917] (1:(null)@denise) *** Get/set data for storage element: Disk4 ***
-> [  0.007917] (1:(null)@denise) Get data: '(null)'
+> [  0.007917] (1:(null)@denise) Get storage data: '(null)'
 > [  0.007917] (1:(null)@denise) Set and get data: 'Some user data'
 > [  0.007917] (1:(null)@denise) *** Dump content of denise ***
 > [  0.007917] (1:(null)@denise) Print the content of mount point: c:
 > [  0.007917] (1:(null)@denise) Set and get data: 'Some user data'
 > [  0.007917] (1:(null)@denise) *** Dump content of denise ***
 > [  0.007917] (1:(null)@denise) Print the content of mount point: c: