X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/22e6546d2c6f14864cc93c4ed1470d8e8c1e2d95..c7e6ef1da2a535a2854db29a1dd8e469446a11f7:/src/s4u/s4u_storage.cpp diff --git a/src/s4u/s4u_storage.cpp b/src/s4u/s4u_storage.cpp index c3066bd3a6..9123343960 100644 --- a/src/s4u/s4u_storage.cpp +++ b/src/s4u/s4u_storage.cpp @@ -3,13 +3,18 @@ /* 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/File.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Storage.hpp" #include "simgrid/simix.hpp" +#include "src/surf/StorageImpl.hpp" #include namespace simgrid { +namespace xbt { +template class Extendable; +} + namespace s4u { std::map* allStorages() @@ -52,12 +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) +{ + 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() @@ -70,19 +90,30 @@ 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() { - 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) +{ + return simcall_storage_read(pimpl_, size); +} + +sg_size_t Storage::write(sg_size_t size) +{ + return simcall_storage_write(pimpl_, size); } /*************