/* 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 "HostImplem.hpp"
-
#include <simgrid/s4u/host.hpp>
#include "src/simix/smx_private.h"
#include "cpu_cas01.hpp"
+#include "src/surf/HostImpl.hpp"
#include "simgrid/sg_config.h"
#include "network_interface.hpp"
namespace simgrid {
namespace surf {
-simgrid::xbt::Extension<simgrid::s4u::Host, HostImplem> HostImplem::EXTENSION_ID;
+simgrid::xbt::Extension<simgrid::s4u::Host, HostImpl> HostImpl::EXTENSION_ID;
/*********
* Model *
*********/
-HostImplem *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){
+HostImpl *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){
xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL);
- HostImplem *host = new simgrid::surf::HostImplem(surf_host_model, name, props, storageList, cpu);
+ HostImpl *host = new simgrid::surf::HostImpl(surf_host_model, name, props, storageList, cpu);
XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
return host;
}
************/
-void HostImplem::classInit()
+void HostImpl::classInit()
{
if (!EXTENSION_ID.valid()) {
- EXTENSION_ID = simgrid::s4u::Host::extension_create<simgrid::surf::HostImplem>();
+ EXTENSION_ID = simgrid::s4u::Host::extension_create<simgrid::surf::HostImpl>();
}
}
-HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
+HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
xbt_dynar_t storage, Cpu *cpu)
: Resource(model, name)
, PropertyHolder(props)
p_params.ramsize = 0;
}
-HostImplem::HostImplem(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
+HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
xbt_dynar_t storage, Cpu *cpu)
: Resource(model, name, constraint)
, PropertyHolder(props)
}
/** @brief use destroy() instead of this destructor */
-HostImplem::~HostImplem()
+HostImpl::~HostImpl()
{
}
-void HostImplem::attach(simgrid::s4u::Host* host)
+void HostImpl::attach(simgrid::s4u::Host* host)
{
if (p_host != nullptr)
xbt_die("Already attached to host %s", host->name().c_str());
p_host = host;
}
-bool HostImplem::isOn() {
+bool HostImpl::isOn() {
return p_cpu->isOn();
}
-bool HostImplem::isOff() {
+bool HostImpl::isOff() {
return p_cpu->isOff();
}
-void HostImplem::turnOn(){
+void HostImpl::turnOn(){
if (isOff()) {
p_cpu->turnOn();
simgrid::s4u::Host::onStateChange(*this->p_host);
}
}
-void HostImplem::turnOff(){
+void HostImpl::turnOff(){
if (isOn()) {
p_cpu->turnOff();
simgrid::s4u::Host::onStateChange(*this->p_host);
}
}
-simgrid::surf::Storage *HostImplem::findStorageOnMountList(const char* mount)
+simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
{
simgrid::surf::Storage *st = NULL;
s_mount_t mnt;
return st;
}
-xbt_dict_t HostImplem::getMountedStorageList()
+xbt_dict_t HostImpl::getMountedStorageList()
{
s_mount_t mnt;
unsigned int i;
return storage_list;
}
-xbt_dynar_t HostImplem::getAttachedStorageList()
+xbt_dynar_t HostImpl::getAttachedStorageList()
{
xbt_lib_cursor_t cursor;
char *key;
return result;
}
-Action *HostImplem::open(const char* fullpath) {
+Action *HostImpl::open(const char* fullpath) {
simgrid::surf::Storage *st = NULL;
s_mount_t mnt;
return action;
}
-Action *HostImplem::close(surf_file_t fd) {
+Action *HostImpl::close(surf_file_t fd) {
simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName());
return st->close(fd);
}
-Action *HostImplem::read(surf_file_t fd, sg_size_t size) {
+Action *HostImpl::read(surf_file_t fd, sg_size_t size) {
simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName());
return st->read(fd, size);
}
-Action *HostImplem::write(surf_file_t fd, sg_size_t size) {
+Action *HostImpl::write(surf_file_t fd, sg_size_t size) {
simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName());
return st->write(fd, size);
}
-int HostImplem::unlink(surf_file_t fd) {
+int HostImpl::unlink(surf_file_t fd) {
if (!fd){
XBT_WARN("No such file descriptor. Impossible to unlink");
return -1;
}
}
-sg_size_t HostImplem::getSize(surf_file_t fd){
+sg_size_t HostImpl::getSize(surf_file_t fd){
return fd->size;
}
-xbt_dynar_t HostImplem::getInfo( surf_file_t fd)
+xbt_dynar_t HostImpl::getInfo( surf_file_t fd)
{
simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
sg_size_t *psize = xbt_new(sg_size_t, 1);
return info;
}
-sg_size_t HostImplem::fileTell(surf_file_t fd){
+sg_size_t HostImpl::fileTell(surf_file_t fd){
return fd->current_position;
}
-int HostImplem::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){
+int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin){
switch (origin) {
case SEEK_SET:
}
}
-int HostImplem::fileMove(surf_file_t fd, const char* fullpath){
+int HostImpl::fileMove(surf_file_t fd, const char* fullpath){
/* Check if the new full path is on the same mount point */
if(!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
sg_size_t *psize, *new_psize;
}
}
-xbt_dynar_t HostImplem::getVms()
+xbt_dynar_t HostImpl::getVms()
{
xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachine*), NULL);
iter != simgrid::surf::VMModel::ws_vms.end(); ++iter) {
simgrid::surf::VirtualMachine *ws_vm = &*iter;
- if (this == ws_vm->p_hostPM->extension(simgrid::surf::HostImplem::EXTENSION_ID))
+ if (this == ws_vm->p_hostPM->extension(simgrid::surf::HostImpl::EXTENSION_ID))
xbt_dynar_push(dyn, &ws_vm);
}
return dyn;
}
-void HostImplem::getParams(vm_params_t params)
+void HostImpl::getParams(vm_params_t params)
{
*params = p_params;
}
-void HostImplem::setParams(vm_params_t params)
+void HostImpl::setParams(vm_params_t params)
{
/* may check something here. */
p_params = *params;