1 /* Copyright (c) 2017. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "src/surf/FileImpl.hpp"
8 #include "src/surf/HostImpl.hpp"
10 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_file, surf, "Logging specific to the SURF file module");
14 int FileImpl::seek(sg_offset_t offset, int origin)
18 current_position_ = offset;
21 current_position_ += offset;
24 current_position_ = size_ + offset;
31 int FileImpl::unlink(sg_host_t host)
33 simgrid::surf::StorageImpl* st = host->pimpl_->findStorageOnMountList(mount_point_.c_str());
34 /* Check if the file is on this storage */
35 if (st->content_->find(path_) == st->content_->end()) {
36 XBT_WARN("File %s is not on disk %s. Impossible to unlink", cname(), st->cname());
39 XBT_DEBUG("UNLINK %s on disk '%s'", cname(), st->cname());
40 st->usedSize_ -= size_;
42 // Remove the file from storage
43 st->content_->erase(path_);