1 /* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/simix/SynchroIo.hpp"
7 #include "src/surf/surf_interface.hpp"
8 #include "src/simix/popping_private.h"
9 #include "src/simix/smx_private.h"
11 void simgrid::simix::Io::suspend()
17 void simgrid::simix::Io::resume()
23 void simgrid::simix::Io::post()
26 smx_simcall_t simcall;
28 xbt_fifo_foreach(simcalls,i,simcall,smx_simcall_t) {
29 switch (simcall->call) {
30 case SIMCALL_FILE_OPEN: {
31 smx_file_t tmp = xbt_new(s_smx_file_t,1);
32 tmp->surf_file = surf_storage_action_get_file(surf_io);
33 simcall_file_open__set__result(simcall, tmp);
36 case SIMCALL_FILE_CLOSE:
37 xbt_free(simcall_file_close__get__fd(simcall));
38 simcall_file_close__set__result(simcall, 0);
40 case SIMCALL_FILE_WRITE:
41 simcall_file_write__set__result(simcall, surf_io->getCost());
44 case SIMCALL_FILE_READ:
45 simcall_file_read__set__result(simcall, surf_io->getCost());
53 switch (surf_io->getState()) {
55 case simgrid::surf::Action::State::failed:
59 case simgrid::surf::Action::State::done:
68 SIMIX_io_finish(this);