int desc_id = 0;
private:
- smx_file_t pimpl_ = nullptr;
- const char* path_ = nullptr;
- void* userdata_ = nullptr;
- sg_host_t host_ = nullptr;
+ surf_file_t pimpl_ = nullptr;
+ const char* path_ = nullptr;
+ void* userdata_ = nullptr;
+ sg_host_t host_ = nullptr;
};
}
} // namespace simgrid::s4u
#include "simgrid/datatypes.h"
#include "simgrid/host.h"
+#include "surf/surf.h"
#include "xbt/ex.h"
#include "xbt/parmap.h"
-
/* ******************************** Host ************************************ */
/** @brief Host datatype
@ingroup simix_host_management
*/
typedef struct s_smx_sem *smx_sem_t;
-/********************************** File *************************************/
-typedef struct s_smx_file *smx_file_t;
-
/* ****************************** Process *********************************** */
typedef enum {
XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem);
/***************************** File **********************************/
-XBT_PUBLIC(void *) simcall_file_get_data(smx_file_t fd);
-XBT_PUBLIC(void) simcall_file_set_data(smx_file_t fd, void *data);
-XBT_PUBLIC(sg_size_t) simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PUBLIC(sg_size_t) simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PUBLIC(smx_file_t) simcall_file_open(const char* mount, const char* path, sg_storage_t st);
-XBT_PUBLIC(int) simcall_file_close(smx_file_t fd, sg_host_t host);
-XBT_PUBLIC(int) simcall_file_unlink(smx_file_t fd, sg_host_t host);
-XBT_PUBLIC(sg_size_t) simcall_file_get_size(smx_file_t fd);
-XBT_PUBLIC(sg_size_t) simcall_file_tell(smx_file_t fd);
-XBT_PUBLIC(int) simcall_file_seek(smx_file_t fd, sg_offset_t offset, int origin);
-XBT_PUBLIC(int) simcall_file_move(smx_file_t fd, const char* fullpath);
+XBT_PUBLIC(void*) simcall_file_get_data(surf_file_t fd);
+XBT_PUBLIC(void) simcall_file_set_data(surf_file_t fd, void* data);
+XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PUBLIC(sg_size_t) simcall_file_write(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PUBLIC(surf_file_t) simcall_file_open(const char* mount, const char* path, sg_storage_t st);
+XBT_PUBLIC(int) simcall_file_close(surf_file_t fd, sg_host_t host);
+XBT_PUBLIC(int) simcall_file_unlink(surf_file_t fd, sg_host_t host);
+XBT_PUBLIC(sg_size_t) simcall_file_get_size(surf_file_t fd);
+XBT_PUBLIC(sg_size_t) simcall_file_tell(surf_file_t fd);
+XBT_PUBLIC(int) simcall_file_seek(surf_file_t fd, sg_offset_t offset, int origin);
+XBT_PUBLIC(int) simcall_file_move(surf_file_t fd, const char* fullpath);
/************************** MC simcalls **********************************/
XBT_PUBLIC(int) simcall_mc_random(int min, int max);
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/activity/SynchroIo.hpp"
-#include "src/surf/surf_interface.hpp"
#include "src/simix/smx_private.h"
+#include "src/surf/FileImpl.hpp"
+#include "src/surf/surf_interface.hpp"
void simgrid::kernel::activity::IoImpl::suspend()
{
for (smx_simcall_t simcall : simcalls) {
switch (simcall->call) {
case SIMCALL_FILE_OPEN: {
- smx_file_t tmp = xbt_new(s_smx_file_t,1);
- tmp->surf_file = surf_storage_action_get_file(surf_io);
+ surf_file_t tmp = surf_storage_action_get_file(surf_io);
simcall_file_open__set__result(simcall, tmp);
break;
}
case SIMCALL_FILE_CLOSE:
- xbt_free(simcall_file_close__get__fd(simcall));
+ delete simcall_file_close__get__fd(simcall);
simcall_file_close__set__result(simcall, 0);
break;
case SIMCALL_FILE_WRITE:
void reportMultipleUse() const;
} s_simdata_task_t;
-/********************************* File **************************************/
-typedef struct simdata_file {
- smx_file_t smx_file;
-} s_simdata_file_t;
-
/******************************* Process *************************************/
namespace simgrid {
* \ingroup simix_file_management
*
*/
-sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
+sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size, sg_host_t host)
{
return simcall_BODY_file_read(fd, size, host);
}
* \ingroup simix_file_management
*
*/
-sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
+sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size, sg_host_t host)
{
return simcall_BODY_file_write(fd, size, host);
}
* \ingroup simix_file_management
* \brief
*/
-smx_file_t simcall_file_open(const char* mount, const char* path, sg_storage_t st)
+surf_file_t simcall_file_open(const char* mount, const char* path, sg_storage_t st)
{
return simcall_BODY_file_open(mount, path, st);
}
* \ingroup simix_file_management
*
*/
-int simcall_file_close(smx_file_t fd, sg_host_t host)
+int simcall_file_close(surf_file_t fd, sg_host_t host)
{
return simcall_BODY_file_close(fd, host);
}
* \ingroup simix_file_management
*
*/
-int simcall_file_unlink(smx_file_t fd, sg_host_t host)
+int simcall_file_unlink(surf_file_t fd, sg_host_t host)
{
return simcall_BODY_file_unlink(fd, host);
}
* \ingroup simix_file_management
*
*/
-sg_size_t simcall_file_get_size(smx_file_t fd){
+sg_size_t simcall_file_get_size(surf_file_t fd)
+{
return simcall_BODY_file_get_size(fd);
}
* \ingroup simix_file_management
*
*/
-sg_size_t simcall_file_tell(smx_file_t fd){
+sg_size_t simcall_file_tell(surf_file_t fd)
+{
return simcall_BODY_file_tell(fd);
}
* \ingroup simix_file_management
*
*/
-int simcall_file_seek(smx_file_t fd, sg_offset_t offset, int origin){
+int simcall_file_seek(surf_file_t fd, sg_offset_t offset, int origin)
+{
return simcall_BODY_file_seek(fd, offset, origin);
}
* \brief Move a file to another location on the *same mount point*.
*
*/
-int simcall_file_move(smx_file_t fd, const char* fullpath)
+int simcall_file_move(surf_file_t fd, const char* fullpath)
{
return simcall_BODY_file_move(fd, fullpath);
}
simgrid::simix::marshal<int>(simcall->result, result);
}
-static inline smx_file_t simcall_file_read__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_read__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_read__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_read__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_read__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_read__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_size_t simcall_file_read__get__size(smx_simcall_t simcall)
{
simgrid::simix::marshal<sg_size_t>(simcall->result, result);
}
-static inline smx_file_t simcall_file_write__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_write__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_write__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_write__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_write__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_write__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_size_t simcall_file_write__get__size(smx_simcall_t simcall)
{
{
simgrid::simix::marshal<sg_storage_t>(simcall->args[2], arg);
}
-static inline smx_file_t simcall_file_open__get__result(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_open__get__result(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->result);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->result);
}
-static inline smx_file_t simcall_file_open__getraw__result(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_open__getraw__result(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->result);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->result);
}
-static inline void simcall_file_open__set__result(smx_simcall_t simcall, smx_file_t result){
- simgrid::simix::marshal<smx_file_t>(simcall->result, result);
+static inline void simcall_file_open__set__result(smx_simcall_t simcall, surf_file_t result)
+{
+ simgrid::simix::marshal<surf_file_t>(simcall->result, result);
}
-static inline smx_file_t simcall_file_close__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_close__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_close__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_close__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_close__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_close__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_host_t simcall_file_close__get__host(smx_simcall_t simcall)
{
simgrid::simix::marshal<int>(simcall->result, result);
}
-static inline smx_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_unlink__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_unlink__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_host_t simcall_file_unlink__get__host(smx_simcall_t simcall)
{
simgrid::simix::marshal<int>(simcall->result, result);
}
-static inline smx_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_get_size__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_get_size__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_get_size__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_get_size__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_size_t simcall_file_get_size__get__result(smx_simcall_t simcall)
{
simgrid::simix::marshal<sg_size_t>(simcall->result, result);
}
-static inline smx_file_t simcall_file_tell__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_tell__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_tell__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_tell__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_tell__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_tell__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_size_t simcall_file_tell__get__result(smx_simcall_t simcall)
{
simgrid::simix::marshal<sg_size_t>(simcall->result, result);
}
-static inline smx_file_t simcall_file_seek__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_seek__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_seek__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_seek__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_seek__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_seek__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline sg_offset_t simcall_file_seek__get__offset(smx_simcall_t simcall)
{
simgrid::simix::marshal<int>(simcall->result, result);
}
-static inline smx_file_t simcall_file_move__get__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_move__get__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
}
-static inline smx_file_t simcall_file_move__getraw__fd(smx_simcall_t simcall)
+static inline surf_file_t simcall_file_move__getraw__fd(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<smx_file_t>(simcall->args[0]);
+ return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
}
-static inline void simcall_file_move__set__fd(smx_simcall_t simcall, smx_file_t arg)
+static inline void simcall_file_move__set__fd(smx_simcall_t simcall, surf_file_t arg)
{
- simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
+ simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
}
static inline const char* simcall_file_move__get__fullpath(smx_simcall_t simcall)
{
XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
XBT_PRIVATE int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem);
-XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host);
XBT_PRIVATE void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* mount, const char* path, sg_storage_t st);
-XBT_PRIVATE void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host);
-XBT_PRIVATE int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t fd, const char* fullpath);
+XBT_PRIVATE void simcall_HANDLER_file_close(smx_simcall_t simcall, surf_file_t fd, sg_host_t host);
+XBT_PRIVATE int simcall_HANDLER_file_move(smx_simcall_t simcall, surf_file_t fd, const char* fullpath);
XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
return simcall<int, smx_sem_t>(SIMCALL_SEM_GET_CAPACITY, sem);
}
-inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, sg_host_t host) {
+ inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size, sg_host_t host)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size, host);
- return simcall<sg_size_t, smx_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_READ, fd, size, host);
+ return simcall<sg_size_t, surf_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_READ, fd, size, host);
}
-inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, sg_host_t host) {
+ inline static sg_size_t simcall_BODY_file_write(surf_file_t fd, sg_size_t size, sg_host_t host)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size, host);
- return simcall<sg_size_t, smx_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_WRITE, fd, size, host);
+ return simcall<sg_size_t, surf_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_WRITE, fd, size, host);
}
- inline static smx_file_t simcall_BODY_file_open(const char* mount, const char* path, sg_storage_t st)
+ inline static surf_file_t simcall_BODY_file_open(const char* mount, const char* path, sg_storage_t st)
{
/* Go to that function to follow the code flow through the simcall barrier */
if (0)
simcall_HANDLER_file_open(&SIMIX_process_self()->simcall, mount, path, st);
- return simcall<smx_file_t, const char*, const char*, sg_storage_t>(SIMCALL_FILE_OPEN, mount, path, st);
+ return simcall<surf_file_t, const char*, const char*, sg_storage_t>(SIMCALL_FILE_OPEN, mount, path, st);
}
-inline static int simcall_BODY_file_close(smx_file_t fd, sg_host_t host) {
+ inline static int simcall_BODY_file_close(surf_file_t fd, sg_host_t host)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_file_close(&SIMIX_process_self()->simcall, fd, host);
- return simcall<int, smx_file_t, sg_host_t>(SIMCALL_FILE_CLOSE, fd, host);
+ return simcall<int, surf_file_t, sg_host_t>(SIMCALL_FILE_CLOSE, fd, host);
}
-inline static int simcall_BODY_file_unlink(smx_file_t fd, sg_host_t host) {
+ inline static int simcall_BODY_file_unlink(surf_file_t fd, sg_host_t host)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) SIMIX_file_unlink(fd, host);
- return simcall<int, smx_file_t, sg_host_t>(SIMCALL_FILE_UNLINK, fd, host);
+ return simcall<int, surf_file_t, sg_host_t>(SIMCALL_FILE_UNLINK, fd, host);
}
-inline static sg_size_t simcall_BODY_file_get_size(smx_file_t fd) {
+ inline static sg_size_t simcall_BODY_file_get_size(surf_file_t fd)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0)
SIMIX_file_get_size(fd);
- return simcall<sg_size_t, smx_file_t>(SIMCALL_FILE_GET_SIZE, fd);
+ return simcall<sg_size_t, surf_file_t>(SIMCALL_FILE_GET_SIZE, fd);
}
-inline static sg_size_t simcall_BODY_file_tell(smx_file_t fd) {
+ inline static sg_size_t simcall_BODY_file_tell(surf_file_t fd)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0)
SIMIX_file_tell(fd);
- return simcall<sg_size_t, smx_file_t>(SIMCALL_FILE_TELL, fd);
+ return simcall<sg_size_t, surf_file_t>(SIMCALL_FILE_TELL, fd);
}
-inline static int simcall_BODY_file_seek(smx_file_t fd, sg_offset_t offset, int origin) {
+ inline static int simcall_BODY_file_seek(surf_file_t fd, sg_offset_t offset, int origin)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0)
SIMIX_file_seek(fd, offset, origin);
- return simcall<int, smx_file_t, sg_offset_t, int>(SIMCALL_FILE_SEEK, fd, offset, origin);
+ return simcall<int, surf_file_t, sg_offset_t, int>(SIMCALL_FILE_SEEK, fd, offset, origin);
}
-inline static int simcall_BODY_file_move(smx_file_t fd, const char* fullpath) {
+ inline static int simcall_BODY_file_move(surf_file_t fd, const char* fullpath)
+ {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) simcall_HANDLER_file_move(&SIMIX_process_self()->simcall, fd, fullpath);
- return simcall<int, smx_file_t, const char*>(SIMCALL_FILE_MOVE, fd, fullpath);
+ return simcall<int, surf_file_t, const char*>(SIMCALL_FILE_MOVE, fd, fullpath);
}
inline static int simcall_BODY_mc_random(int min, int max) {
break;
case SIMCALL_FILE_READ:
- simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
- break;
+ simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
+ simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]),
+ simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
+ break;
case SIMCALL_FILE_WRITE:
- simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
- break;
+ simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
+ simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]),
+ simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
+ break;
case SIMCALL_FILE_OPEN:
simcall_HANDLER_file_open(simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0]),
break;
case SIMCALL_FILE_CLOSE:
- simcall_HANDLER_file_close(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
- break;
+ simcall_HANDLER_file_close(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
+ simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
+ break;
case SIMCALL_FILE_UNLINK:
- simgrid::simix::marshal<int>(simcall->result, SIMIX_file_unlink(simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1])));
- SIMIX_simcall_answer(simcall);
- break;
+ simgrid::simix::marshal<int>(simcall->result,
+ SIMIX_file_unlink(simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
+ simgrid::simix::unmarshal<sg_host_t>(simcall->args[1])));
+ SIMIX_simcall_answer(simcall);
+ break;
case SIMCALL_FILE_GET_SIZE:
simgrid::simix::marshal<sg_size_t>(simcall->result,
- SIMIX_file_get_size(simgrid::simix::unmarshal<smx_file_t>(simcall->args[0])));
+ SIMIX_file_get_size(simgrid::simix::unmarshal<surf_file_t>(simcall->args[0])));
SIMIX_simcall_answer(simcall);
break;
case SIMCALL_FILE_TELL:
simgrid::simix::marshal<sg_size_t>(simcall->result,
- SIMIX_file_tell(simgrid::simix::unmarshal<smx_file_t>(simcall->args[0])));
+ SIMIX_file_tell(simgrid::simix::unmarshal<surf_file_t>(simcall->args[0])));
SIMIX_simcall_answer(simcall);
break;
case SIMCALL_FILE_SEEK:
simgrid::simix::marshal<int>(simcall->result,
- SIMIX_file_seek(simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]),
+ SIMIX_file_seek(simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
simgrid::simix::unmarshal<sg_offset_t>(simcall->args[1]),
simgrid::simix::unmarshal<int>(simcall->args[2])));
SIMIX_simcall_answer(simcall);
break;
case SIMCALL_FILE_MOVE:
- simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_file_move(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<const char*>(simcall->args[1])));
- SIMIX_simcall_answer(simcall);
- break;
+ simgrid::simix::marshal<int>(
+ simcall->result, simcall_HANDLER_file_move(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
+ simgrid::simix::unmarshal<const char*>(simcall->args[1])));
+ SIMIX_simcall_answer(simcall);
+ break;
case SIMCALL_MC_RANDOM:
simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1])));
void sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
int sem_get_capacity(smx_sem_t sem);
-sg_size_t file_read(smx_file_t fd, sg_size_t size, sg_host_t host) [[block]];
-sg_size_t file_write(smx_file_t fd, sg_size_t size, sg_host_t host) [[block]];
-smx_file_t file_open(const char* mount, const char* path, sg_storage_t st) [[block]];
-int file_close(smx_file_t fd, sg_host_t host) [[block]];
-int file_unlink(smx_file_t fd, sg_host_t host) [[nohandler]];
-sg_size_t file_get_size(smx_file_t fd) [[nohandler]];
-sg_size_t file_tell(smx_file_t fd) [[nohandler]];
-int file_seek(smx_file_t fd, sg_offset_t offset, int origin) [[nohandler]];
-int file_move(smx_file_t fd, const char* fullpath);
+sg_size_t file_read(surf_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+sg_size_t file_write(surf_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+surf_file_t file_open(const char* mount, const char* path, sg_storage_t st) [[block]];
+int file_close(surf_file_t fd, sg_host_t host) [[block]];
+int file_unlink(surf_file_t fd, sg_host_t host) [[nohandler]];
+sg_size_t file_get_size(surf_file_t fd) [[nohandler]];
+sg_size_t file_tell(surf_file_t fd) [[nohandler]];
+int file_seek(surf_file_t fd, sg_offset_t offset, int origin) [[nohandler]];
+int file_move(surf_file_t fd, const char* fullpath);
int mc_random(int min, int max);
void set_category(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> synchro, const char* category) [[nohandler]];
#include "simgrid/s4u/Storage.hpp"
#include "src/surf/FileImpl.hpp"
#include "src/surf/StorageImpl.hpp"
+#include "surf/surf.h"
#include <mc/mc.h>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
//SIMIX FILE READ
-void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
+void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host)
{
smx_activity_t synchro = SIMIX_file_read(fd, size, host);
synchro->simcalls.push_back(simcall);
simcall->issuer->waiting_synchro = synchro;
}
-smx_activity_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host)
+smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size, sg_host_t host)
{
/* check if the host is active */
if (host->isOff())
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
synchro->host = host;
- synchro->surf_io = surf_host_read(host, fd->surf_file, size);
+ synchro->surf_io = surf_host_read(host, file, size);
synchro->surf_io->setData(synchro);
XBT_DEBUG("Create io synchro %p", synchro);
}
//SIMIX FILE WRITE
-void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, sg_host_t host)
+void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size, sg_host_t host)
{
smx_activity_t synchro = SIMIX_file_write(fd, size, host);
synchro->simcalls.push_back(simcall);
simcall->issuer->waiting_synchro = synchro;
}
-smx_activity_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host)
+smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size, sg_host_t host)
{
if (host->isOff())
THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
synchro->host = host;
- synchro->surf_io = surf_host_write(host, fd->surf_file, size);
+ synchro->surf_io = surf_host_write(host, file, size);
synchro->surf_io->setData(synchro);
XBT_DEBUG("Create io synchro %p", synchro);
}
//SIMIX FILE CLOSE
-void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, sg_host_t host)
+void simcall_HANDLER_file_close(smx_simcall_t simcall, surf_file_t fd, sg_host_t host)
{
smx_activity_t synchro = SIMIX_file_close(fd, host);
synchro->simcalls.push_back(simcall);
simcall->issuer->waiting_synchro = synchro;
}
-smx_activity_t SIMIX_file_close(smx_file_t fd, sg_host_t host)
+smx_activity_t SIMIX_file_close(surf_file_t file, sg_host_t host)
{
if (host->isOff())
THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
synchro->host = host;
- synchro->surf_io = surf_host_close(host, fd->surf_file);
+ synchro->surf_io = surf_host_close(host, file);
synchro->surf_io->setData(synchro);
XBT_DEBUG("Create io synchro %p", synchro);
}
//SIMIX FILE UNLINK
-int SIMIX_file_unlink(smx_file_t fd, sg_host_t host)
+int SIMIX_file_unlink(surf_file_t file, sg_host_t host)
{
if (host->isOff())
THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->cname());
- return surf_host_unlink(host, fd->surf_file);
+ return surf_host_unlink(host, file);
}
-sg_size_t SIMIX_file_get_size(smx_file_t fd)
+sg_size_t SIMIX_file_get_size(surf_file_t fd)
{
- return fd->surf_file->size();
+ return fd->size();
}
-sg_size_t SIMIX_file_tell(smx_file_t fd)
+sg_size_t SIMIX_file_tell(surf_file_t fd)
{
- return fd->surf_file->tell();
+ return fd->tell();
}
-int SIMIX_file_seek(smx_file_t fd, sg_offset_t offset, int origin)
+int SIMIX_file_seek(surf_file_t fd, sg_offset_t offset, int origin)
{
- return fd->surf_file->seek(offset, origin);
+ return fd->seek(offset, origin);
}
-int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t file, const char* fullpath)
+int simcall_HANDLER_file_move(smx_simcall_t simcall, surf_file_t file, const char* fullpath)
{
return SIMIX_file_move(simcall->issuer, file, fullpath);
}
-int SIMIX_file_move(smx_actor_t process, smx_file_t file, const char* fullpath)
+int SIMIX_file_move(smx_actor_t process, surf_file_t file, const char* fullpath)
{
sg_host_t host = process->host;
- return surf_host_file_move(host, file->surf_file, fullpath);
+ return surf_host_file_move(host, file, fullpath);
}
void SIMIX_io_destroy(smx_activity_t synchro)
#include "simgrid/simix.h"
#include "popping_private.h"
-XBT_PRIVATE smx_activity_t SIMIX_file_read(smx_file_t fd, sg_size_t size, sg_host_t host);
-XBT_PRIVATE smx_activity_t SIMIX_file_write(smx_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE smx_activity_t SIMIX_file_read(surf_file_t fd, sg_size_t size, sg_host_t host);
+XBT_PRIVATE smx_activity_t SIMIX_file_write(surf_file_t fd, sg_size_t size, sg_host_t host);
XBT_PRIVATE smx_activity_t SIMIX_file_open(const char* mount, const char* path, sg_storage_t st);
-XBT_PRIVATE smx_activity_t SIMIX_file_close(smx_file_t fd, sg_host_t host);
-XBT_PRIVATE int SIMIX_file_unlink(smx_file_t fd, sg_host_t host);
-XBT_PRIVATE sg_size_t SIMIX_file_get_size(smx_file_t fd);
-XBT_PRIVATE sg_size_t SIMIX_file_tell(smx_file_t fd);
-XBT_PRIVATE int SIMIX_file_seek(smx_file_t fd, sg_offset_t offset, int origin);
-XBT_PRIVATE int SIMIX_file_move(smx_actor_t process, smx_file_t fd, const char* fullpath);
+XBT_PRIVATE smx_activity_t SIMIX_file_close(surf_file_t fd, sg_host_t host);
+XBT_PRIVATE int SIMIX_file_unlink(surf_file_t fd, sg_host_t host);
+XBT_PRIVATE sg_size_t SIMIX_file_get_size(surf_file_t fd);
+XBT_PRIVATE sg_size_t SIMIX_file_tell(surf_file_t fd);
+XBT_PRIVATE int SIMIX_file_seek(surf_file_t fd, sg_offset_t offset, int origin);
+XBT_PRIVATE int SIMIX_file_move(smx_actor_t process, surf_file_t fd, const char* fullpath);
XBT_PRIVATE void SIMIX_io_destroy(smx_activity_t synchro);
XBT_PRIVATE void SIMIX_io_finish(smx_activity_t synchro);
_smx_throw_issuer->exception = std::make_exception_ptr(e); \
} else ((void)0)
-typedef struct s_smx_file {
- surf_file_t surf_file;
-} s_smx_file_t;
-
-
SG_END_DECL()
#endif
++it;
}
}
- delete fd;
StorageAction* action = new StorageN11Action(model(), 0, isOff(), this, CLOSE);
return action;
}