2013-09-26 21:56:20 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2004-01-24 23:17:43 +00:00
|
|
|
/*
|
2007-03-16 23:11:45 +00:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 19:57:48 +00:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2015-06-23 20:59:57 -07:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-11-28 20:09:25 +00:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2013-09-26 21:56:20 +00:00
|
|
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2015-09-03 10:33:45 +09:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Additional copyrights may follow
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2004-01-24 23:17:43 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
#include "ompi_config.h"
|
2004-01-24 23:17:43 +00:00
|
|
|
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "ompi/mpi/c/bindings.h"
|
2009-04-29 01:32:14 +00:00
|
|
|
#include "ompi/runtime/params.h"
|
|
|
|
#include "ompi/errhandler/errhandler.h"
|
2005-09-12 09:17:44 +00:00
|
|
|
#include "ompi/info/info.h"
|
|
|
|
#include "ompi/file/file.h"
|
|
|
|
#include "ompi/mca/io/io.h"
|
|
|
|
#include "ompi/mca/io/base/base.h"
|
2004-01-24 23:17:43 +00:00
|
|
|
|
2015-08-31 09:36:02 +09:00
|
|
|
#if OMPI_BUILD_MPI_PROFILING
|
|
|
|
#if OPAL_HAVE_WEAK_SYMBOLS
|
2004-01-24 23:17:43 +00:00
|
|
|
#pragma weak MPI_File_delete = PMPI_File_delete
|
|
|
|
#endif
|
2015-09-09 16:30:26 +09:00
|
|
|
#define MPI_File_delete PMPI_File_delete
|
2004-04-20 18:50:43 +00:00
|
|
|
#endif
|
|
|
|
|
2004-07-30 02:58:53 +00:00
|
|
|
static const char FUNC_NAME[] = "MPI_File_delete";
|
|
|
|
|
|
|
|
|
2013-09-26 21:56:20 +00:00
|
|
|
int MPI_File_delete(const char *filename, MPI_Info info)
|
2004-07-30 02:58:53 +00:00
|
|
|
{
|
2004-09-14 10:55:10 +00:00
|
|
|
int rc;
|
|
|
|
|
2004-08-14 01:56:05 +00:00
|
|
|
if (MPI_PARAM_CHECK) {
|
2004-09-14 10:55:10 +00:00
|
|
|
rc = MPI_SUCCESS;
|
2004-08-14 01:56:05 +00:00
|
|
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
|
|
|
if (NULL == info || ompi_info_is_freed(info)) {
|
2004-09-14 10:55:10 +00:00
|
|
|
rc = MPI_ERR_INFO;
|
|
|
|
} else if (NULL == filename) {
|
|
|
|
rc = MPI_ERR_ARG;
|
2004-08-14 01:56:05 +00:00
|
|
|
}
|
2004-09-14 10:55:10 +00:00
|
|
|
OMPI_ERRHANDLER_CHECK(rc, MPI_FILE_NULL, rc, FUNC_NAME);
|
2004-08-12 16:56:24 +00:00
|
|
|
}
|
2004-07-30 02:58:53 +00:00
|
|
|
|
2006-10-17 00:18:35 +00:00
|
|
|
/* Note that MPI-2:9.7 (p265 in the ps; 261 in the pdf) says that
|
|
|
|
errors in MPI_FILE_OPEN (before the file handle is created)
|
|
|
|
should invoke the default error handler on MPI_FILE_NULL.
|
|
|
|
Hence, if we get a file handle out of ompi_file_open(), invoke
|
|
|
|
the error handler on that. If not, invoke the error handler on
|
|
|
|
MPI_FILE_NULL. */
|
2005-01-04 15:43:26 +00:00
|
|
|
|
|
|
|
/* The io framework is only initialized lazily. If it hasn't
|
|
|
|
already been initialized, do so now (note that MPI_FILE_OPEN
|
|
|
|
and MPI_FILE_DELETE are the only two places that it will be
|
2015-06-23 20:59:57 -07:00
|
|
|
initialized). We might want to add a check to see if the
|
2013-03-27 21:17:31 +00:00
|
|
|
framework is open instead of just incrementing the open count. */
|
2005-01-04 15:43:26 +00:00
|
|
|
|
2013-08-16 21:37:35 +00:00
|
|
|
if (OMPI_SUCCESS != (rc = mca_base_framework_open(&ompi_io_base_framework, 0))) {
|
2013-03-27 21:17:31 +00:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_FILE_NULL, rc, FUNC_NAME);
|
2005-01-04 15:43:26 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 22:15:52 +00:00
|
|
|
OPAL_CR_ENTER_LIBRARY();
|
|
|
|
|
2004-09-14 10:55:10 +00:00
|
|
|
/* Since there is no MPI_File handle associated with this
|
|
|
|
function, the MCA has to do a selection and perform the
|
|
|
|
action */
|
2015-09-03 10:33:45 +09:00
|
|
|
rc = mca_io_base_delete(filename, info);
|
2004-09-14 10:55:10 +00:00
|
|
|
OMPI_ERRHANDLER_RETURN(rc, MPI_FILE_NULL, rc, FUNC_NAME);
|
2004-01-24 23:17:43 +00:00
|
|
|
}
|