simgrid::xbt::Extension<Disk, FileSystemDiskExt> FileSystemDiskExt::EXTENSION_ID;
simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
-Disk* File::find_local_disk_on(const Host* host)
+const Disk* File::find_local_disk_on(const Host* host)
{
- Disk* d = nullptr;
+ const Disk* d = nullptr;
size_t longest_prefix_length = 0;
for (auto const& disk : host->get_disks()) {
std::string current_mount;
longest_prefix_length = current_mount.length();
d = disk;
}
- if (longest_prefix_length > 0) { /* Mount point found, split fullpath_ into mount_name and path+filename*/
- mount_point_ = fullpath_.substr(0, longest_prefix_length);
- if (mount_point_ == std::string("/"))
- path_ = fullpath_;
- else
- path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
- XBT_DEBUG("%s + %s", mount_point_.c_str(), path_.c_str());
- } else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath_.c_str(), host->get_cname());
+ xbt_assert(longest_prefix_length > 0, "Can't find mount point for '%s' on '%s'", fullpath_.c_str(),
+ host->get_cname());
+ /* Mount point found, split fullpath_ into mount_name and path+filename*/
+ mount_point_ = fullpath_.substr(0, longest_prefix_length);
+ if (mount_point_ == std::string("/"))
+ path_ = fullpath_;
+ else
+ path_ = fullpath_.substr(longest_prefix_length, fullpath_.length());
+ XBT_DEBUG("%s + %s", mount_point_.c_str(), path_.c_str());
}
return d;
}
* @ingroup plugin_filesystem
*
* @param size of the file to write
+ * @param write_inside
* @return the number of bytes successfully write or -1 if an error occurred
*/
sg_size_t File::write(sg_size_t size, bool write_inside)
const char* size_str = ptr->get_property("size");
std::string dummyfile;
if (size_str)
- size_ = surf_parse_get_size(dummyfile, -1, size_str, "disk size", ptr->get_name());
+ size_ = xbt_parse_get_size(dummyfile, -1, size_str, "disk size " + ptr->get_name());
const char* current_mount_str = ptr->get_property("mount");
if (current_mount_str)