xbt_dict_foreach(contents, curs, mountname, content){
XBT_INFO("Print the content of mount point: %s",mountname);
xbt_dict_foreach(content,curs2,path,size){
- XBT_INFO("%s size: %llu bytes", path, (sg_size_t)size);
+ XBT_INFO("%s size: %llu bytes", path, *(sg_size_t*)size);
}
xbt_dict_free(&content);
}
int desc_id = 0;
private:
- sg_host_t host_ = nullptr;
smx_file_t pimpl_ = nullptr;
const char* path_ = nullptr;
void* userdata_ = nullptr;
+ sg_host_t host_ = nullptr;
};
}
} // namespace simgrid::s4u
}
}
- if (longest_prefix_length > 0) {
+ if (storage_dest != nullptr) {
/* Mount point found, retrieve the host the storage is attached to */
dst_host = storage_dest->host();
}else{
xbt_dict_t MSG_storage_get_content(msg_storage_t storage)
{
std::map<std::string, sg_size_t>* content = storage->content();
- xbt_dict_t content_dict = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_t content_dict = xbt_dict_new_homogeneous(&free);
for (auto entry : *content) {
- xbt_dict_set(content_dict, entry.first.c_str(), (void*)entry.second, nullptr);
+ sg_size_t* psize = new sg_size_t;
+ *psize = entry.second;
+ xbt_dict_set(content_dict, entry.first.c_str(), psize, nullptr);
}
return content_dict;
}
File::File(const char* fullpath, void* userdata) : File(fullpath, Host::current(), userdata){};
-File::File(const char* fullpath, sg_host_t host, void* userdata) : path_(fullpath), userdata_(userdata)
+File::File(const char* fullpath, sg_host_t host, void* userdata) : path_(fullpath), userdata_(userdata), host_(host)
{
// this cannot fail because we get a xbt_die if the mountpoint does not exist
Storage* st = nullptr;
xbt_die("Can't find mount point for '%s' on '%s'", fullpath, host->cname());
pimpl_ = simcall_file_open(mount_point.c_str(), path.c_str(), st);
- host_ = host;
storage_type = st->type();
storageId = st->name();
}
namespace simgrid {
namespace s4u {
-// attached_to_ = Host::by_name_or_null(pimpl->attach_);
std::map<std::string, Storage*>* allStorages()
{
std::unordered_map<std::string, surf::StorageImpl*>* map = surf::StorageImpl::storagesMap();
const char* Storage::type()
{
- return pimpl_->typeId_;
+ return pimpl_->typeId_.c_str();
}
Host* Storage::host()
, piface_(this)
, size_(size)
, usedSize_(0)
- , typeId_(xbt_strdup(type_id))
+ , typeId_(type_id)
+ , attach_(attach)
, writeActions_(std::vector<StorageAction*>())
{
content_ = parseContent(content_name);
- attach_ = attach;
turnOn();
XBT_DEBUG("Create resource with Bread '%f' Bwrite '%f' and Size '%llu'", bread, bwrite, size);
constraintRead_ = lmm_constraint_new(maxminSystem, this, bread);
storageDestructedCallbacks(this);
if (content_ != nullptr)
delete content_;
-
- free(typeId_);
}
std::map<std::string, sg_size_t>* StorageImpl::parseContent(const char* filename)
std::map<std::string, sg_size_t>* content_;
sg_size_t size_;
sg_size_t usedSize_;
- char* typeId_;
+ std::string typeId_;
std::string attach_; // Name of the host to which this storage is attached.
// Only used until the platform is fully parsed only.
// Then the interface stores the Host directly.