-
-sg_size_t sg_storage_get_size_free(sg_storage_t st)
-{
- return st->extension<FileSystemStorageExt>()->get_size() - st->extension<FileSystemStorageExt>()->get_used_size();
-}
-
-sg_size_t sg_storage_get_size_used(sg_storage_t st)
-{
- return st->extension<FileSystemStorageExt>()->get_used_size();
-}
-
-sg_size_t sg_storage_get_size(sg_storage_t st)
-{
- return st->extension<FileSystemStorageExt>()->get_size();
-}
-
-xbt_dict_t sg_storage_get_content(sg_storage_t storage)
-{
- std::map<std::string, sg_size_t>* content = storage->extension<simgrid::s4u::FileSystemStorageExt>()->get_content();
- // Note: ::operator delete is ok here (no destructor called) since the dict elements are of POD type sg_size_t.
- xbt_dict_t content_as_dict = xbt_dict_new_homogeneous(::operator delete);
-
- for (auto const& entry : *content) {
- sg_size_t* psize = new sg_size_t;
- *psize = entry.second;
- xbt_dict_set(content_as_dict, entry.first.c_str(), psize);
- }
- return content_as_dict;
-}
-
-xbt_dict_t sg_host_get_storage_content(sg_host_t host)
-{
- xbt_assert((host != nullptr), "Invalid parameters");
- xbt_dict_t contents = xbt_dict_new_homogeneous(nullptr);
- for (auto const& elm : host->get_mounted_storages())
- xbt_dict_set(contents, elm.first.c_str(), sg_storage_get_content(elm.second));
-
- return contents;
-}