X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fada53aa725e58a781895225b190f44961cb04e2..0a9ce6009d2a98f3ef66a8a1b020106f09e5568c:/src/s4u/s4u_storage.cpp diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index 5cb09af9e0..9123343960 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -3,6 +3,7 @@ /* 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 "simgrid/s4u/File.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Storage.hpp" #include "simgrid/simix.hpp" @@ -10,6 +11,10 @@ #include namespace simgrid { +namespace xbt { +template class Extendable; +} + namespace s4u { std::map* allStorages() @@ -52,17 +57,27 @@ Host* Storage::getHost() sg_size_t Storage::getSizeFree() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getFreeSize(); }); + FileSystemStorageExt* file_system = extension(); + + return pimpl_->getSize() - file_system->getUsedSize(); } sg_size_t Storage::getSizeUsed() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); }); + FileSystemStorageExt* file_system = extension(); + return file_system->getUsedSize(); } void Storage::decrUsedSize(sg_size_t size) { - simgrid::simix::kernelImmediate([this, size] { pimpl_->usedSize_ -= size; }); + FileSystemStorageExt* file_system = extension(); + file_system->decrUsedSize(size); +} + +void Storage::incrUsedSize(sg_size_t size) +{ + FileSystemStorageExt* file_system = extension(); + file_system->incrUsedSize(size); } sg_size_t Storage::getSize() @@ -87,7 +102,8 @@ void Storage::setProperty(std::string key, std::string value) std::map* Storage::getContent() { - return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); }); + FileSystemStorageExt* file_system = extension(); + return file_system->getContent(); } sg_size_t Storage::read(sg_size_t size)