X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/364eee0fc6ab77fddc5437ac273527bd27711724..12ad1e7c01058fada33cecf2d4c4cb8bf9874f9e:/src/s4u/s4u_storage.cpp diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index c3066bd3a6..d8f004ac63 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -3,23 +3,24 @@ /* 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. */ -#include "../surf/StorageImpl.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Storage.hpp" #include "simgrid/simix.hpp" +#include "src/plugins/file_system/FileSystem.hpp" +#include "src/surf/StorageImpl.hpp" #include namespace simgrid { +namespace xbt { +template class Extendable; +} + namespace s4u { -std::map* allStorages() +void getStorageList(std::map* whereTo) { - std::unordered_map* map = surf::StorageImpl::storagesMap(); - std::map* res = new std::map; - for (auto const& s : *map) - res->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface - - return res; + for (auto const& s : *surf::StorageImpl::storagesMap()) + whereTo->insert({s.first, &(s.second->piface_)}); // Convert each entry into its interface } Storage* Storage::byName(std::string name) @@ -50,39 +51,30 @@ Host* Storage::getHost() return attached_to_; } -sg_size_t Storage::getSizeFree() -{ - return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); }); -} - -sg_size_t Storage::getSizeUsed() -{ - return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); }); -} - -sg_size_t Storage::getSize() -{ - return pimpl_->getSize(); -} std::map* Storage::getProperties() { return simgrid::simix::kernelImmediate([this] { return pimpl_->getProperties(); }); } -const char* Storage::getProperty(const char* key) +const char* Storage::getProperty(std::string key) { return this->pimpl_->getProperty(key); } -void Storage::setProperty(const char* key, const char* value) +void Storage::setProperty(std::string key, std::string value) { simgrid::simix::kernelImmediate([this, key, value] { this->pimpl_->setProperty(key, value); }); } -std::map* Storage::getContent() +sg_size_t Storage::read(sg_size_t size) +{ + return simcall_storage_read(pimpl_, size); +} + +sg_size_t Storage::write(sg_size_t size) { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); }); + return simcall_storage_write(pimpl_, size); } /*************