+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */\r
+\r
+/* This program is free software; you can redistribute it and/or modify it\r
+ * under the terms of the license (GNU LGPL) which comes with this package. */\r
+#include "private.hpp"\r
+\r
+#include "smpi_comm.hpp"\r
+#include "smpi_coll.hpp"\r
+#include "smpi_info.hpp"\r
+#include "smpi_file.hpp"\r
+#include "simgrid/plugins/file_system.h"\r
+\r
+\r
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_io, smpi, "Logging specific to SMPI (RMA operations)");\r
+\r
+\r
+namespace simgrid{\r
+namespace smpi{\r
+ File::File(MPI_Comm comm, char *filename, int amode, MPI_Info info): comm_(comm), flags_(amode), info_(info){\r
+ file_= new simgrid::s4u::File(filename, nullptr);\r
+ }\r
+ \r
+ File::~File(){\r
+ delete file_;\r
+ }\r
+ \r
+ int File::close(MPI_File *fh){\r
+ (*fh)->sync();\r
+ if((*fh)->flags() & MPI_MODE_DELETE_ON_CLOSE)\r
+ (*fh)->file_->unlink();\r
+ delete fh;\r
+ return MPI_SUCCESS;\r
+ }\r
+ \r
+ int File::del(char *filename, MPI_Info info){\r
+ File* f = new File(MPI_COMM_SELF,filename,MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDWR, nullptr);\r
+ close(&f);\r
+ return MPI_SUCCESS;\r
+ }\r
+ \r
+ int File::size(){\r
+ return file_->size();\r
+ }\r
+ \r
+ int File::flags(){\r
+ return flags_;\r
+ }\r
+ int File::sync(){\r
+ //no idea\r
+ return simgrid::smpi::Colls::barrier(comm_);\r
+ }\r
+}\r
+}
\ No newline at end of file