root/ompi/mca/fs/ime/fs_ime_file_set_size.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_fs_ime_file_set_size

   1 /*
   2  * Copyright (c) 2018      DataDirect Networks. All rights reserved.
   3  * $COPYRIGHT$
   4  *
   5  * Additional copyrights may follow
   6  *
   7  * $HEADER$
   8  */
   9 
  10 #include "ime_native.h"
  11 
  12 #include "ompi_config.h"
  13 #include "fs_ime.h"
  14 
  15 #include "mpi.h"
  16 #include "ompi/constants.h"
  17 #include "ompi/mca/fs/fs.h"
  18 
  19 /*
  20  *      file_set_size_ime
  21  *
  22  *      Function:       - set_size of a file
  23  *      Accepts:        - same arguments as MPI_File_set_size()
  24  *      Returns:        - Success if size is set
  25  */
  26 int mca_fs_ime_file_set_size (ompio_file_t *fh,
  27                               OMPI_MPI_OFFSET_TYPE size)
  28 {
  29     int ret = 0;
  30 
  31     /* reset errno */
  32     errno = 0;
  33 
  34     if (OMPIO_ROOT == fh->f_rank) {
  35         ret = ime_native_ftruncate(fh->fd, size);
  36     }
  37 
  38     fh->f_comm->c_coll->coll_bcast(&ret,
  39                                    1,
  40                                    MPI_INT,
  41                                    OMPIO_ROOT,
  42                                    fh->f_comm,
  43                                    fh->f_comm->c_coll->coll_bcast_module);
  44 
  45     if (ret < 0) {
  46         return mca_fs_ime_get_mpi_err(errno);
  47     }
  48     return OMPI_SUCCESS;
  49 }

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