X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b3b356352e87ae00a20f737c48e19b0c8413455a..f34ca502a5eb4e4c15cfa6cd36d4ee4da88bc5e1:/src/surf/storage_n11.cpp diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 7d73325d30..01769e102b 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -214,7 +214,7 @@ void surf_storage_model_init_default(void) { surf_storage_model = new StorageN11Model(); storage_define_callbacks(); - xbt_dynar_push(model_list, &surf_storage_model); + xbt_dynar_push(all_existing_models, &surf_storage_model); } StorageN11Model::StorageN11Model() : StorageModel() { @@ -252,7 +252,7 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id, Storage *storage = new StorageN11(this, id, properties, p_maxminSystem, Bread, Bwrite, Bconnection, type_id, (char *)content_name, xbt_strdup(content_type), storage_type->size, (char *) attach); - + surf_callback_emit(storageCreatedCallbacks, storage); xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage); XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tproperties '%p'\n\t\tBread '%f'\n", @@ -433,7 +433,11 @@ StorageAction *StorageN11::close(surf_file_t fd) StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size) { if(fd->current_position + size > fd->size){ - size = fd->size - fd->current_position; + if (fd->current_position > fd->size){ + size = 0; + } else { + size = fd->size - fd->current_position; + } fd->current_position = fd->size; } else @@ -498,7 +502,7 @@ int StorageN11Action::unref() { m_refcount--; if (!m_refcount) { - if (actionHook::is_linked()) + if (action_hook.is_linked()) p_stateSet->erase(p_stateSet->iterator_to(*this)); if (getVariable()) lmm_variable_free(getModel()->getMaxminSystem(), getVariable());