From: Pierre Veyre Date: Tue, 27 May 2014 07:46:57 +0000 (+0200) Subject: Add use of MSG_file_set_data and MSG_file_get_data in examples X-Git-Tag: v3_11~34^2~7 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b78c6264b77d9db0c0e405db56b781476f4e7856 Add use of MSG_file_set_data and MSG_file_get_data in examples --- diff --git a/examples/msg/io/storage.c b/examples/msg/io/storage.c index 05f14d1094..22325ae64a 100644 --- a/examples/msg/io/storage.c +++ b/examples/msg/io/storage.c @@ -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"); + // 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); - 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); diff --git a/examples/msg/io/storage.tesh b/examples/msg/io/storage.tesh index f3512c028f..e81f583fe3 100644 --- a/examples/msg/io/storage.tesh +++ b/examples/msg/io/storage.tesh @@ -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' +> [ 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 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: