From 6bab9511541790024758a2e8d84b943e2905cc7d Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Tue, 13 Mar 2018 10:25:31 +0100 Subject: [PATCH] do not use deprecated function in our examples/tests --- examples/s4u/io-file-remote/s4u-io-file-remote.cpp | 11 +++++------ .../storage_client_server/storage_client_server.cpp | 10 ++++------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/examples/s4u/io-file-remote/s4u-io-file-remote.cpp b/examples/s4u/io-file-remote/s4u-io-file-remote.cpp index f93c062440..1724054b3f 100644 --- a/examples/s4u/io-file-remote/s4u-io-file-remote.cpp +++ b/examples/s4u/io-file-remote/s4u-io-file-remote.cpp @@ -54,19 +54,18 @@ int main(int argc, char** argv) e.loadPlatform(argv[1]); e.registerFunction("host", host); e.loadDeployment(argv[2]); - std::map allStorages; - simgrid::s4u::getStorageList(&allStorages); + std::vector allStorages = e.getAllStorages(); for (auto const& s : allStorages) { - XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA, - sg_storage_get_size_free(s.second) / INMEGA, s.second->getCname()); + XBT_INFO("Init: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA, + sg_storage_get_size_free(s) / INMEGA, s->getCname()); } e.run(); for (auto const& s : allStorages) { - XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s.second) / INMEGA, - sg_storage_get_size_free(s.second) / INMEGA, s.second->getCname()); + XBT_INFO("End: %llu/%llu MiB used/free on '%s'", sg_storage_get_size_used(s) / INMEGA, + sg_storage_get_size_free(s) / INMEGA, s->getCname()); } XBT_INFO("Simulation time %g", simgrid::s4u::Engine::getClock()); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 3426e6bf13..01cb653b1b 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -90,14 +90,12 @@ static void get_set_storage_data(const std::string& storage_name) static void dump_platform_storages() { - std::map* storages = new std::map; - simgrid::s4u::getStorageList(storages); + std::vector storages = simgrid::s4u::Engine::getInstance()->getAllStorages(); - for (auto const& storage : *storages) { - XBT_INFO("Storage %s is attached to %s", storage.first.c_str(), storage.second->getHost()->getCname()); - storage.second->setProperty("other usage", "gpfs"); + for (auto const& s : storages) { + XBT_INFO("Storage %s is attached to %s", s->getCname(), s->getHost()->getCname()); + s->setProperty("other usage", "gpfs"); } - delete storages; } static void storage_info(simgrid::s4u::Host* host) -- 2.20.1