root/ompi/mpi/c/file_delete.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_File_delete

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

/* [<][>][^][v][top][bottom][index][help] */