Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / examples / c / io-disk-raw / io-disk-raw.c
index 4349974..c6e4fa7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2021. 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. */
@@ -17,7 +17,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(disk, "Messages specific for this simulation");
 
-static void host(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
+static void host(int argc, char* argv[])
 {
   const char* host_name = sg_host_get_name(sg_host_self());
 
@@ -27,30 +27,30 @@ static void host(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
   /* - Retrieve all disks from current host */
   unsigned int disk_count;
   sg_disk_t* disk_list;
-  sg_host_disks(sg_host_self(), &disk_count, &disk_list);
+  sg_host_get_disks(sg_host_self(), &disk_count, &disk_list);
 
   for (unsigned int i = 0; i < disk_count; i++)
-    XBT_INFO("Disk name: %s (read: %.0f B/s -- write: %.0f B/s ", sg_disk_name(disk_list[i]),
+    XBT_INFO("Disk name: %s (read: %.0f B/s -- write: %.0f B/s ", sg_disk_get_name(disk_list[i]),
              sg_disk_read_bandwidth(disk_list[i]), sg_disk_write_bandwidth(disk_list[i]));
 
   /* - Write 400,000 bytes on Disk1 */
   sg_disk_t disk  = disk_list[0];
   sg_size_t write = sg_disk_write(disk, 400000);
-  XBT_INFO("Wrote %llu bytes on '%s'", write, sg_disk_name(disk));
+  XBT_INFO("Wrote %llu bytes on '%s'", write, sg_disk_get_name(disk));
 
   /*  - Now read 200,000 bytes */
   sg_size_t read = sg_disk_read(disk, 200000);
-  XBT_INFO("Read %llu bytes on '%s'", read, sg_disk_name(disk));
+  XBT_INFO("Read %llu bytes on '%s'", read, sg_disk_get_name(disk));
 
   /* - Attach some user data to disk1 */
   XBT_INFO("*** Get/set data for storage element: Disk1 ***");
 
-  char* data = (char*)sg_disk_data(disk);
+  char* data = (char*)sg_disk_get_data(disk);
 
   XBT_INFO("Get storage data: '%s'", data ? data : "No user data");
 
-  sg_disk_data_set(disk, xbt_strdup("Some user data"));
-  data = (char*)sg_disk_data(disk);
+  sg_disk_set_data(disk, xbt_strdup("Some user data"));
+  data = (char*)sg_disk_get_data(disk);
   XBT_INFO("Set and get data: '%s'", data);
   free(data);
   free(disk_list);
@@ -63,9 +63,8 @@ int main(int argc, char* argv[])
 
   simgrid_register_function("host", host);
 
-  size_t host_count;
-  sg_host_t* hosts;
-  simgrid_get_all_hosts(&host_count, &hosts);
+  size_t host_count = sg_host_count();
+  sg_host_t* hosts  = sg_host_list();
 
   for (long i = 0; i < host_count; i++) {
     XBT_INFO("*** %s properties ****", sg_host_get_name(hosts[i]));
@@ -80,8 +79,7 @@ int main(int argc, char* argv[])
 
   free(hosts);
 
-  sg_actor_t actor = sg_actor_init("", sg_host_by_name("bob"));
-  sg_actor_start(actor, host, 0, NULL);
+  sg_actor_create("", sg_host_by_name("bob"), host, 0, NULL);
 
   simgrid_run();