X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e2680c4776709548e15f400af83ffe4a2cf5eb49..be433eeb2c53b337a26b3d712f64b408fca53ae9:/src/s4u/s4u_file.cpp diff --git a/src/s4u/s4u_file.cpp b/src/s4u/s4u_file.cpp index 25595a9212..37b4f3ae48 100644 --- a/src/s4u/s4u_file.cpp +++ b/src/s4u/s4u_file.cpp @@ -25,9 +25,9 @@ File::File(const char* fullpath, sg_host_t host, void* userdata) : path_(fullpat Storage* st = nullptr; size_t longest_prefix_length = 0; std::string path; - XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, host->cname()); + XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, host->getCname()); - for (auto mnt : host->mountedStorages()) { + for (auto mnt : host->getMountedStorages()) { XBT_DEBUG("See '%s'", mnt.first.c_str()); mount_point = std::string(fullpath).substr(0, mnt.first.size()); @@ -41,11 +41,11 @@ File::File(const char* fullpath, sg_host_t host, void* userdata) : path_(fullpat mount_point = std::string(fullpath).substr(0, longest_prefix_length); path = std::string(fullpath).substr(longest_prefix_length, strlen(fullpath)); } else - xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->cname()); + xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->getCname()); pimpl_ = simcall_file_open(mount_point.c_str(), path.c_str(), st); - storage_type = st->type(); - storageId = st->name(); + storage_type = st->getType(); + storageId = st->getName(); } File::~File() @@ -90,17 +90,18 @@ sg_size_t File::tell() void File::move(const char* fullpath) { - simcall_file_move(pimpl_,fullpath); + sg_host_t host = Host::current(); + simgrid::simix::kernelImmediate([this, host, fullpath] { pimpl_->move(host, fullpath); }); } -void File::unlink() +int File::unlink() { - simcall_file_unlink(pimpl_, Host::current()); + return unlink(Host::current()); } -void File::unlink(sg_host_t host) +int File::unlink(sg_host_t host) { - simcall_file_unlink(pimpl_, host); + return simgrid::simix::kernelImmediate([this, host] { return pimpl_->unlink(host); }); } }} // namespace simgrid::s4u