X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/edab1d82e659722994c64246d5858eca2ff6703d..1300b88c419e071782315f75655a580b545c9dd3:/src/surf/storage_n11.cpp diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index aed2695293..7146a711c4 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -1,3 +1,9 @@ +/* Copyright (c) 2013-2014. The SimGrid Team. + * All rights reserved. */ + +/* 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 "storage_n11.hpp" #include "surf_private.h" @@ -321,13 +327,13 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta) if (action->getMaxDuration() != NO_MAX_DURATION) action->updateMaxDuration(delta); - if(action->getRemains() > 0 && + if(action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 && action->p_storage->m_usedSize == action->p_storage->m_size) { action->finish(); action->setState(SURF_ACTION_FAILED); - } else if ((action->getRemains() <= 0) && + } else if ((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) { action->finish(); @@ -357,7 +363,7 @@ StorageN11::StorageN11(StorageModelPtr model, const char* name, xbt_dict_t prope StorageActionPtr StorageN11::ls(const char* path) { - StorageActionPtr action = new StorageN11Action(getModel(), 0, m_stateCurrent != SURF_RESOURCE_ON, this, LS); + StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, LS); action->p_lsDict = NULL; xbt_dict_t ls_dict = xbt_dict_new_homogeneous(xbt_free); @@ -421,7 +427,7 @@ StorageActionPtr StorageN11::open(const char* mount, const char* path) file->mount = xbt_strdup(mount); file->current_position = 0; - StorageActionPtr action = new StorageN11Action(getModel(), 0, m_stateCurrent != SURF_RESOURCE_ON, this, OPEN); + StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN); action->p_file = file; return action; } @@ -444,7 +450,7 @@ StorageActionPtr StorageN11::close(surf_file_t fd) free(fd->name); free(fd->mount); xbt_free(fd); - StorageActionPtr action = new StorageN11Action(getModel(), 0, m_stateCurrent != SURF_RESOURCE_ON, this, CLOSE); + StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, CLOSE); return action; } @@ -457,7 +463,7 @@ StorageActionPtr StorageN11::read(surf_file_t fd, sg_size_t size) else fd->current_position += size; - StorageActionPtr action = new StorageN11Action(getModel(), size, m_stateCurrent != SURF_RESOURCE_ON, this, READ); + StorageActionPtr action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, READ); return action; } @@ -466,7 +472,7 @@ StorageActionPtr StorageN11::write(surf_file_t fd, sg_size_t size) char *filename = fd->name; XBT_DEBUG("\tWrite file '%s' size '%llu/%llu'",filename,size,fd->size); - StorageActionPtr action = new StorageN11Action(getModel(), size, m_stateCurrent != SURF_RESOURCE_ON, this, WRITE); + StorageActionPtr action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, WRITE); action->p_file = fd; fd->current_position += size; // If the storage is full