-/* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2013-2020. 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. */
XBT_LOG_NEW_DEFAULT_CATEGORY(storage, "Messages specific for this simulation");
-static void display_disk_properties(simgrid::s4u::Disk* disk)
+static void display_disk_properties(const simgrid::s4u::Disk* disk)
{
const std::unordered_map<std::string, std::string>* props = disk->get_properties();
if (not props->empty()) {
// Send file
XBT_INFO("%s sends %llu to %s", simgrid::s4u::this_actor::get_cname(), read_size, remote_host.c_str());
- std::string* payload = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size));
- simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(remote_host);
+ auto* payload = new std::string(simgrid::xbt::string_printf("%s %llu", dest.c_str(), read_size));
+ auto* mailbox = simgrid::s4u::Mailbox::by_name(remote_host);
mailbox->put(payload, read_size);
simgrid::s4u::this_actor::sleep_for(.4);
}
-static void display_disk_content(simgrid::s4u::Disk* disk)
+static void display_disk_content(const simgrid::s4u::Disk* disk)
{
XBT_INFO("*** Dump a disk ***");
XBT_INFO("Print the content of the disk: %s", disk->get_cname());
- const std::map<std::string, sg_size_t>* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
+ const auto* content = disk->extension<simgrid::s4u::FileSystemDiskExt>()->get_content();
if (not content->empty()) {
for (auto const& entry : *content)
XBT_INFO(" %s size: %llu bytes", entry.first.c_str(), entry.second);
}
}
-static void disk_info(simgrid::s4u::Host* host)
+static void disk_info(const simgrid::s4u::Host* host)
{
XBT_INFO("*** Disk info on %s ***", host->get_cname());
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(simgrid::s4u::this_actor::get_host()->get_cname());
XBT_INFO("Server waiting for transfers ...");
- while (1) {
- const std::string* msg = static_cast<std::string*>(mailbox->get());
+ while (true) {
+ const std::string* msg = mailbox->get<std::string>();
if (*msg == "finalize") { // Shutdown ...
delete msg;
break;