Implement an access function for MPIIO backend
Context: Some file systems require a prefix in the path. The POSIX 'access' call fails and consequently files are never deleted. This patch implements an access function in the MPIIO backend using MPI_File_open. Prefixes can now be parsed by ROMIO.master
parent
9a200097a5
commit
6d3edaffc8
|
@ -41,23 +41,49 @@ static void MPIIO_Close(void *, IOR_param_t *);
|
||||||
static void MPIIO_Delete(char *, IOR_param_t *);
|
static void MPIIO_Delete(char *, IOR_param_t *);
|
||||||
static void MPIIO_SetVersion(IOR_param_t *);
|
static void MPIIO_SetVersion(IOR_param_t *);
|
||||||
static void MPIIO_Fsync(void *, IOR_param_t *);
|
static void MPIIO_Fsync(void *, IOR_param_t *);
|
||||||
|
static int MPIIO_Access(const char *, int, IOR_param_t *);
|
||||||
|
|
||||||
/************************** D E C L A R A T I O N S ***************************/
|
/************************** D E C L A R A T I O N S ***************************/
|
||||||
|
|
||||||
ior_aiori_t mpiio_aiori = {
|
ior_aiori_t mpiio_aiori = {
|
||||||
"MPIIO",
|
.name = "MPIIO",
|
||||||
MPIIO_Create,
|
.create = MPIIO_Create,
|
||||||
MPIIO_Open,
|
.open = MPIIO_Open,
|
||||||
MPIIO_Xfer,
|
.xfer = MPIIO_Xfer,
|
||||||
MPIIO_Close,
|
.close = MPIIO_Close,
|
||||||
MPIIO_Delete,
|
.delete = MPIIO_Delete,
|
||||||
MPIIO_SetVersion,
|
.set_version = MPIIO_SetVersion,
|
||||||
MPIIO_Fsync,
|
.fsync = MPIIO_Fsync,
|
||||||
MPIIO_GetFileSize
|
.get_file_size = MPIIO_GetFileSize,
|
||||||
|
.access = MPIIO_Access,
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************** F U N C T I O N S ******************************/
|
/***************************** F U N C T I O N S ******************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to access a file through the MPIIO interface.
|
||||||
|
*/
|
||||||
|
static int MPIIO_Access(const char *path, int mode, IOR_param_t *param)
|
||||||
|
{
|
||||||
|
MPI_File fd;
|
||||||
|
int mpi_mode = MPI_MODE_UNIQUE_OPEN;
|
||||||
|
|
||||||
|
if ((mode & W_OK) && (mode & R_OK))
|
||||||
|
mpi_mode |= MPI_MODE_RDWR;
|
||||||
|
else if (mode & W_OK)
|
||||||
|
mpi_mode |= MPI_MODE_WRONLY;
|
||||||
|
else
|
||||||
|
mpi_mode |= MPI_MODE_RDONLY;
|
||||||
|
|
||||||
|
int ret = MPI_File_open(MPI_COMM_SELF, path, mpi_mode,
|
||||||
|
MPI_INFO_NULL, &fd);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
MPI_File_close(&fd);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create and open a file through the MPIIO interface.
|
* Create and open a file through the MPIIO interface.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue