root/ompi/mca/fs/pvfs2/fs_pvfs2_file_delete.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fs_pvfs2_file_delete

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2011 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2008-2011 University of Houston. All rights reserved.
  13  * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
  14  * $COPYRIGHT$
  15  *
  16  * Additional copyrights may follow
  17  *
  18  * $HEADER$
  19  */
  20 
  21 /* This code is based on the PVFS2 ADIO module in ROMIO
  22  *   Copyright (C) 1997 University of Chicago.
  23  *   See COPYRIGHT notice in top-level directory.
  24  */
  25 
  26 #include "ompi_config.h"
  27 #include "fs_pvfs2.h"
  28 
  29 #include "mpi.h"
  30 #include "ompi/constants.h"
  31 #include "ompi/mca/fs/fs.h"
  32 
  33 /*
  34  *      file_delete_pvfs2
  35  *
  36  *      Function:       - deletes a file
  37  *      Accepts:        - file name & info
  38  *      Returns:        - Success if file closed
  39  */
  40 int
  41 mca_fs_pvfs2_file_delete (char* file_name,
  42                           struct opal_info_t *info)
  43 {
  44     PVFS_credentials credentials;
  45     PVFS_sysresp_getparent resp_getparent;
  46     int ret;
  47     PVFS_fs_id pvfs2_id;
  48     char pvfs2_path[OMPIO_PVFS2_MAX_NAME] = {0};
  49     char * ncache_timeout;
  50 
  51     if (!mca_fs_pvfs2_IS_INITIALIZED) {
  52         /* disable the pvfs2 ncache */
  53         ncache_timeout = getenv("PVFS2_NCACHE_TIMEOUT");
  54         if (ncache_timeout == NULL )
  55             setenv("PVFS2_NCACHE_TIMEOUT", "0", 1);
  56 
  57         ret = PVFS_util_init_defaults();
  58         if (ret < 0) {
  59             return OMPI_ERROR;
  60         }
  61         mca_fs_pvfs2_IS_INITIALIZED = 1;
  62     }
  63 
  64     memset (&credentials, 0, sizeof(PVFS_credentials));
  65     PVFS_util_gen_credentials (&credentials);
  66 
  67     ret = PVFS_util_resolve(file_name, &pvfs2_id, pvfs2_path, OMPIO_PVFS2_MAX_NAME);
  68     if (ret != 0) {
  69         return OMPI_ERROR;
  70     }
  71 
  72     ret = PVFS_sys_getparent(pvfs2_id, pvfs2_path, &credentials, &resp_getparent);
  73 
  74     ret = PVFS_sys_remove(resp_getparent.basename,
  75                           resp_getparent.parent_ref, &credentials);
  76     if (ret != 0) {
  77         return OMPI_ERROR;
  78     }
  79     return OMPI_SUCCESS;
  80 }

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