- XBT_DEBUG("\tOpen file '%s'",path);
-
- sg_size_t size, *psize;
- psize = (sg_size_t*) xbt_dict_get_or_null(content_, path);
- // if file does not exist create an empty file
- if(psize)
- size = *psize;
- else {
- psize = xbt_new(sg_size_t,1);
- size = 0;
- *psize = size;
- xbt_dict_set(content_, path, psize, nullptr);
- XBT_DEBUG("File '%s' was not found, file created.",path);
- }
- surf_file_t file = xbt_new0(s_surf_file_t,1);
- file->name = xbt_strdup(path);
- file->size = size;
- file->mount = xbt_strdup(mount);
- file->current_position = 0;
-
- StorageAction *action = new StorageN11Action(getModel(), 0, isOff(), this, OPEN);
- action->file_ = file;
-
- return action;
-}
-
-StorageAction *StorageN11::close(surf_file_t fd)
-{
- XBT_DEBUG("\tClose file '%s' size '%llu'", fd->name, fd->size);
- // unref write actions from storage
- for (std::vector<StorageAction*>::iterator it = writeActions_.begin(); it != writeActions_.end();) {
- StorageAction *write_action = *it;
- if ((write_action->file_) == fd) {
- write_action->unref();
- it = writeActions_.erase(it);
- } else {
- ++it;
- }
- }
- free(fd->name);
- free(fd->mount);
- xbt_free(fd);
- StorageAction *action = new StorageN11Action(getModel(), 0, isOff(), this, CLOSE);
- return action;