/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include <string>
#include <unordered_map>
#include "simgrid/s4u.hpp"
simgrid::s4u::Storage* storage = kv.second;
// Retrieve disk's information
- sg_size_t free_size = storage->getSizeFree();
- sg_size_t used_size = storage->getSizeUsed();
- sg_size_t size = storage->getSize();
-
- XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->getName(), mountpoint.c_str(), used_size,
- free_size, size);
+ XBT_INFO(" %s (%s) Used: %llu; Free: %llu; Total: %llu.", storage->getCname(), mountpoint.c_str(),
+ sg_storage_get_size_used(storage), sg_storage_get_size_free(storage), sg_storage_get_size(storage));
}
}
file->move(newpath);
// Test attaching some user data to the file
- file->setUserdata(xbt_strdup("777"));
- XBT_INFO("User data attached to the file: %s", static_cast<char*>(file->getUserdata()));
- xbt_free(file->getUserdata());
+ file->setUserdata(new std::string("777"));
+ std::string* file_data = static_cast<std::string*>(file->getUserdata());
+ XBT_INFO("User data attached to the file: %s", file_data->c_str());
+ delete file_data;
// Close the file
delete file;
// Now attach some user data to disk1
- XBT_INFO("Get/set data for storage element: %s", storage->getName());
+ XBT_INFO("Get/set data for storage element: %s", storage->getCname());
XBT_INFO(" Uninitialized storage data: '%s'", static_cast<char*>(storage->getUserdata()));
- storage->setUserdata(xbt_strdup("Some user data"));
- XBT_INFO(" Set and get data: '%s'", static_cast<char*>(storage->getUserdata()));
-
- xbt_free(storage->getUserdata());
+ storage->setUserdata(new std::string("Some user data"));
+ std::string* storage_data = static_cast<std::string*>(storage->getUserdata());
+ XBT_INFO(" Set and get data: '%s'", storage_data->c_str());
+ delete storage_data;
}
};
int main(int argc, char **argv)
{
simgrid::s4u::Engine e(&argc, argv);
+ sg_storage_file_system_init();
e.loadPlatform("../../platforms/storage/storage.xml");
simgrid::s4u::Actor::createActor("host", simgrid::s4u::Host::by_name("denise"), MyHost());
e.run();