X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e526ad06508e0193155f0591b43d7d9e9e92f6c7..3f38d568f0b8155a643e15a3171177060ee15c3c:/src/surf/FileImpl.cpp diff --git a/src/surf/FileImpl.cpp b/src/surf/FileImpl.cpp index 6497944880..4a85e3de8e 100644 --- a/src/surf/FileImpl.cpp +++ b/src/surf/FileImpl.cpp @@ -27,37 +27,6 @@ FileImpl::FileImpl(sg_storage_t st, std::string path, std::string mount) : path_ } } -Action* FileImpl::read(sg_size_t size) -{ - XBT_DEBUG("READ %s on disk '%s'", cname(), location_->getCname()); - if (current_position_ + size > size_) { - if (current_position_ > size_) { - size = 0; - } else { - size = size_ - current_position_; - } - current_position_ = size_; - } else - current_position_ += size; - - return location_->read(size); -} - -Action* FileImpl::write(sg_size_t size) -{ - XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", cname(), location_->getCname(), size, size_); - - StorageAction* action = location_->write(size); - action->file_ = this; - /* Substract the part of the file that might disappear from the used sized on the storage element */ - location_->usedSize_ -= (size_ - current_position_); - // If the storage is full before even starting to write - if (location_->usedSize_ >= location_->getSize()) { - action->setState(Action::State::failed); - } - return action; -} - int FileImpl::seek(sg_offset_t offset, int origin) { switch (origin) { @@ -79,10 +48,10 @@ int FileImpl::unlink() { /* Check if the file is on this storage */ if (location_->getContent()->find(path_) == location_->getContent()->end()) { - XBT_WARN("File %s is not on disk %s. Impossible to unlink", cname(), location_->getCname()); + XBT_WARN("File %s is not on disk %s. Impossible to unlink", getCname(), location_->getCname()); return -1; } else { - XBT_DEBUG("UNLINK %s on disk '%s'", cname(), location_->getCname()); + XBT_DEBUG("UNLINK %s on disk '%s'", getCname(), location_->getCname()); location_->usedSize_ -= size_; // Remove the file from storage