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

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fs_pvfs2_file_set_size

   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-2017 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) 2018      Research Organization for Information Science
  14  *                         and Technology (RIST). All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 /* This code is based on the PVFS2 ADIO module in ROMIO
  23  *   Copyright (C) 1997 University of Chicago.
  24  *   See COPYRIGHT notice in top-level directory.
  25  */
  26 
  27 #include "ompi_config.h"
  28 #include "fs_pvfs2.h"
  29 
  30 #include "mpi.h"
  31 #include "ompi/constants.h"
  32 #include "ompi/mca/fs/fs.h"
  33 
  34 /*
  35  *      file_set_size_pvfs2
  36  *
  37  *      Function:       - set_size of a file
  38  *      Accepts:        - same arguments as MPI_File_set_size()
  39  *      Returns:        - Success if size is set
  40  */
  41 int
  42 mca_fs_pvfs2_file_set_size (ompio_file_t *fh,
  43                             OMPI_MPI_OFFSET_TYPE size)
  44 {
  45     int ret;
  46     mca_fs_pvfs2 *pvfs2_fs;
  47 
  48     pvfs2_fs = (mca_fs_pvfs2 *)fh->f_fs_ptr;
  49 
  50     if (OMPIO_ROOT == fh->f_rank) {
  51         ret = PVFS_sys_truncate(pvfs2_fs->object_ref,
  52                                 size, &(pvfs2_fs->credentials));
  53         fh->f_comm->c_coll->coll_bcast (&ret,
  54                                        1,
  55                                        MPI_INT,
  56                                        OMPIO_ROOT,
  57                                        fh->f_comm,
  58                                        fh->f_comm->c_coll->coll_bcast_module);
  59     }
  60     else {
  61         fh->f_comm->c_coll->coll_bcast (&ret,
  62                                        1,
  63                                        MPI_INT,
  64                                        OMPIO_ROOT,
  65                                        fh->f_comm,
  66                                        fh->f_comm->c_coll->coll_bcast_module);
  67     }
  68 
  69     if (ret != 0) {
  70         return OMPI_ERROR;
  71     }
  72 
  73     return OMPI_SUCCESS;
  74 }

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